OCCT-Light 0.1
C ABI and C++ veneer for multi-language CAD workflows
Loading...
Searching...
No Matches
occtl_curves.h File Reference

OCCT-Light: 3D curve representation in the topology graph. More...

#include <stddef.h>
#include <stdint.h>
#include "occtl_core.h"
#include "occtl_curves_common.h"
#include "occtl_geom.h"
Include dependency graph for occtl_curves.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  occtl_curve_bspline_create_info
 
struct  occtl_curve_bezier_create_info
 
struct  occtl_curve_offset_create_info
 
struct  occtl_curve_bspline
 
struct  occtl_curve_airfoil_naca4_info
 
struct  occtl_curve_interpolated_info
 
struct  occtl_curve_approximated_info
 
struct  occtl_curve_intersection_point
 

Macros

#define OCCTL_CURVE_BSPLINE_CREATE_INFO_VERSION_1   1u
 
#define OCCTL_CURVE_BSPLINE_CREATE_INFO_INIT    {OCCTL_CURVE_BSPLINE_CREATE_INFO_VERSION_1, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, 0}
 
#define OCCTL_CURVE_BEZIER_CREATE_INFO_VERSION_1   1u
 
#define OCCTL_CURVE_BEZIER_CREATE_INFO_INIT    {OCCTL_CURVE_BEZIER_CREATE_INFO_VERSION_1, NULL, NULL, 0, NULL}
 
#define OCCTL_CURVE_OFFSET_CREATE_INFO_VERSION_1   1u
 
#define OCCTL_CURVE_OFFSET_CREATE_INFO_INIT    {OCCTL_CURVE_OFFSET_CREATE_INFO_VERSION_1, NULL, {0}, {0.0, 0.0, 1.0}, 0.0}
 
#define OCCTL_CURVE_BSPLINE_VERSION_1   1u
 
#define OCCTL_CURVE_BSPLINE_INIT    {OCCTL_CURVE_BSPLINE_VERSION_1, NULL, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL}
 
#define OCCTL_CURVE_AIRFOIL_NACA4_INFO_VERSION_1   1u
 
#define OCCTL_CURVE_AIRFOIL_NACA4_INFO_INIT    {OCCTL_CURVE_AIRFOIL_NACA4_INFO_VERSION_1, NULL, 0.0, 0.0, 0.12, 1.0, 50, 0, 3, 8, 1.0e-5}
 
#define OCCTL_CURVE_INTERPOLATED_INFO_VERSION_1   1u
 
#define OCCTL_CURVE_INTERPOLATED_INFO_INIT    {OCCTL_CURVE_INTERPOLATED_INFO_VERSION_1, NULL, NULL, 0, 0, 0.0}
 
#define OCCTL_CURVE_APPROXIMATED_INFO_VERSION_1   1u
 
#define OCCTL_CURVE_APPROXIMATED_INFO_INIT    {OCCTL_CURVE_APPROXIMATED_INFO_VERSION_1, NULL, NULL, 0, 1, 3, 1e-3, 0}
 

Typedefs

typedef struct occtl_curve_bspline_create_info occtl_curve_bspline_create_info_t
 
typedef struct occtl_curve_bezier_create_info occtl_curve_bezier_create_info_t
 
typedef struct occtl_curve_offset_create_info occtl_curve_offset_create_info_t
 
typedef struct occtl_curve_bspline occtl_curve_bspline_t
 
typedef struct occtl_curve_airfoil_naca4_info occtl_curve_airfoil_naca4_info_t
 
typedef struct occtl_curve_interpolated_info occtl_curve_interpolated_info_t
 
typedef struct occtl_curve_approximated_info occtl_curve_approximated_info_t
 
typedef struct occtl_curve_intersection_point occtl_curve_intersection_point_t
 

Functions

occtl_status_t occtl_curve_create_line (occtl_graph_t *graph, occtl_geom_line_t line, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_create_circle (occtl_graph_t *graph, occtl_geom_circle_t circle, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_create_ellipse (occtl_graph_t *graph, occtl_geom_ellipse_t ellipse, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_create_hyperbola (occtl_graph_t *graph, occtl_geom_hyperbola_t hyperbola, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_create_parabola (occtl_graph_t *graph, occtl_geom_parabola_t parabola, occtl_rep_id_t *out_id)
 
void occtl_curve_bspline_create_info_init (occtl_curve_bspline_create_info_t *info)
 
occtl_status_t occtl_curve_create_bspline (occtl_graph_t *graph, const occtl_curve_bspline_create_info_t *info, occtl_rep_id_t *out_id)
 
void occtl_curve_bezier_create_info_init (occtl_curve_bezier_create_info_t *info)
 
occtl_status_t occtl_curve_create_bezier (occtl_graph_t *graph, const occtl_curve_bezier_create_info_t *info, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_create_trimmed (occtl_graph_t *graph, const occtl_curve_trimmed_create_info_t *info, occtl_rep_id_t *out_id)
 
void occtl_curve_offset_create_info_init (occtl_curve_offset_create_info_t *info)
 
occtl_status_t occtl_curve_create_offset (occtl_graph_t *graph, const occtl_curve_offset_create_info_t *info, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_reverse (occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_transformed (occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_transform_t transform, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_translated (occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_vector3_t delta, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_rotated (occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_axis1_placement_t axis, double angle, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_scaled (occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_point3_t origin, double factor, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_length (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double *out_length)
 
occtl_status_t occtl_curve_project_point (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_point3_t point, double *out_param, double *out_distance)
 
occtl_status_t occtl_curve_parameter_of_point (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_point3_t point, double *out_param)
 
occtl_status_t occtl_curve_kind (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_curve_kind_t *out_kind)
 
occtl_status_t occtl_curve_is_periodic (const occtl_graph_t *graph, occtl_rep_id_t curve_id, int32_t *out_is_periodic)
 
occtl_status_t occtl_curve_is_closed (const occtl_graph_t *graph, occtl_rep_id_t curve_id, int32_t *out_is_closed)
 
occtl_status_t occtl_curve_continuity (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_geom_continuity_t *out_continuity)
 
occtl_status_t occtl_curve_parameter_range (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double *out_u_min, double *out_u_max)
 
occtl_status_t occtl_curve_as_line (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_geom_line_t *out_line)
 
occtl_status_t occtl_curve_as_circle (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_geom_circle_t *out_circle)
 
occtl_status_t occtl_curve_as_ellipse (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_geom_ellipse_t *out_ellipse)
 
occtl_status_t occtl_curve_as_hyperbola (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_geom_hyperbola_t *out_hyperbola)
 
occtl_status_t occtl_curve_as_parabola (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_geom_parabola_t *out_parabola)
 
occtl_status_t occtl_curve_as_trimmed (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double *out_u_first, double *out_u_last)
 
occtl_status_t occtl_curve_as_offset (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double *out_offset, occtl_vector3_t *out_offset_dir)
 
occtl_status_t occtl_curve_bspline_degree (const occtl_graph_t *graph, occtl_rep_id_t curve_id, int32_t *out_degree)
 
occtl_status_t occtl_curve_bspline_pole_count (const occtl_graph_t *graph, occtl_rep_id_t curve_id, size_t *out_count)
 
occtl_status_t occtl_curve_bspline_knot_count (const occtl_graph_t *graph, occtl_rep_id_t curve_id, size_t *out_count)
 
occtl_status_t occtl_curve_bspline_is_rational (const occtl_graph_t *graph, occtl_rep_id_t curve_id, int32_t *out_is_rational)
 
occtl_status_t occtl_curve_bezier_degree (const occtl_graph_t *graph, occtl_rep_id_t curve_id, int32_t *out_degree)
 
occtl_status_t occtl_curve_bezier_pole_count (const occtl_graph_t *graph, occtl_rep_id_t curve_id, size_t *out_count)
 
occtl_status_t occtl_curve_bezier_is_rational (const occtl_graph_t *graph, occtl_rep_id_t curve_id, int32_t *out_is_rational)
 
occtl_status_t occtl_curve_bspline_poles (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_point3_t *out_buf, size_t capacity, size_t *out_count)
 
occtl_status_t occtl_curve_bspline_knots (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double *out_buf, size_t capacity, size_t *out_count)
 
occtl_status_t occtl_curve_bspline_multiplicities (const occtl_graph_t *graph, occtl_rep_id_t curve_id, int32_t *out_buf, size_t capacity, size_t *out_count)
 
occtl_status_t occtl_curve_bspline_weights (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double *out_buf, size_t capacity, size_t *out_count)
 
occtl_status_t occtl_curve_bspline_poles_view (const occtl_graph_t *graph, occtl_rep_id_t curve_id, const occtl_point3_t **out_data, size_t *out_count)
 
occtl_status_t occtl_curve_bspline_flat_knots (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double *out_buf, size_t capacity, size_t *out_count)
 
void occtl_curve_bspline_init (occtl_curve_bspline_t *out)
 
occtl_status_t occtl_curve_as_bspline (const occtl_graph_t *graph, occtl_rep_id_t curve_id, occtl_curve_bspline_t *out)
 
occtl_status_t occtl_curve_eval_d0 (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double u, occtl_point3_t *out_point)
 
occtl_status_t occtl_curve_eval_d1 (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double u, occtl_point3_t *out_point, occtl_vector3_t *out_d1)
 
occtl_status_t occtl_curve_eval_d2 (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double u, occtl_point3_t *out_point, occtl_vector3_t *out_d1, occtl_vector3_t *out_d2)
 
occtl_status_t occtl_curve_eval_d3 (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double u, occtl_point3_t *out_point, occtl_vector3_t *out_d1, occtl_vector3_t *out_d2, occtl_vector3_t *out_d3)
 
occtl_status_t occtl_curve_eval_dn (const occtl_graph_t *graph, occtl_rep_id_t curve_id, double u, int32_t n, occtl_vector3_t *out_derivative)
 
void occtl_curve_airfoil_naca4_info_init (occtl_curve_airfoil_naca4_info_t *info)
 
occtl_status_t occtl_curve_create_airfoil_naca4 (occtl_graph_t *graph, const occtl_curve_airfoil_naca4_info_t *info, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_create_arc_of_circle_3pt (occtl_graph_t *graph, occtl_point3_t p1, occtl_point3_t p2, occtl_point3_t p3, occtl_rep_id_t *out_id)
 
void occtl_curve_interpolated_info_init (occtl_curve_interpolated_info_t *info)
 
occtl_status_t occtl_curve_create_interpolated (occtl_graph_t *graph, const occtl_curve_interpolated_info_t *info, occtl_rep_id_t *out_id)
 
void occtl_curve_approximated_info_init (occtl_curve_approximated_info_t *info)
 
occtl_status_t occtl_curve_create_approximated (occtl_graph_t *graph, const occtl_curve_approximated_info_t *info, occtl_rep_id_t *out_id)
 
occtl_status_t occtl_curve_to_bezier_segments (occtl_graph_t *graph, occtl_rep_id_t curve_id, const occtl_curve_bezier_segments_options_t *options, occtl_rep_id_t **out_ids, size_t *out_count)
 
void occtl_curve_free_bezier_segments (occtl_rep_id_t *ids)
 
occtl_status_t occtl_curve_intersect (occtl_graph_t *graph, occtl_rep_id_t curve_id_a, occtl_rep_id_t curve_id_b, const occtl_curve_intersection_point_t **out_results, size_t *out_count)
 
void occtl_curve_free_intersection_points (occtl_curve_intersection_point_t *results)
 

Detailed Description

OCCT-Light: 3D curve representation in the topology graph.

A curve is stored as an occtl_rep_id_t inside an occtl_graph_t. Every curve function takes a graph pointer and a rep id. The kind is available via occtl_curve_kind for O(1) introspection.

This file covers construction, introspection, data extraction, and parametric evaluation of 3D curve representations.

Typedef Documentation

◆ occtl_curve_airfoil_naca4_info_t

Versioned create-info for a NACA 4-digit airfoil profile curve.

The generated profile lies in the XY plane with the leading edge at (0,0,0) and the chord along +X. Use curve transforms to place or scale it after construction.

◆ occtl_curve_approximated_info_t

Versioned create-info struct for curve approximation (fitting).

Fits a B-spline curve to the given points within the specified tolerance using OCCT's GeomAPI_PointsToBSpline. The resulting curve does not necessarily pass through the points; it approximates them.

◆ occtl_curve_bezier_create_info_t

Versioned create-info struct for Bezier curve construction.

◆ occtl_curve_bspline_create_info_t

Versioned create-info struct for B-spline curve construction.

Knots are in compact form (distinct values + multiplicities), which is OCCT's canonical representation. Arrays are borrowed for the duration of the occtl_curve_create_bspline call; they are not retained afterwards.

For a non-rational B-spline set weights to NULL. For a rational B-spline (NURBS) provide weights with pole_count entries; all values must be > 0.

◆ occtl_curve_bspline_t

Aggregate inspection view of a B-spline curve.

Read-only snapshot of every field a caller typically needs in the same pass: scalars (degree, periodicity, continuity, counts) plus borrowed pointers into the underlying OCCT storage for poles, weights, distinct knots, multiplicities, and the expanded flat knot sequence. One call replaces ~10 atomized accessors; pair with occtl_curve_as_bspline.

Pointers in out borrow from the graph rep and are valid until the rep is removed from the graph.

The caller declares the layout version they understand in struct_version before the call; the library fills only fields up to that version. The weights pointer is set to NULL when is_rational is 0.

◆ occtl_curve_interpolated_info_t

Versioned create-info struct for curve interpolation.

Interpolates a B-spline curve passing through the given points. Uses OCCT's GeomAPI_Interpolate internally, which computes uniform parameters and creates a C2 continuous cubic B-spline.

◆ occtl_curve_intersection_point_t

Describes a single intersection point between two curves.

◆ occtl_curve_offset_create_info_t

Versioned create-info struct for an offset curve.

The constructor makes an internal deep copy of the basis curve.

Function Documentation

◆ occtl_curve_airfoil_naca4_info_init()

void occtl_curve_airfoil_naca4_info_init ( occtl_curve_airfoil_naca4_info_t info)

Runtime initialiser for occtl_curve_airfoil_naca4_info_t.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_curve_create_airfoil_naca4

◆ occtl_curve_approximated_info_init()

void occtl_curve_approximated_info_init ( occtl_curve_approximated_info_t info)

Runtime initialiser for occtl_curve_approximated_info_t.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_curve_create_approximated

◆ occtl_curve_as_bspline()

occtl_status_t occtl_curve_as_bspline ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_curve_bspline_t out 
)

Fills a caller-allocated occtl_curve_bspline_t with a complete read-only inspection view of the underlying B-spline curve.

Pointers in out borrow from the graph rep and are valid until the rep is removed from the graph.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to inspect; kind must be OCCTL_CURVE_KIND_BSPLINE.
[in,out]outBorrows it. Caller-allocated; must be non-NULL. The caller sets struct_version on entry; the library fills the remaining fields on success and leaves them unchanged on failure.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out is NULL.
OCCTL_VERSION_MISMATCHout->struct_version is not supported.
OCCTL_WRONG_KINDCurve is not a B-spline curve.

\par Thread Safety Yes (read-only).

See also
occtl_curve_bspline_init, occtl_curve_bspline_poles_view, occtl_curve_bspline_degree, occtl_curve_bspline_pole_count

◆ occtl_curve_as_circle()

occtl_status_t occtl_curve_as_circle ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_geom_circle_t out_circle 
)

Extracts circle data from a curve representation.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_CIRCLE.
[out]out_circleBorrows it (caller-allocated slot). Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_circle is NULL.
OCCTL_WRONG_KINDCurve is not a circle.

\par Thread Safety Yes.

See also
occtl_curve_kind

◆ occtl_curve_as_ellipse()

occtl_status_t occtl_curve_as_ellipse ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_geom_ellipse_t out_ellipse 
)

Extracts ellipse data from a curve representation.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_ELLIPSE.
[out]out_ellipseBorrows it (caller-allocated slot). Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_ellipse is NULL.
OCCTL_WRONG_KINDCurve is not an ellipse.

\par Thread Safety Yes.

See also
occtl_curve_kind

◆ occtl_curve_as_hyperbola()

occtl_status_t occtl_curve_as_hyperbola ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_geom_hyperbola_t out_hyperbola 
)

Extracts hyperbola data from a curve representation.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_HYPERBOLA.
[out]out_hyperbolaBorrows it (caller-allocated slot). Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_hyperbola is NULL.
OCCTL_WRONG_KINDCurve is not a hyperbola.

\par Thread Safety Yes.

See also
occtl_curve_kind

◆ occtl_curve_as_line()

occtl_status_t occtl_curve_as_line ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_geom_line_t out_line 
)

Extracts line data from a curve representation.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_LINE.
[out]out_lineBorrows it (caller-allocated slot). Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_line is NULL.
OCCTL_WRONG_KINDCurve is not a line.

\par Thread Safety Yes.

See also
occtl_curve_kind

◆ occtl_curve_as_offset()

occtl_status_t occtl_curve_as_offset ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double *  out_offset,
occtl_vector3_t out_offset_dir 
)

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

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_OFFSET.
[out]out_offsetSigned offset distance. May be NULL.
[out]out_offset_dirReference direction (unit length). May be NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph is NULL.
OCCTL_WRONG_KINDCurve is not an offset curve.

\par Thread Safety Yes.

See also
occtl_curve_kind

◆ occtl_curve_as_parabola()

occtl_status_t occtl_curve_as_parabola ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_geom_parabola_t out_parabola 
)

Extracts parabola data from a curve representation.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_PARABOLA.
[out]out_parabolaBorrows it (caller-allocated slot). Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_parabola is NULL.
OCCTL_WRONG_KINDCurve is not a parabola.

\par Thread Safety Yes.

See also
occtl_curve_kind

◆ occtl_curve_as_trimmed()

occtl_status_t occtl_curve_as_trimmed ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double *  out_u_first,
double *  out_u_last 
)

Extracts the parameter bounds of a trimmed curve.

The reported u_first / u_last are the parameter bounds the trimmed curve was constructed with (already adjusted for any sense flip at construction time), so reconstructing via occtl_curve_create_trimmed with sense=1 reproduces an equivalent curve.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_TRIMMED.
[out]out_u_firstFirst parameter. May be NULL.
[out]out_u_lastLast parameter. May be NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph is NULL.
OCCTL_WRONG_KINDCurve is not a trimmed curve.

\par Thread Safety Yes.

See also
occtl_curve_kind

◆ occtl_curve_bezier_create_info_init()

void occtl_curve_bezier_create_info_init ( occtl_curve_bezier_create_info_t info)

Runtime initialiser for occtl_curve_bezier_create_info_t.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_curve_create_bezier

◆ occtl_curve_bezier_degree()

occtl_status_t occtl_curve_bezier_degree ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
int32_t *  out_degree 
)

Returns the polynomial degree of a Bezier curve.

Equivalent to pole_count - 1 but exposed for symmetry with occtl_curve_bspline_degree.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query; kind must be OCCTL_CURVE_KIND_BEZIER.
[out]out_degreeReceives the degree. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_degree is NULL.
OCCTL_WRONG_KINDCurve is not a Bezier curve.

\par Thread Safety Yes.

See also
occtl_curve_create_bezier

◆ occtl_curve_bezier_is_rational()

occtl_status_t occtl_curve_bezier_is_rational ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
int32_t *  out_is_rational 
)

Returns non-zero if the Bezier curve is rational (has per-pole weights).

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query; kind must be OCCTL_CURVE_KIND_BEZIER.
[out]out_is_rationalReceives 1 if rational, 0 otherwise. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_is_rational is NULL.
OCCTL_WRONG_KINDCurve is not a Bezier curve.

\par Thread Safety Yes.

See also
occtl_curve_create_bezier

◆ occtl_curve_bezier_pole_count()

occtl_status_t occtl_curve_bezier_pole_count ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
size_t *  out_count 
)

Returns the pole count of a Bezier curve.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query; kind must be OCCTL_CURVE_KIND_BEZIER.
[out]out_countReceives the pole count. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_WRONG_KINDCurve is not a Bezier curve.

\par Thread Safety Yes.

See also
occtl_curve_create_bezier

◆ occtl_curve_bspline_create_info_init()

void occtl_curve_bspline_create_info_init ( occtl_curve_bspline_create_info_t info)

Runtime initialiser for occtl_curve_bspline_create_info_t.

Sets struct_version and zeroes all other fields. Use instead of the _INIT macro when C macros are not available (e.g. C# P/Invoke).

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_degree()

occtl_status_t occtl_curve_bspline_degree ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
int32_t *  out_degree 
)

Returns the polynomial degree of a B-spline curve.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query; kind must be OCCTL_CURVE_KIND_BSPLINE.
[out]out_degreeReceives the degree. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_degree is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_flat_knots()

occtl_status_t occtl_curve_bspline_flat_knots ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double *  out_buf,
size_t  capacity,
size_t *  out_count 
)

Extracts the expanded (flat) knot sequence of a B-spline curve.

The flat knot sequence repeats each distinct knot value by its multiplicity, which is the form most numerical libraries (NumPy, etc.) expect. The total count equals the sum of multiplicities.

Two-call pattern: same as occtl_curve_bspline_poles.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_BSPLINE.
[out]out_bufBuffer to receive flat knot values. May be NULL on sizing call.
[in]capacityCapacity of out_buf in elements.
[out]out_countRequired count. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline.
OCCTL_BUFFER_TOO_SMALLBuffer too small.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_init()

void occtl_curve_bspline_init ( occtl_curve_bspline_t out)

Runtime initialiser for occtl_curve_bspline_t.

Sets struct_version and zeroes all other fields. Use instead of the _INIT macro when C macros are not available (e.g. C# P/Invoke).

Parameters
[out]outBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_curve_as_bspline

◆ occtl_curve_bspline_is_rational()

occtl_status_t occtl_curve_bspline_is_rational ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
int32_t *  out_is_rational 
)

Returns non-zero if the B-spline curve is rational (has per-pole weights).

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query; kind must be OCCTL_CURVE_KIND_BSPLINE.
[out]out_is_rationalReceives 1 if rational, 0 otherwise. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_is_rational is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_knot_count()

occtl_status_t occtl_curve_bspline_knot_count ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
size_t *  out_count 
)

Returns the knot count (number of distinct knot values) of a B-spline curve.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query; kind must be OCCTL_CURVE_KIND_BSPLINE.
[out]out_countReceives the knot count. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_knots()

occtl_status_t occtl_curve_bspline_knots ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double *  out_buf,
size_t  capacity,
size_t *  out_count 
)

Extracts the distinct knot values of a B-spline curve.

Two-call pattern: same as occtl_curve_bspline_poles.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_BSPLINE.
[out]out_bufBuffer to receive knot values. May be NULL on sizing call.
[in]capacityCapacity of out_buf in elements.
[out]out_countRequired count. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline.
OCCTL_BUFFER_TOO_SMALLBuffer too small.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_multiplicities()

occtl_status_t occtl_curve_bspline_multiplicities ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
int32_t *  out_buf,
size_t  capacity,
size_t *  out_count 
)

Extracts the knot multiplicities of a B-spline curve.

Two-call pattern: same as occtl_curve_bspline_poles.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_BSPLINE.
[out]out_bufBuffer to receive multiplicity values. May be NULL on sizing call.
[in]capacityCapacity of out_buf in elements.
[out]out_countRequired count. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline.
OCCTL_BUFFER_TOO_SMALLBuffer too small.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_pole_count()

occtl_status_t occtl_curve_bspline_pole_count ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
size_t *  out_count 
)

Returns the pole count of a B-spline curve.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query; kind must be OCCTL_CURVE_KIND_BSPLINE.
[out]out_countReceives the pole count. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_poles()

occtl_status_t occtl_curve_bspline_poles ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_point3_t out_buf,
size_t  capacity,
size_t *  out_count 
)

Extracts the poles of a B-spline curve into a caller-supplied buffer.

Two-call pattern: call with out_buf == NULL to learn the required count in out_count, allocate, then call again with a buffer of at least that size.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_BSPLINE.
[out]out_bufBuffer to receive pole data. May be NULL on the sizing call.
[in]capacityNumber of elements out_buf can hold.
[out]out_countRequired count. Must be non-NULL.
Return values
OCCTL_OKOn success (poles written).
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline.
OCCTL_BUFFER_TOO_SMALLout_buf is non-NULL but capacity < *out_count.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_poles_view()

occtl_status_t occtl_curve_bspline_poles_view ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
const occtl_point3_t **  out_data,
size_t *  out_count 
)

Zero-copy view of the poles array of a B-spline curve.

Returns a direct pointer into the OCCT internal storage. Valid only while the graph rep is alive and no mutating call has been made on it.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to view; kind must be OCCTL_CURVE_KIND_BSPLINE.
[out]out_dataReceives a borrowed pointer to the pole array. Must be non-NULL.
[out]out_countReceives the pole count. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_data, or out_count is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline.

\par Thread Safety Yes (read-only).

See also
occtl_curve_create_bspline

◆ occtl_curve_bspline_weights()

occtl_status_t occtl_curve_bspline_weights ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double *  out_buf,
size_t  capacity,
size_t *  out_count 
)

Extracts the per-pole weights of a rational B-spline curve.

Returns OCCTL_WRONG_KIND if the curve is non-rational. Check occtl_curve_bspline_is_rational before calling this function.

Two-call pattern: same as occtl_curve_bspline_poles.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to extract; kind must be OCCTL_CURVE_KIND_BSPLINE; curve must be rational.
[out]out_bufBuffer to receive weight values. May be NULL on sizing call.
[in]capacityCapacity of out_buf in elements.
[out]out_countRequired count. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_WRONG_KINDCurve is not a B-spline, or B-spline is non-rational.
OCCTL_BUFFER_TOO_SMALLBuffer too small.

\par Thread Safety Yes.

See also
occtl_curve_create_bspline

◆ occtl_curve_continuity()

occtl_status_t occtl_curve_continuity ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_geom_continuity_t out_continuity 
)

Returns the continuity class of the curve.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query.
[out]out_continuityReceives the continuity class. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_continuity is NULL.

\par Thread Safety Yes.

See also
occtl_curve_create_line

◆ occtl_curve_create_airfoil_naca4()

occtl_status_t occtl_curve_create_airfoil_naca4 ( occtl_graph_t graph,
const occtl_curve_airfoil_naca4_info_t info,
occtl_rep_id_t out_id 
)

Creates a B-spline curve approximating a NACA 4-digit airfoil profile.

The wrapper generates cosine-spaced NACA profile samples and delegates curve fitting to OCCT's GeomAPI_PointsToBSpline. For a standard NACA 2412 profile, set max_camber=0.02, camber_position=0.4, and thickness=0.12.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]infoBorrows it. Versioned airfoil parameters; must be non-NULL.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_id, or info is NULL, p_next is non-NULL, a 0/1 flag is invalid, or a numeric parameter is outside its valid range.
OCCTL_VERSION_MISMATCHUnsupported struct_version.
OCCTL_GEOMETRY_INVALIDOCCT rejected the generated point fit.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_airfoil_naca4_info_init, occtl_curve_create_approximated

◆ occtl_curve_create_approximated()

occtl_status_t occtl_curve_create_approximated ( occtl_graph_t graph,
const occtl_curve_approximated_info_t info,
occtl_rep_id_t out_id 
)

Fits a B-spline curve to the given points within tolerance.

Uses OCCT's GeomAPI_PointsToBSpline. The resulting curve approximates the points; it does not necessarily pass through them.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]infoVersioned create-info. Must be non-NULL.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_id, or info is NULL, or required fields are NULL / zero.
OCCTL_VERSION_MISMATCHUnsupported struct_version.
OCCTL_GEOMETRY_INVALIDApproximation failed.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_approximated_info_init

◆ occtl_curve_create_arc_of_circle_3pt()

occtl_status_t occtl_curve_create_arc_of_circle_3pt ( occtl_graph_t graph,
occtl_point3_t  p1,
occtl_point3_t  p2,
occtl_point3_t  p3,
occtl_rep_id_t out_id 
)

Creates a trimmed circular arc through three 3D points.

The arc runs from p1 through p2 to p3. The three points must not be collinear and must be distinct.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]p1First point.
[in]p2Second point (intermediate).
[in]p3Third point.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_GEOMETRY_INVALIDThe three points are collinear or cannot define a unique circle.

\par Thread Safety Yes.

See also
occtl_curve_create_circle, occtl_curve_create_trimmed

◆ occtl_curve_create_bezier()

occtl_status_t occtl_curve_create_bezier ( occtl_graph_t graph,
const occtl_curve_bezier_create_info_t info,
occtl_rep_id_t out_id 
)

Creates a 3D curve representation from a Bezier definition.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]infoVersioned create-info. Must be non-NULL.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_id, or info is NULL.
OCCTL_VERSION_MISMATCHUnsupported struct_version.
OCCTL_GEOMETRY_INVALIDOCCT rejected the pole count or weights.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

◆ occtl_curve_create_bspline()

occtl_status_t occtl_curve_create_bspline ( occtl_graph_t graph,
const occtl_curve_bspline_create_info_t info,
occtl_rep_id_t out_id 
)

Creates a 3D curve representation from a B-spline definition.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]infoVersioned create-info struct. Must be non-NULL. Arrays inside are borrowed; they need not remain valid after the call returns.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_id, or info is NULL; or required array fields are NULL.
OCCTL_VERSION_MISMATCHinfo->struct_version is not supported.
OCCTL_GEOMETRY_INVALIDOCCT rejected the knot/pole/degree combination.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_bspline_degree, occtl_curve_bspline_poles

◆ occtl_curve_create_circle()

occtl_status_t occtl_curve_create_circle ( occtl_graph_t graph,
occtl_geom_circle_t  circle,
occtl_rep_id_t out_id 
)

Creates a 3D curve representation from a circle.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]circleCircle data (frame + radius). radius must be > 0.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_GEOMETRY_INVALIDcircle.radius is not positive.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_as_circle

◆ occtl_curve_create_ellipse()

occtl_status_t occtl_curve_create_ellipse ( occtl_graph_t graph,
occtl_geom_ellipse_t  ellipse,
occtl_rep_id_t out_id 
)

Creates a 3D curve representation from an ellipse.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]ellipseEllipse data. major_radius >= minor_radius > 0.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_GEOMETRY_INVALIDRadii are not positive or major < minor.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_as_ellipse

◆ occtl_curve_create_hyperbola()

occtl_status_t occtl_curve_create_hyperbola ( occtl_graph_t graph,
occtl_geom_hyperbola_t  hyperbola,
occtl_rep_id_t out_id 
)

Creates a 3D curve representation from a hyperbola.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]hyperbolaHyperbola data. Both radii must be > 0.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_GEOMETRY_INVALIDA radius is not positive.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_as_hyperbola

◆ occtl_curve_create_interpolated()

occtl_status_t occtl_curve_create_interpolated ( occtl_graph_t graph,
const occtl_curve_interpolated_info_t info,
occtl_rep_id_t out_id 
)

Creates a B-spline curve that interpolates (passes through) the given points.

Uses OCCT's GeomAPI_Interpolate. The resulting curve is always a C2 continuous cubic B-spline. Set is_periodic to make the curve periodic (first and last points must match within tolerance).

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]infoVersioned create-info. Must be non-NULL.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_id, or info is NULL, or required fields are NULL / zero.
OCCTL_VERSION_MISMATCHUnsupported struct_version.
OCCTL_GEOMETRY_INVALIDInterpolation failed.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_interpolated_info_init

◆ occtl_curve_create_line()

occtl_status_t occtl_curve_create_line ( occtl_graph_t graph,
occtl_geom_line_t  line,
occtl_rep_id_t out_id 
)

Creates a 3D curve representation from a line.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]lineLine data (origin + unit direction).
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_kind, occtl_curve_as_line

◆ occtl_curve_create_offset()

occtl_status_t occtl_curve_create_offset ( occtl_graph_t graph,
const occtl_curve_offset_create_info_t info,
occtl_rep_id_t out_id 
)

Creates an offset 3D curve.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]infoVersioned create-info. Must be non-NULL.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_id, or info is NULL; or info->basis is invalid.
OCCTL_VERSION_MISMATCHUnsupported struct_version.
OCCTL_GEOMETRY_INVALIDoffset_dir has zero length.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

◆ occtl_curve_create_parabola()

occtl_status_t occtl_curve_create_parabola ( occtl_graph_t graph,
occtl_geom_parabola_t  parabola,
occtl_rep_id_t out_id 
)

Creates a 3D curve representation from a parabola.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]parabolaParabola data. focal_length must be > 0.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_GEOMETRY_INVALIDfocal_length is not positive.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_as_parabola

◆ occtl_curve_create_trimmed()

occtl_status_t occtl_curve_create_trimmed ( occtl_graph_t graph,
const occtl_curve_trimmed_create_info_t info,
occtl_rep_id_t out_id 
)

Creates a trimmed 3D curve (bounded section of a basis curve).

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]infoVersioned create-info. Must be non-NULL.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_id, or info is NULL; or info->basis is invalid.
OCCTL_VERSION_MISMATCHUnsupported struct_version.
OCCTL_GEOMETRY_INVALIDu_last <= u_first, or OCCT rejected the interval.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

◆ occtl_curve_eval_d0()

occtl_status_t occtl_curve_eval_d0 ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double  u,
occtl_point3_t out_point 
)

Evaluates the curve at parameter u.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to evaluate.
[in]uParameter value.
[out]out_pointReceives the point on the curve. May be NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph is NULL.
OCCTL_OUT_OF_RANGEu is outside the parameter domain.

\par Thread Safety Only when distinct graph instances are used.

See also
occtl_curve_eval_d1, occtl_curve_eval_dn

◆ occtl_curve_eval_d1()

occtl_status_t occtl_curve_eval_d1 ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double  u,
occtl_point3_t out_point,
occtl_vector3_t out_d1 
)

Evaluates the curve and its first derivative at u.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to evaluate.
[in]uParameter value.
[out]out_pointReceives the point. May be NULL.
[out]out_d1Receives the first derivative vector. May be NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph is NULL.
OCCTL_OUT_OF_RANGEu is outside the parameter domain.

\par Thread Safety Only when distinct graph instances are used.

See also
occtl_curve_eval_d0, occtl_curve_eval_d2

◆ occtl_curve_eval_d2()

occtl_status_t occtl_curve_eval_d2 ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double  u,
occtl_point3_t out_point,
occtl_vector3_t out_d1,
occtl_vector3_t out_d2 
)

Evaluates point, first, and second derivatives at u.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to evaluate.
[in]uParameter value.
[out]out_pointReceives the point. May be NULL.
[out]out_d1Receives the first derivative vector. May be NULL.
[out]out_d2Receives the second derivative vector. May be NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph is NULL.
OCCTL_OUT_OF_RANGEu is outside the parameter domain.

\par Thread Safety Only when distinct graph instances are used.

See also
occtl_curve_eval_d1, occtl_curve_eval_d3

◆ occtl_curve_eval_d3()

occtl_status_t occtl_curve_eval_d3 ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double  u,
occtl_point3_t out_point,
occtl_vector3_t out_d1,
occtl_vector3_t out_d2,
occtl_vector3_t out_d3 
)

Evaluates point and first three derivatives at u.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to evaluate.
[in]uParameter value.
[out]out_pointReceives the point. May be NULL.
[out]out_d1Receives the first derivative vector. May be NULL.
[out]out_d2Receives the second derivative vector. May be NULL.
[out]out_d3Receives the third derivative vector. May be NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph is NULL.
OCCTL_OUT_OF_RANGEu is outside the parameter domain.

\par Thread Safety Only when distinct graph instances are used.

See also
occtl_curve_eval_d2, occtl_curve_eval_dn

◆ occtl_curve_eval_dn()

occtl_status_t occtl_curve_eval_dn ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double  u,
int32_t  n,
occtl_vector3_t out_derivative 
)

Returns the N-th derivative vector at u.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to evaluate.
[in]uParameter value.
[in]nDerivative order (0 returns a zero-length vector whose origin is on the curve; 1 returns the first derivative, etc.).
[out]out_derivativeReceives the derivative vector. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph is NULL.
OCCTL_OUT_OF_RANGEu is outside the parameter domain.

\par Thread Safety Only when distinct graph instances are used.

See also
occtl_curve_eval_d0, occtl_curve_eval_d3

◆ occtl_curve_free_bezier_segments()

void occtl_curve_free_bezier_segments ( occtl_rep_id_t ids)

Frees the array returned by occtl_curve_to_bezier_segments.

NULL-tolerant; passing NULL is a no-op.

Parameters
[in]idsOwns it. May be NULL.

\par Thread Safety Yes.

See also
occtl_curve_to_bezier_segments

◆ occtl_curve_free_intersection_points()

void occtl_curve_free_intersection_points ( occtl_curve_intersection_point_t results)

Frees the array returned by occtl_curve_intersect.

NULL-tolerant; passing NULL is a no-op.

Parameters
[in]resultsOwns it. May be NULL.

\par Thread Safety Yes.

See also
occtl_curve_intersect

◆ occtl_curve_interpolated_info_init()

void occtl_curve_interpolated_info_init ( occtl_curve_interpolated_info_t info)

Runtime initialiser for occtl_curve_interpolated_info_t.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_curve_create_interpolated

◆ occtl_curve_intersect()

occtl_status_t occtl_curve_intersect ( occtl_graph_t graph,
occtl_rep_id_t  curve_id_a,
occtl_rep_id_t  curve_id_b,
const occtl_curve_intersection_point_t **  out_results,
size_t *  out_count 
)

Finds the closest points between two curves.

Uses OCCT's GeomAPI_ExtremaCurveCurve. Returns all extrema points (minima and maxima of distance) between the two curves. When the curves intersect, the distance is zero and the returned points coincide.

The caller owns the returned array and must free it with occtl_curve_free_intersection_points.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_id_aFirst curve.
[in]curve_id_bSecond curve.
[out]out_resultsReceives a caller-owned array of intersection points. Must be non-NULL. Free with occtl_curve_free_intersection_points.
[out]out_countReceives the number of intersection points. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_results, or out_count is NULL.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety Yes.

See also
occtl_curve_create_line

◆ occtl_curve_is_closed()

occtl_status_t occtl_curve_is_closed ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
int32_t *  out_is_closed 
)

Returns non-zero if the curve is closed.

A curve is closed when its start and end points coincide within OCCT's confusion tolerance. Periodic curves are always closed; the converse does not hold.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query.
[out]out_is_closedReceives 1 if closed, 0 otherwise. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_is_closed is NULL.

\par Thread Safety Yes.

See also
occtl_curve_is_periodic

◆ occtl_curve_is_periodic()

occtl_status_t occtl_curve_is_periodic ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
int32_t *  out_is_periodic 
)

Returns non-zero if the curve is periodic.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query.
[out]out_is_periodicReceives 1 if periodic, 0 otherwise. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_is_periodic is NULL.

\par Thread Safety Yes.

See also
occtl_curve_create_line

◆ occtl_curve_kind()

occtl_status_t occtl_curve_kind ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_curve_kind_t out_kind 
)

Returns the kind of geometry wrapped by a curve representation.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query.
[out]out_kindReceives the curve kind. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_kind is NULL.

\par Thread Safety Yes.

See also
occtl_curve_as_circle, occtl_curve_as_ellipse

◆ occtl_curve_length()

occtl_status_t occtl_curve_length ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double *  out_length 
)

Computes the length of the curve over its full parameter range.

The length is computed by numerical integration using OCCT's GCPnts_AbscissaPoint.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to measure.
[out]out_lengthReceives the curve length. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_length is NULL.

\par Thread Safety Only when distinct graph instances are used.

See also
occtl_curve_create_line

◆ occtl_curve_offset_create_info_init()

void occtl_curve_offset_create_info_init ( occtl_curve_offset_create_info_t info)

Runtime initialiser for occtl_curve_offset_create_info_t.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_curve_create_offset

◆ occtl_curve_parameter_of_point()

occtl_status_t occtl_curve_parameter_of_point ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_point3_t  point,
double *  out_param 
)

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

Convenience function equivalent to occtl_curve_project_point with out_distance = NULL.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query.
[in]pointPoint to find the parameter for.
[out]out_paramReceives the parameter. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_param is NULL.

\par Thread Safety Only when distinct graph instances are used.

See also
occtl_curve_create_line

◆ occtl_curve_parameter_range()

occtl_status_t occtl_curve_parameter_range ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
double *  out_u_min,
double *  out_u_max 
)

Returns the parameter range of the curve.

For analytic infinite curves (lines, parabolas, hyperbolas) OCCT returns -Precision::Infinite() and +Precision::Infinite() (numerically -1e100 and +1e100). Bounded analytic curves (full circles, ellipses) return [0, 2pi]. Trimmed and B-spline curves return their explicit range.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to query.
[out]out_u_minFirst (start) parameter. May be NULL.
[out]out_u_maxLast (end) parameter. May be NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph is NULL.

\par Thread Safety Yes.

See also
occtl_curve_create_line

◆ occtl_curve_project_point()

occtl_status_t occtl_curve_project_point ( const occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_point3_t  point,
double *  out_param,
double *  out_distance 
)

Projects a 3D point onto the curve and returns the closest parameter.

Uses OCCT's GeomAPI_ProjectPointOnCurve. When multiple solutions exist (e.g. a circle), the closest point is returned.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to project onto.
[in]pointPoint to project.
[out]out_paramReceives the parameter of the closest point on the curve. Must be non-NULL.
[out]out_distanceReceives the shortest distance. May be NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_param is NULL.

\par Thread Safety Only when distinct graph instances are used.

See also
occtl_curve_create_line

◆ occtl_curve_reverse()

occtl_status_t occtl_curve_reverse ( occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_rep_id_t out_id 
)

Creates a new curve representation that is the reversed copy of curve_id.

The returned rep owns an independent curve whose parameterisation runs in the opposite direction: reversed(u) = curve(u_last - u).

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to reverse.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_create_line

◆ occtl_curve_rotated()

occtl_status_t occtl_curve_rotated ( occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_axis1_placement_t  axis,
double  angle,
occtl_rep_id_t out_id 
)

Creates a new curve representation by rotating curve_id.

Convenience wrapper equivalent to applying a rotation transform.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to rotate.
[in]axisRotation axis (origin + direction).
[in]angleRotation angle in radians.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_create_line

◆ occtl_curve_scaled()

occtl_status_t occtl_curve_scaled ( occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_point3_t  origin,
double  factor,
occtl_rep_id_t out_id 
)

Creates a new curve representation by scaling curve_id about origin.

Convenience wrapper equivalent to applying a non-uniform scale transform.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to scale.
[in]originOrigin point for scaling.
[in]factorScale factor; must be non-zero.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_GEOMETRY_INVALIDfactor is zero.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_create_line

◆ occtl_curve_to_bezier_segments()

occtl_status_t occtl_curve_to_bezier_segments ( occtl_graph_t graph,
occtl_rep_id_t  curve_id,
const occtl_curve_bezier_segments_options_t options,
occtl_rep_id_t **  out_ids,
size_t *  out_count 
)

Decomposes a curve into adjacent Bezier curve segments.

The implementation delegates conversion and segmentation to OCCT GeomConvert and GeomConvert_BSplineCurveToBezierCurve. Each output entry is a new rep id of kind OCCTL_CURVE_KIND_BEZIER. Free the returned array with occtl_curve_free_bezier_segments.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to decompose.
[in]optionsBorrows it. May be NULL for default full-domain options.
[out]out_idsOwns it. Receives an allocated array of rep ids. Must be non-NULL. Free with occtl_curve_free_bezier_segments.
[out]out_countBorrows it. Receives the number of returned segments. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, out_ids, or out_count is NULL; p_next is non-NULL; a 0/1 flag is invalid; range/tolerance values are invalid.
OCCTL_VERSION_MISMATCHUnsupported options->struct_version.
OCCTL_GEOMETRY_INVALIDOCCT could not convert or segment the curve.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety Yes.

See also
occtl_curve_create_bezier, occtl_curve_bezier_segments_options_init

◆ occtl_curve_transformed()

occtl_status_t occtl_curve_transformed ( occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_transform_t  transform,
occtl_rep_id_t out_id 
)

Creates a new curve representation by applying a 3D transform to curve_id.

The returned rep owns an independent transformed copy.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to transform.
[in]transformTransform to apply.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_create_line

◆ occtl_curve_translated()

occtl_status_t occtl_curve_translated ( occtl_graph_t graph,
occtl_rep_id_t  curve_id,
occtl_vector3_t  delta,
occtl_rep_id_t out_id 
)

Creates a new curve representation by translating curve_id.

Convenience wrapper equivalent to applying a translation transform.

Parameters
[in]graphOwning graph. Must be non-NULL.
[in]curve_idCurve to translate.
[in]deltaTranslation vector.
[out]out_idReceives the new rep id. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_id is NULL.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (mutates graph).

See also
occtl_curve_create_line