24#ifndef OCCTL_HPP_GEOM_HPP
25#define OCCTL_HPP_GEOM_HPP
46 Point2(
const double theX,
const double theY) noexcept
60 double x() const noexcept {
return myData.
x; }
62 double y() const noexcept {
return myData.
y; }
67 return ::occtl_point2_distance(myData, theOther.myData);
85 : myData{0.0, 0.0, 0.0}
90 Point3(
const double theX,
const double theY,
const double theZ) noexcept
91 : myData{theX, theY, theZ}
104 double x() const noexcept {
return myData.
x; }
106 double y() const noexcept {
return myData.
y; }
108 double z() const noexcept {
return myData.
z; }
113 return ::occtl_point3_distance(myData, theOther.myData);
136 Vector2(
const double theX,
const double theY) noexcept
150 double x() const noexcept {
return myData.
x; }
152 double y() const noexcept {
return myData.
y; }
157 return ::occtl_vector2_dot(myData, theOther.myData);
163 return ::occtl_vector2_cross(myData, theOther.myData);
167 double magnitude() const noexcept { return ::occtl_vector2_magnitude(myData); }
187 : myData{0.0, 0.0, 0.0}
192 Vector3(
const double theX,
const double theY,
const double theZ) noexcept
193 : myData{theX, theY, theZ}
206 double x() const noexcept {
return myData.
x; }
208 double y() const noexcept {
return myData.
y; }
210 double z() const noexcept {
return myData.
z; }
215 return ::occtl_vector3_dot(myData, theOther.myData);
225 double magnitude() const noexcept { return ::occtl_vector3_magnitude(myData); }
294 double x() const noexcept {
return myData.
x; }
296 double y() const noexcept {
return myData.
y; }
301 return ::occtl_direction2_angle(myData, theOther.myData);
332 double x() const noexcept {
return myData.
x; }
334 double y() const noexcept {
return myData.
y; }
336 double z() const noexcept {
return myData.
z; }
341 return ::occtl_direction3_dot(myData, theOther.myData);
353 return ::occtl_direction3_angle(myData, theOther.myData);
374 : myData{theLocation.c_type(), theDir.c_type()}
401 : myData{theLocation.c_type(), theXDir.c_type(), theXDirRef.c_type()}
427 : myData{theLocation.c_type(), theXDir.c_type(), theYDir.c_type(), theZDir.c_type()}
C++ veneer for the core module.
void check(const ::occtl_status_t theStatus)
Throw on non-OK; otherwise a no-op.
Definition core.hpp:85
OCCT-Light: geometry primitive types and math utilities.
occtl_transform_t occtl_transform_compose(occtl_transform_t first, occtl_transform_t second)
occtl_direction3_t occtl_direction3_reversed(occtl_direction3_t d)
occtl_status_t occtl_transform_from_axis2(occtl_axis2_placement_t frame, occtl_transform_t *out_transform)
occtl_status_t occtl_transform_inverted(occtl_transform_t t, occtl_transform_t *out_transform)
occtl_transform_t occtl_transform_identity(void)
occtl_vector3_t occtl_transform_apply_vector3(occtl_transform_t t, occtl_vector3_t v)
occtl_point3_t occtl_point3_midpoint(occtl_point3_t a, occtl_point3_t b)
occtl_status_t occtl_vector3_normalized(occtl_vector3_t v, occtl_vector3_t *out_result)
occtl_transform_t occtl_transform_translation(occtl_vector3_t v)
occtl_status_t occtl_transform_rotation(occtl_axis1_placement_t axis, double angle, occtl_transform_t *out_transform)
occtl_vector3_t occtl_vector3_add(occtl_vector3_t a, occtl_vector3_t b)
occtl_point3_t occtl_transform_apply_point3(occtl_transform_t t, occtl_point3_t p)
occtl_point2_t occtl_point2_midpoint(occtl_point2_t a, occtl_point2_t b)
occtl_vector3_t occtl_vector3_cross(occtl_vector3_t a, occtl_vector3_t b)
occtl_status_t occtl_vector3_angle(occtl_vector3_t a, occtl_vector3_t b, double *out_radians)
occtl_vector3_t occtl_vector3_scaled(occtl_vector3_t v, double s)
occtl_status_t occtl_direction2_from_vector(occtl_vector2_t v, occtl_direction2_t *out_direction)
occtl_status_t occtl_direction3_from_vector(occtl_vector3_t v, occtl_direction3_t *out_direction)
occtl_vector3_t occtl_vector3_sub(occtl_vector3_t a, occtl_vector3_t b)
occtl_vector3_t occtl_vector3_reversed(occtl_vector3_t v)
occtl_status_t occtl_direction3_transform(occtl_direction3_t d, occtl_transform_t t, occtl_direction3_t *out_direction)
occtl_status_t occtl_transform_from_axis3(occtl_axis3_placement_t frame, occtl_transform_t *out_transform)
occtl_status_t occtl_transform_scale(occtl_point3_t center, double s, occtl_transform_t *out_transform)
occtl_status_t occtl_vector2_normalized(occtl_vector2_t v, occtl_vector2_t *out_result)
occtl_vector3_t occtl_direction3_cross(occtl_direction3_t a, occtl_direction3_t b)
Directed line in 3D (origin + unit direction). Mirrors occtl_axis1_placement_t.
Definition geom.hpp:365
Axis1Placement(const Point3 &theLocation, const Direction3 &theDir) noexcept
Constructs from origin and direction.
Definition geom.hpp:373
Axis1Placement(const occtl_axis1_placement_t &theC) noexcept
Wraps an existing C value type (zero-cost).
Definition geom.hpp:367
const occtl_axis1_placement_t & c_type() const noexcept
Borrows-it view of the underlying C value type.
Definition geom.hpp:379
Right-handed coordinate frame (origin + main direction + reference direction). Mirrors occtl_axis2_pl...
Definition geom.hpp:388
const occtl_axis2_placement_t & c_type() const noexcept
Borrows-it view of the underlying C value type.
Definition geom.hpp:406
Axis2Placement(const occtl_axis2_placement_t &theC) noexcept
Wraps an existing C value type (zero-cost).
Definition geom.hpp:390
Axis2Placement(const Point3 &theLocation, const Direction3 &theXDir, const Direction3 &theXDirRef) noexcept
Constructs from origin, X direction, and an in-plane reference direction. theXDirRef must not be para...
Definition geom.hpp:398
Explicit 3-axis coordinate frame. Mirrors occtl_axis3_placement_t. No orthonormality or right-handedn...
Definition geom.hpp:415
Axis3Placement(const occtl_axis3_placement_t &theC) noexcept
Wraps an existing C value type (zero-cost).
Definition geom.hpp:417
const occtl_axis3_placement_t & c_type() const noexcept
Borrows-it view of the underlying C value type.
Definition geom.hpp:432
Axis3Placement(const Point3 &theLocation, const Direction3 &theXDir, const Direction3 &theYDir, const Direction3 &theZDir) noexcept
Constructs from origin and three explicit axis directions.
Definition geom.hpp:423
2D unit-direction value type. Mirrors occtl_direction2_t.
Definition geom.hpp:275
double angle(const Direction2 &theOther) const noexcept
Angle in radians between this and theOther, in [0, π]. Never throws.
Definition geom.hpp:299
double y() const noexcept
Y component (unit-normalised).
Definition geom.hpp:296
double x() const noexcept
X component (unit-normalised).
Definition geom.hpp:294
Direction2(const occtl_direction2_t &theC) noexcept
Wraps an existing C value type (zero-cost). Caller guarantees unit norm.
Definition geom.hpp:277
const occtl_direction2_t & c_type() const noexcept
Borrows-it view of the underlying C value type.
Definition geom.hpp:292
static Direction2 from_vector(const Vector2 &theV)
Builds a normalised direction from a vector.
Definition geom.hpp:284
3D unit-direction value type. Mirrors occtl_direction3_t.
Definition geom.hpp:313
Direction3 reversed() const noexcept
Returns this direction negated. Never throws.
Definition geom.hpp:357
Direction3(const occtl_direction3_t &theC) noexcept
Wraps an existing C value type (zero-cost). Caller guarantees unit norm.
Definition geom.hpp:315
double dot(const Direction3 &theOther) const noexcept
Dot product. Returns a value in [-1, 1]. Never throws.
Definition geom.hpp:339
double angle(const Direction3 &theOther) const noexcept
Angle in radians, in [0, π]. Never throws.
Definition geom.hpp:351
double z() const noexcept
Z component (unit-normalised).
Definition geom.hpp:336
const occtl_direction3_t & c_type() const noexcept
Borrows-it view of the underlying C value type.
Definition geom.hpp:330
Vector3 cross(const Direction3 &theOther) const noexcept
Cross product as a free vector. Zero for parallel/anti-parallel inputs.
Definition geom.hpp:345
static Direction3 from_vector(const Vector3 &theV)
Builds a normalised direction from a vector.
Definition geom.hpp:322
double x() const noexcept
X component (unit-normalised).
Definition geom.hpp:332
double y() const noexcept
Y component (unit-normalised).
Definition geom.hpp:334
2D point value type. Mirrors occtl_point2_t with STL-flavoured access.
Definition geom.hpp:38
Point2 midpoint(const Point2 &theOther) const noexcept
Midpoint between this and another point. Never throws.
Definition geom.hpp:71
Point2() noexcept
Default-constructs the origin (0, 0).
Definition geom.hpp:40
double x() const noexcept
X coordinate.
Definition geom.hpp:60
Point2(const occtl_point2_t &theC) noexcept
Wraps an existing C value type (zero-cost).
Definition geom.hpp:52
double distance_to(const Point2 &theOther) const noexcept
Euclidean distance to another point. Never throws.
Definition geom.hpp:65
double y() const noexcept
Y coordinate.
Definition geom.hpp:62
const occtl_point2_t & c_type() const noexcept
Borrows-it view of the underlying C value type, for direct ABI calls.
Definition geom.hpp:58
Point2(const double theX, const double theY) noexcept
Constructs from explicit coordinates.
Definition geom.hpp:46
3D point value type. Mirrors occtl_point3_t with STL-flavoured access.
Definition geom.hpp:82
Point3() noexcept
Default-constructs the origin (0, 0, 0).
Definition geom.hpp:84
Point3(const double theX, const double theY, const double theZ) noexcept
Constructs from explicit coordinates.
Definition geom.hpp:90
const occtl_point3_t & c_type() const noexcept
Borrows-it view of the underlying C value type, for direct ABI calls.
Definition geom.hpp:102
double x() const noexcept
X coordinate.
Definition geom.hpp:104
double z() const noexcept
Z coordinate.
Definition geom.hpp:108
Point3(const occtl_point3_t &theC) noexcept
Wraps an existing C value type (zero-cost).
Definition geom.hpp:96
Point3 midpoint(const Point3 &theOther) const noexcept
Midpoint between this and another point. Never throws.
Definition geom.hpp:117
double distance_to(const Point3 &theOther) const noexcept
Euclidean distance to another point. Never throws.
Definition geom.hpp:111
double y() const noexcept
Y coordinate.
Definition geom.hpp:106
2D free-vector value type. Mirrors occtl_vector2_t.
Definition geom.hpp:128
double dot(const Vector2 &theOther) const noexcept
Dot product with another vector. Never throws.
Definition geom.hpp:155
double x() const noexcept
X component.
Definition geom.hpp:150
const occtl_vector2_t & c_type() const noexcept
Borrows-it view of the underlying C value type.
Definition geom.hpp:148
Vector2(const double theX, const double theY) noexcept
Constructs from explicit components.
Definition geom.hpp:136
Vector2 normalized() const
Returns this vector normalised to unit length.
Definition geom.hpp:171
Vector2() noexcept
Default-constructs the zero vector.
Definition geom.hpp:130
double y() const noexcept
Y component.
Definition geom.hpp:152
double magnitude() const noexcept
Euclidean length. Never throws.
Definition geom.hpp:167
Vector2(const occtl_vector2_t &theC) noexcept
Wraps an existing C value type (zero-cost).
Definition geom.hpp:142
double cross(const Vector2 &theOther) const noexcept
Signed scalar cross product (Z-component). Never throws.
Definition geom.hpp:161
3D free-vector value type. Mirrors occtl_vector3_t.
Definition geom.hpp:184
Vector3 cross(const Vector3 &theOther) const noexcept
Cross product with another vector. Never throws.
Definition geom.hpp:219
Vector3 operator+(const Vector3 &theOther) const noexcept
Component-wise sum.
Definition geom.hpp:237
Vector3 operator-(const Vector3 &theOther) const noexcept
Component-wise difference.
Definition geom.hpp:243
Vector3(const double theX, const double theY, const double theZ) noexcept
Constructs from explicit components.
Definition geom.hpp:192
double angle(const Vector3 &theOther) const
Angle in radians between this and theOther, in [0, π].
Definition geom.hpp:259
Vector3(const occtl_vector3_t &theC) noexcept
Wraps an existing C value type (zero-cost).
Definition geom.hpp:198
Vector3() noexcept
Default-constructs the zero vector.
Definition geom.hpp:186
const occtl_vector3_t & c_type() const noexcept
Borrows-it view of the underlying C value type.
Definition geom.hpp:204
double magnitude() const noexcept
Euclidean length. Never throws.
Definition geom.hpp:225
Vector3 reversed() const noexcept
Returns this vector negated.
Definition geom.hpp:255
double dot(const Vector3 &theOther) const noexcept
Dot product with another vector. Never throws.
Definition geom.hpp:213
double x() const noexcept
X component.
Definition geom.hpp:206
double y() const noexcept
Y component.
Definition geom.hpp:208
Vector3 normalized() const
Returns this vector normalised to unit length.
Definition geom.hpp:229
double z() const noexcept
Z component.
Definition geom.hpp:210
Vector3 operator*(const double theS) const noexcept
Scalar multiplication.
Definition geom.hpp:249
Definition occtl_geom.h:111
Definition occtl_geom.h:128
Definition occtl_geom.h:146
Definition occtl_geom.h:69
double y
Definition occtl_geom.h:71
double x
Definition occtl_geom.h:70
Definition occtl_geom.h:98
double z
Definition occtl_geom.h:101
double x
Definition occtl_geom.h:99
double y
Definition occtl_geom.h:100
Definition occtl_geom.h:49
double y
Definition occtl_geom.h:51
double x
Definition occtl_geom.h:50
Definition occtl_geom.h:76
double z
Definition occtl_geom.h:79
double y
Definition occtl_geom.h:78
double x
Definition occtl_geom.h:77
Definition occtl_geom.h:56
double x
Definition occtl_geom.h:57
double y
Definition occtl_geom.h:58
Definition occtl_geom.h:84
double y
Definition occtl_geom.h:86
double z
Definition occtl_geom.h:87
double x
Definition occtl_geom.h:85