Point or displacement vector in the horizontal (XY) plane.
More...
#include <meshkit/geometry.hpp>
|
| constexpr | Point2 ()=default |
| | Construct the origin (0, 0).
|
| |
| constexpr | Point2 (double x, double y) |
| | Construct a point from its coordinates.
|
| |
| constexpr double | x () const noexcept |
| | X coordinate in XY plane units.
|
| |
| constexpr double | y () const noexcept |
| | Y coordinate in XY plane units.
|
| |
| double * | data () noexcept |
| | Pointer to the two contiguous coordinates {x, y}.
|
| |
| const double * | data () const noexcept |
| | Read-only pointer to the two contiguous coordinates {x, y}.
|
| |
| constexpr bool | isNull () const |
| | True when both coordinates compare equal to 0 (-0.0 counts, NaN does not).
|
| |
| Point2 & | operator*= (double s) |
| | Multiply both coordinates by s in place.
|
| |
| Point2 & | operator/= (double s) |
| | Divide both coordinates by s in place.
|
| |
| Point2 & | operator+= (Point2 p) |
| | Add p component-wise in place.
|
| |
| Point2 & | operator-= (Point2 p) |
| | Subtract p component-wise in place.
|
| |
|
| constexpr Point2 | operator+ (Point2 a, Point2 b) |
| | Component-wise sum.
|
| |
| constexpr Point2 | operator- (Point2 a, Point2 b) |
| | Component-wise difference, the displacement from b to a.
|
| |
| constexpr Point2 | operator* (Point2 a, double s) |
| | Scale a point by a factor.
|
| |
| constexpr Point2 | operator* (double s, Point2 a) |
| | Scale a point by a factor, factor first; same result as a * s.
|
| |
| constexpr Point2 | operator/ (Point2 a, double s) |
| | Divide a point by a divisor.
|
| |
| constexpr bool | operator== (Point2 a, Point2 b) |
| | Exact component-wise equality, with no tolerance.
|
| |
| constexpr bool | operator!= (Point2 a, Point2 b) |
| | Negation of operator==.
|
| |
Point or displacement vector in the horizontal (XY) plane.
Coordinates are doubles in the caller's XY plane units; no CRS or unit conversion is applied and no finiteness checks are made, so arithmetic follows plain IEEE rules. The type is a standard-layout pair of doubles {x, y} (checked by a static_assert at the end of this header), so a contiguous array of Point2 can be read as interleaved x, y values; the Python bindings expose point arrays that way. It is the point type of detail::StandardStorage, standing in for QPointF.
◆ Point2() [1/2]
| meshkit::Point2::Point2 |
( |
| ) |
|
|
constexprdefault |
Construct the origin (0, 0).
◆ Point2() [2/2]
| meshkit::Point2::Point2 |
( |
double | x, |
|
|
double | y ) |
|
inlineconstexpr |
Construct a point from its coordinates.
- Parameters
-
| [in] | x | X coordinate in XY plane units. |
| [in] | y | Y coordinate in XY plane units. |
◆ data() [1/2]
| const double * meshkit::Point2::data |
( |
| ) |
const |
|
inlinenoexcept |
Read-only pointer to the two contiguous coordinates {x, y}.
- Returns
- Pointer into this object, valid while this Point2 lives.
◆ data() [2/2]
| double * meshkit::Point2::data |
( |
| ) |
|
|
inlinenoexcept |
Pointer to the two contiguous coordinates {x, y}.
- Returns
- Pointer into this object; writing through it changes the point. Valid while this Point2 lives.
◆ dotProduct()
| static constexpr double meshkit::Point2::dotProduct |
( |
Point2 | a, |
|
|
Point2 | b ) |
|
inlinestaticconstexpr |
Dot product a.x * b.x + a.y * b.y.
- Parameters
-
| [in] | a | First vector. |
| [in] | b | Second vector. |
- Returns
- Dot product, in squared XY plane units for two displacement vectors.
◆ isNull()
| bool meshkit::Point2::isNull |
( |
| ) |
const |
|
inlineconstexpr |
True when both coordinates compare equal to 0 (-0.0 counts, NaN does not).
◆ operator*=()
| Point2 & meshkit::Point2::operator*= |
( |
double | s | ) |
|
|
inline |
Multiply both coordinates by s in place.
- Parameters
-
- Returns
- Reference to this point.
◆ operator+=()
Add p component-wise in place.
- Parameters
-
| [in] | p | Displacement to add. |
- Returns
- Reference to this point.
◆ operator-=()
Subtract p component-wise in place.
- Parameters
-
| [in] | p | Displacement to subtract. |
- Returns
- Reference to this point.
◆ operator/=()
| Point2 & meshkit::Point2::operator/= |
( |
double | s | ) |
|
|
inline |
Divide both coordinates by s in place.
- Parameters
-
| [in] | s | Divisor; 0 gives IEEE infinities or NaN, not an error. |
- Returns
- Reference to this point.
◆ x()
| double meshkit::Point2::x |
( |
| ) |
const |
|
inlineconstexprnoexcept |
X coordinate in XY plane units.
◆ y()
| double meshkit::Point2::y |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Y coordinate in XY plane units.
◆ operator!=
Negation of operator==.
- Parameters
-
| [in] | a | First point. |
| [in] | b | Second point. |
- Returns
- True when either coordinate differs or is NaN.
◆ operator* [1/2]
Scale a point by a factor, factor first; same result as a * s.
- Parameters
-
| [in] | s | Scale factor. |
| [in] | a | Point or vector to scale. |
- Returns
(a.x * s, a.y * s).
◆ operator* [2/2]
Scale a point by a factor.
- Parameters
-
| [in] | a | Point or vector to scale. |
| [in] | s | Scale factor. |
- Returns
(a.x * s, a.y * s).
◆ operator+
Component-wise sum.
- Parameters
-
| [in] | a | First operand. |
| [in] | b | Second operand. |
- Returns
(a.x + b.x, a.y + b.y).
◆ operator-
Component-wise difference, the displacement from b to a.
- Parameters
-
| [in] | a | Minuend. |
| [in] | b | Subtrahend. |
- Returns
(a.x - b.x, a.y - b.y).
◆ operator/
Divide a point by a divisor.
- Parameters
-
| [in] | a | Point or vector to divide. |
| [in] | s | Divisor; 0 gives IEEE infinities or NaN, not an error. |
- Returns
(a.x / s, a.y / s).
◆ operator==
Exact component-wise equality, with no tolerance.
- Parameters
-
| [in] | a | First point. |
| [in] | b | Second point. |
- Returns
- True when both coordinates compare equal; +0.0 equals -0.0 and a NaN coordinate is never equal.
The documentation for this class was generated from the following file: