OCCT-Light 0.1
C ABI and C++ veneer for multi-language CAD workflows
Loading...
Searching...
No Matches
occtl::Curve Class Reference

Non-owning reference to a 3D geometric curve stored in a graph. More...

#include <curves.hpp>

Classes

struct  BSplineView
 Aggregate inspection view of a B-spline curve (§10.5). More...
 
struct  IntersectionPoint
 A single intersection point between two curves. More...
 
struct  OffsetView
 
struct  TrimmedView
 

Public Member Functions

 Curve (occtl_graph_t *theGraph=nullptr, occtl_rep_id_t theId=occtl_rep_id_t{0}) noexcept
 Constructs a null reference (no graph, invalid id).
 
 operator bool () const noexcept
 Returns true when the reference points into a valid graph.
 
occtl_graph_tgraph () const noexcept
 Borrows it — returns the graph pointer.
 
occtl_rep_id_t id () const noexcept
 Returns the representation id.
 
Curve reversed () const
 Returns a reversed copy of this curve stored in the same graph.
 
Curve transformed (const Transform &theTrsf) const
 Returns a transformed copy of this curve stored in the same graph.
 
Curve translated (const Vector3 &theDelta) const
 Returns a translated copy of this curve stored in the same graph.
 
Curve rotated (const Axis1Placement &theAxis, double theAngle) const
 Returns a rotated copy of this curve stored in the same graph.
 
Curve scaled (const Point3 &theOrigin, double theFactor) const
 Returns a scaled copy of this curve stored in the same graph.
 
double length () const
 Returns the curve length over its full parameter range.
 
std::pair< double, double > project_point (const Point3 &thePoint) const
 Projects a point onto the curve.
 
double parameter_of_point (const Point3 &thePoint) const
 Returns the parameter on the curve nearest to a given point.
 
occtl_curve_kind_t kind () const
 Returns the kind of geometry.
 
int32_t is_periodic () const
 Returns 1 when the curve is periodic, 0 otherwise.
 
int32_t is_closed () const
 Returns 1 when the curve is closed, 0 otherwise.
 
occtl_geom_continuity_t continuity () const
 Returns the geometric continuity class.
 
void parameter_range (double &theUMin, double &theUMax) const
 Returns the parameter range [u_min, u_max] via out-parameters.
 
occtl_geom_line_t as_line () const
 Extracts the underlying line.
 
occtl_geom_circle_t as_circle () const
 Extracts the underlying circle.
 
occtl_geom_ellipse_t as_ellipse () const
 Extracts the underlying ellipse.
 
occtl_geom_hyperbola_t as_hyperbola () const
 Extracts the underlying hyperbola.
 
occtl_geom_parabola_t as_parabola () const
 Extracts the underlying parabola.
 
TrimmedView as_trimmed () const
 Extracts the parameter bounds from a trimmed curve.
 
OffsetView as_offset () const
 Extracts the scalar offset and reference direction of an offset curve.
 
BSplineView as_bspline () const
 Returns a §10.5 aggregate inspection view of a B-spline curve.
 
int32_t bspline_degree () const
 Returns the polynomial degree.
 
size_t bspline_pole_count () const
 Returns the number of poles.
 
size_t bspline_knot_count () const
 Returns the number of distinct knot values.
 
int32_t bspline_is_rational () const
 Returns 1 when the B-spline is rational (NURBS), 0 otherwise.
 
int32_t bezier_degree () const
 Returns the Bezier polynomial degree.
 
size_t bezier_pole_count () const
 Returns the number of Bezier poles.
 
int32_t bezier_is_rational () const
 Returns 1 when the Bezier curve is rational, 0 otherwise.
 
std::vector< occtl_point3_tbspline_poles () const
 Copies all poles into a std::vector<occtl_point3_t>.
 
std::vector< double > bspline_knots () const
 Copies all distinct knot values into a std::vector<double>.
 
std::vector< int32_t > bspline_multiplicities () const
 Copies all knot multiplicities into a std::vector<int32_t>.
 
std::vector< double > bspline_weights () const
 Copies all weights into a std::vector<double>.
 
std::vector< double > bspline_flat_knots () const
 Copies the expanded (flat) knot sequence into a vector.
 
const occtl_point3_tbspline_poles_view (size_t &theCount) const
 Returns a zero-copy view of the poles array.
 
std::vector< IntersectionPointintersect_with (const Curve &theOther) const
 
occtl_point3_t eval_d0 (const double theU) const
 Evaluates the curve point at parameter theU.
 
std::pair< occtl_point3_t, occtl_vector3_teval_d1 (const double theU) const
 Evaluates point and first derivative at theU.
 
std::tuple< occtl_point3_t, occtl_vector3_t, occtl_vector3_teval_d2 (const double theU) const
 Evaluates point, first, and second derivatives at theU.
 
std::tuple< occtl_point3_t, occtl_vector3_t, occtl_vector3_t, occtl_vector3_teval_d3 (const double theU) const
 Evaluates point, first, second, and third derivatives at theU.
 
occtl_vector3_t eval_dn (const double theU, const int32_t theN) const
 Returns the N-th derivative vector at theU.
 

Static Public Member Functions

static Curve from_line (occtl_graph_t *graph, const occtl_geom_line_t &theLine)
 Constructs a curve from a line.
 
static Curve from_circle (occtl_graph_t *graph, const occtl_geom_circle_t &theCircle)
 Constructs a curve from a circle.
 
static Curve from_ellipse (occtl_graph_t *graph, const occtl_geom_ellipse_t &theEllipse)
 Constructs a curve from an ellipse.
 
static Curve from_hyperbola (occtl_graph_t *graph, const occtl_geom_hyperbola_t &theHyperbola)
 Constructs a curve from a hyperbola.
 
static Curve from_parabola (occtl_graph_t *graph, const occtl_geom_parabola_t &theParabola)
 Constructs a curve from a parabola.
 
static Curve from_bspline (occtl_graph_t *graph, const occtl_curve_bspline_create_info_t &theInfo)
 Constructs a B-spline curve from the given create info.
 
static Curve from_bezier (occtl_graph_t *graph, const occtl_curve_bezier_create_info_t &theInfo)
 Constructs a Bezier curve from the given create info.
 
static Curve from_trimmed (occtl_graph_t *graph, const occtl_curve_trimmed_create_info_t &theInfo)
 Constructs a trimmed curve.
 
static Curve from_offset (occtl_graph_t *graph, const occtl_curve_offset_create_info_t &theInfo)
 Constructs an offset curve.
 
static Curve from_interpolation (occtl_graph_t *graph, const occtl_curve_interpolated_info_t &theInfo)
 Constructs a curve by interpolating through the given points.
 
static Curve from_approximation (occtl_graph_t *graph, const occtl_curve_approximated_info_t &theInfo)
 Constructs a curve by approximating the given points.
 
static Curve from_airfoil_naca4 (occtl_graph_t *graph, const occtl_curve_airfoil_naca4_info_t &theInfo)
 Constructs a NACA 4-digit airfoil profile as a B-spline curve.
 

Detailed Description

Non-owning reference to a 3D geometric curve stored in a graph.

Wraps one occtl_rep_id_t inside an occtl_graph_t*. Copying is shallow — both copies refer to the same graph representation.

Member Function Documentation

◆ as_bspline()

Curve::BSplineView occtl::Curve::as_bspline ( ) const
inline

Returns a §10.5 aggregate inspection view of a B-spline curve.

The returned view's pointer fields borrow from this curve's graph rep and remain valid until the rep is removed from the graph.

Exceptions
Errorwith OCCTL_WRONG_KIND when kind() != BSPLINE, or OCCTL_VERSION_MISMATCH on unsupported layout version.

◆ as_circle()

occtl_geom_circle_t occtl::Curve::as_circle ( ) const
inline

Extracts the underlying circle.

Exceptions
Errorwith OCCTL_WRONG_KIND when kind() != OCCTL_CURVE_KIND_CIRCLE.

◆ as_ellipse()

occtl_geom_ellipse_t occtl::Curve::as_ellipse ( ) const
inline

Extracts the underlying ellipse.

Exceptions
Errorwith OCCTL_WRONG_KIND when kind() != OCCTL_CURVE_KIND_ELLIPSE.

◆ as_hyperbola()

occtl_geom_hyperbola_t occtl::Curve::as_hyperbola ( ) const
inline

Extracts the underlying hyperbola.

Exceptions
Errorwith OCCTL_WRONG_KIND when kind() != OCCTL_CURVE_KIND_HYPERBOLA.

◆ as_line()

occtl_geom_line_t occtl::Curve::as_line ( ) const
inline

Extracts the underlying line.

Exceptions
Errorwith OCCTL_WRONG_KIND when kind() != OCCTL_CURVE_KIND_LINE.

◆ as_offset()

Curve::OffsetView occtl::Curve::as_offset ( ) const
inline

Extracts the scalar offset and reference direction of an offset curve.

Exceptions
Errorwith OCCTL_WRONG_KIND when kind() != OFFSET.

◆ as_parabola()

occtl_geom_parabola_t occtl::Curve::as_parabola ( ) const
inline

Extracts the underlying parabola.

Exceptions
Errorwith OCCTL_WRONG_KIND when kind() != OCCTL_CURVE_KIND_PARABOLA.

◆ as_trimmed()

Curve::TrimmedView occtl::Curve::as_trimmed ( ) const
inline

Extracts the parameter bounds from a trimmed curve.

Exceptions
Errorwith OCCTL_WRONG_KIND when kind() != TRIMMED.

◆ bezier_degree()

int32_t occtl::Curve::bezier_degree ( ) const
inline

Returns the Bezier polynomial degree.

Exceptions
Errorwhen kind != BEZIER.

◆ bezier_is_rational()

int32_t occtl::Curve::bezier_is_rational ( ) const
inline

Returns 1 when the Bezier curve is rational, 0 otherwise.

Exceptions
Errorwhen kind != BEZIER.

◆ bezier_pole_count()

size_t occtl::Curve::bezier_pole_count ( ) const
inline

Returns the number of Bezier poles.

Exceptions
Errorwhen kind != BEZIER.

◆ bspline_degree()

int32_t occtl::Curve::bspline_degree ( ) const
inline

Returns the polynomial degree.

Exceptions
Errorwhen kind != BSPLINE.

◆ bspline_flat_knots()

std::vector< double > occtl::Curve::bspline_flat_knots ( ) const
inline

Copies the expanded (flat) knot sequence into a vector.

Exceptions
Errorwhen kind != BSPLINE or extraction fails.

◆ bspline_is_rational()

int32_t occtl::Curve::bspline_is_rational ( ) const
inline

Returns 1 when the B-spline is rational (NURBS), 0 otherwise.

Exceptions
Errorwhen kind != BSPLINE.

◆ bspline_knot_count()

size_t occtl::Curve::bspline_knot_count ( ) const
inline

Returns the number of distinct knot values.

Exceptions
Errorwhen kind != BSPLINE.

◆ bspline_knots()

std::vector< double > occtl::Curve::bspline_knots ( ) const
inline

Copies all distinct knot values into a std::vector<double>.

Exceptions
Errorwhen kind != BSPLINE or extraction fails.

◆ bspline_multiplicities()

std::vector< int32_t > occtl::Curve::bspline_multiplicities ( ) const
inline

Copies all knot multiplicities into a std::vector<int32_t>.

Exceptions
Errorwhen kind != BSPLINE or extraction fails.

◆ bspline_pole_count()

size_t occtl::Curve::bspline_pole_count ( ) const
inline

Returns the number of poles.

Exceptions
Errorwhen kind != BSPLINE.

◆ bspline_poles()

std::vector< occtl_point3_t > occtl::Curve::bspline_poles ( ) const
inline

Copies all poles into a std::vector<occtl_point3_t>.

Exceptions
Errorwhen kind != BSPLINE or extraction fails.

◆ bspline_poles_view()

const occtl_point3_t * occtl::Curve::bspline_poles_view ( size_t &  theCount) const
inline

Returns a zero-copy view of the poles array.

Valid until the graph rep is removed or a mutating call is made on it.

Exceptions
Errorwhen kind != BSPLINE or view is unavailable.

◆ bspline_weights()

std::vector< double > occtl::Curve::bspline_weights ( ) const
inline

Copies all weights into a std::vector<double>.

Exceptions
Errorwith OCCTL_WRONG_KIND when the curve is non-rational.

◆ continuity()

occtl_geom_continuity_t occtl::Curve::continuity ( ) const
inline

Returns the geometric continuity class.

Exceptions
Errorwhen the underlying call fails.

◆ eval_d0()

occtl_point3_t occtl::Curve::eval_d0 ( const double  theU) const
inline

Evaluates the curve point at parameter theU.

Exceptions
Erroron NULL graph or out-of-range.

◆ eval_d1()

std::pair< occtl_point3_t, occtl_vector3_t > occtl::Curve::eval_d1 ( const double  theU) const
inline

Evaluates point and first derivative at theU.

Exceptions
Erroron NULL graph or out-of-range.

◆ eval_d2()

std::tuple< occtl_point3_t, occtl_vector3_t, occtl_vector3_t > occtl::Curve::eval_d2 ( const double  theU) const
inline

Evaluates point, first, and second derivatives at theU.

Exceptions
Erroron NULL graph or out-of-range.

◆ eval_d3()

std::tuple< occtl_point3_t, occtl_vector3_t, occtl_vector3_t, occtl_vector3_t > occtl::Curve::eval_d3 ( const double  theU) const
inline

Evaluates point, first, second, and third derivatives at theU.

Exceptions
Erroron NULL graph or out-of-range.

◆ eval_dn()

occtl_vector3_t occtl::Curve::eval_dn ( const double  theU,
const int32_t  theN 
) const
inline

Returns the N-th derivative vector at theU.

Exceptions
Erroron NULL graph or out-of-range.

◆ from_airfoil_naca4()

static Curve occtl::Curve::from_airfoil_naca4 ( occtl_graph_t graph,
const occtl_curve_airfoil_naca4_info_t theInfo 
)
inlinestatic

Constructs a NACA 4-digit airfoil profile as a B-spline curve.

Exceptions
Erroron invalid parameters or fitting failure.

◆ from_approximation()

static Curve occtl::Curve::from_approximation ( occtl_graph_t graph,
const occtl_curve_approximated_info_t theInfo 
)
inlinestatic

Constructs a curve by approximating the given points.

Exceptions
Erroron invalid geometry or version mismatch.

◆ from_bezier()

static Curve occtl::Curve::from_bezier ( occtl_graph_t graph,
const occtl_curve_bezier_create_info_t theInfo 
)
inlinestatic

Constructs a Bezier curve from the given create info.

Exceptions
Erroron invalid geometry or version mismatch.

◆ from_bspline()

static Curve occtl::Curve::from_bspline ( occtl_graph_t graph,
const occtl_curve_bspline_create_info_t theInfo 
)
inlinestatic

Constructs a B-spline curve from the given create info.

Exceptions
Erroron invalid geometry or version mismatch.

◆ from_circle()

static Curve occtl::Curve::from_circle ( occtl_graph_t graph,
const occtl_geom_circle_t theCircle 
)
inlinestatic

Constructs a curve from a circle.

Exceptions
Erroron invalid geometry.

◆ from_ellipse()

static Curve occtl::Curve::from_ellipse ( occtl_graph_t graph,
const occtl_geom_ellipse_t theEllipse 
)
inlinestatic

Constructs a curve from an ellipse.

Exceptions
Erroron invalid geometry.

◆ from_hyperbola()

static Curve occtl::Curve::from_hyperbola ( occtl_graph_t graph,
const occtl_geom_hyperbola_t theHyperbola 
)
inlinestatic

Constructs a curve from a hyperbola.

Exceptions
Erroron invalid geometry.

◆ from_interpolation()

static Curve occtl::Curve::from_interpolation ( occtl_graph_t graph,
const occtl_curve_interpolated_info_t theInfo 
)
inlinestatic

Constructs a curve by interpolating through the given points.

Exceptions
Erroron invalid geometry or version mismatch.

◆ from_line()

static Curve occtl::Curve::from_line ( occtl_graph_t graph,
const occtl_geom_line_t theLine 
)
inlinestatic

Constructs a curve from a line.

Exceptions
Erroron invalid geometry.

◆ from_offset()

static Curve occtl::Curve::from_offset ( occtl_graph_t graph,
const occtl_curve_offset_create_info_t theInfo 
)
inlinestatic

Constructs an offset curve.

Exceptions
Erroron invalid geometry or version mismatch.

◆ from_parabola()

static Curve occtl::Curve::from_parabola ( occtl_graph_t graph,
const occtl_geom_parabola_t theParabola 
)
inlinestatic

Constructs a curve from a parabola.

Exceptions
Erroron invalid geometry.

◆ from_trimmed()

static Curve occtl::Curve::from_trimmed ( occtl_graph_t graph,
const occtl_curve_trimmed_create_info_t theInfo 
)
inlinestatic

Constructs a trimmed curve.

Exceptions
Erroron invalid geometry or version mismatch.

◆ is_closed()

int32_t occtl::Curve::is_closed ( ) const
inline

Returns 1 when the curve is closed, 0 otherwise.

Exceptions
Errorwhen the underlying call fails.

◆ is_periodic()

int32_t occtl::Curve::is_periodic ( ) const
inline

Returns 1 when the curve is periodic, 0 otherwise.

Exceptions
Errorwhen the underlying call fails.

◆ kind()

occtl_curve_kind_t occtl::Curve::kind ( ) const
inline

Returns the kind of geometry.

Exceptions
Errorwhen the underlying call fails.

◆ length()

double occtl::Curve::length ( ) const
inline

Returns the curve length over its full parameter range.

Exceptions
Errorwhen the underlying call fails.

◆ parameter_of_point()

double occtl::Curve::parameter_of_point ( const Point3 thePoint) const
inline

Returns the parameter on the curve nearest to a given point.

Exceptions
Errorwhen the underlying call fails.

◆ parameter_range()

void occtl::Curve::parameter_range ( double &  theUMin,
double &  theUMax 
) const
inline

Returns the parameter range [u_min, u_max] via out-parameters.

Exceptions
Errorwhen the underlying call fails.

◆ project_point()

std::pair< double, double > occtl::Curve::project_point ( const Point3 thePoint) const
inline

Projects a point onto the curve.

Returns
A pair of (parameter, distance).
Exceptions
Errorwhen the underlying call fails.

◆ reversed()

Curve occtl::Curve::reversed ( ) const
inline

Returns a reversed copy of this curve stored in the same graph.

Exceptions
Errorwhen the underlying call fails.

◆ rotated()

Curve occtl::Curve::rotated ( const Axis1Placement theAxis,
double  theAngle 
) const
inline

Returns a rotated copy of this curve stored in the same graph.

Exceptions
Errorwhen the underlying call fails.

◆ scaled()

Curve occtl::Curve::scaled ( const Point3 theOrigin,
double  theFactor 
) const
inline

Returns a scaled copy of this curve stored in the same graph.

Exceptions
Errorwhen the underlying call fails.

◆ transformed()

Curve occtl::Curve::transformed ( const Transform theTrsf) const
inline

Returns a transformed copy of this curve stored in the same graph.

Exceptions
Errorwhen the underlying call fails.

◆ translated()

Curve occtl::Curve::translated ( const Vector3 theDelta) const
inline

Returns a translated copy of this curve stored in the same graph.

Exceptions
Errorwhen the underlying call fails.

The documentation for this class was generated from the following file: