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

OCCT-Light: Topology relation queries, hit tests, and contact analysis. More...

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

Go to the source code of this file.

Classes

struct  occtl_oriented_node
 
struct  occtl_topo_child_explorer_config
 
struct  occtl_topo_parent_explorer_config
 
struct  occtl_topo_relation_options
 
struct  occtl_topo_distance_pair
 
struct  occtl_topo_axis_hit
 
struct  occtl_topo_touch_hit
 

Macros

#define OCCTL_TOPO_CHILD_EXPLORER_CONFIG_VERSION_1   1u
 
#define OCCTL_TOPO_CHILD_EXPLORER_CONFIG_INIT
 
#define OCCTL_TOPO_PARENT_EXPLORER_CONFIG_VERSION_1   1u
 
#define OCCTL_TOPO_PARENT_EXPLORER_CONFIG_INIT
 
#define OCCTL_TOPO_RELATION_OPTIONS_VERSION_1   1u
 
#define OCCTL_TOPO_RELATION_OPTIONS_INIT    {OCCTL_TOPO_RELATION_OPTIONS_VERSION_1, NULL, 1.0e-7, 1, 1, 1}
 

Typedefs

typedef enum occtl_shape_continuity occtl_shape_continuity_t
 
typedef enum occtl_orientation occtl_orientation_t
 
typedef struct occtl_oriented_node occtl_oriented_node_t
 
typedef struct occtl_topo_explorer_iter occtl_topo_explorer_iter_t
 
typedef enum occtl_topo_explorer_traversal occtl_topo_explorer_traversal_t
 
typedef struct occtl_topo_child_explorer_config occtl_topo_child_explorer_config_t
 
typedef struct occtl_topo_parent_explorer_config occtl_topo_parent_explorer_config_t
 
typedef struct occtl_topo_related_iter occtl_topo_related_iter_t
 
typedef struct occtl_topo_axis_hit_iter occtl_topo_axis_hit_iter_t
 
typedef struct occtl_topo_relation_options occtl_topo_relation_options_t
 
typedef struct occtl_topo_touch_iter occtl_topo_touch_iter_t
 
typedef struct occtl_topo_intersection_iter occtl_topo_intersection_iter_t
 
typedef enum occtl_relation_kind occtl_relation_kind_t
 
typedef enum occtl_topo_point_class occtl_topo_point_class_t
 
typedef struct occtl_topo_distance_pair occtl_topo_distance_pair_t
 
typedef struct occtl_topo_axis_hit occtl_topo_axis_hit_t
 
typedef struct occtl_topo_touch_hit occtl_topo_touch_hit_t
 

Enumerations

enum  occtl_shape_continuity {
  OCCTL_CONTINUITY_C0 = 0 , OCCTL_CONTINUITY_C1 = 1 , OCCTL_CONTINUITY_C2 = 2 , OCCTL_CONTINUITY_C3 = 3 ,
  OCCTL_CONTINUITY_CN = 4 , OCCTL_CONTINUITY_G1 = 5 , OCCTL_CONTINUITY_G2 = 6 , OCCTL_CONTINUITY_RESERVED_FUTURE = 0x7fffffff
}
 
enum  occtl_orientation {
  OCCTL_ORIENTATION_FORWARD = 0 , OCCTL_ORIENTATION_REVERSED = 1 , OCCTL_ORIENTATION_INTERNAL = 2 , OCCTL_ORIENTATION_EXTERNAL = 3 ,
  OCCTL_ORIENTATION_RESERVED_FUTURE = 0x7fffffff
}
 
enum  occtl_topo_explorer_traversal { OCCTL_TOPO_EXPLORER_RECURSIVE = 0 , OCCTL_TOPO_EXPLORER_DIRECT_CHILDREN = 1 , OCCTL_TOPO_EXPLORER_TRAVERSAL_RESERVED_FUTURE = 0x7fffffff }
 
enum  occtl_relation_kind {
  OCCTL_RELATION_BOUNDARY_EDGE = 0 , OCCTL_RELATION_ADJACENT_FACE = 1 , OCCTL_RELATION_OUTER_WIRE = 2 , OCCTL_RELATION_REFERENCED_BY = 3 ,
  OCCTL_RELATION_INCIDENT_VERTEX = 4 , OCCTL_RELATION_WIRE_COEDGE = 5 , OCCTL_RELATION_OWNING_FACE = 6 , OCCTL_RELATION_INCIDENT_EDGE = 7 ,
  OCCTL_RELATION_PARENT_EDGE = 8 , OCCTL_RELATION_SEAM_PAIR = 9 , OCCTL_RELATION_KIND_RESERVED_FUTURE = 0x7fffffff
}
 
enum  occtl_topo_point_class {
  OCCTL_TOPO_POINT_CLASS_IN = 0 , OCCTL_TOPO_POINT_CLASS_OUT = 1 , OCCTL_TOPO_POINT_CLASS_ON = 2 , OCCTL_TOPO_POINT_CLASS_UNKNOWN = 3 ,
  OCCTL_TOPO_POINT_CLASS_RESERVED_FUTURE = 0x7fffffff
}
 

Functions

occtl_status_t occtl_topo_wire_order_edges (const occtl_graph_t *graph, occtl_node_id_t wire, occtl_oriented_node_t *out_buf, size_t cap, size_t *out_count)
 
void occtl_topo_child_explorer_config_init (occtl_topo_child_explorer_config_t *config)
 
occtl_status_t occtl_topo_child_explorer_create (const occtl_graph_t *graph, occtl_node_id_t root, const occtl_topo_child_explorer_config_t *config, occtl_topo_explorer_iter_t **out_iter)
 
void occtl_topo_parent_explorer_config_init (occtl_topo_parent_explorer_config_t *config)
 
occtl_status_t occtl_topo_parent_explorer_create (const occtl_graph_t *graph, occtl_node_id_t node, const occtl_topo_parent_explorer_config_t *config, occtl_topo_explorer_iter_t **out_iter)
 
occtl_status_t occtl_topo_explorer_iter_next (occtl_topo_explorer_iter_t *iter, occtl_node_id_t *out_node, occtl_transform_t *out_transform, occtl_orientation_t *out_orientation)
 
void occtl_topo_explorer_iter_free (occtl_topo_explorer_iter_t *iter)
 
void occtl_topo_relation_options_init (occtl_topo_relation_options_t *options)
 
occtl_status_t occtl_topo_related_iter_create (const occtl_graph_t *graph, occtl_node_id_t node, occtl_topo_related_iter_t **out_iter)
 
occtl_status_t occtl_topo_distance_pair (const occtl_graph_t *graph, occtl_node_id_t node_a, occtl_node_id_t node_b, occtl_topo_distance_pair_t *out_pair)
 
occtl_status_t occtl_topo_closest_point_to_point (const occtl_graph_t *graph, occtl_node_id_t node, occtl_point3_t point, occtl_point3_t *out_closest, double *out_distance)
 
occtl_status_t occtl_topo_axis_intersect_faces (const occtl_graph_t *graph, occtl_node_id_t root, occtl_axis1_placement_t axis, double min_parameter, double max_parameter, double tolerance, occtl_topo_axis_hit_iter_t **out_iter)
 
occtl_status_t occtl_topo_touch_iter_create (const occtl_graph_t *graph, occtl_node_id_t node_a, occtl_node_id_t node_b, const occtl_topo_relation_options_t *options, occtl_topo_touch_iter_t **out_iter)
 
occtl_status_t occtl_topo_intersection_iter_create (occtl_graph_t *graph, occtl_node_id_t node_a, occtl_node_id_t node_b, const occtl_topo_relation_options_t *options, occtl_topo_intersection_iter_t **out_iter)
 
occtl_status_t occtl_topo_is_same_geometry (const occtl_graph_t *graph, occtl_node_id_t node_a, occtl_node_id_t node_b, double tolerance, int32_t *out_is_same_geometry)
 
occtl_status_t occtl_topo_common_vertices (const occtl_graph_t *graph, occtl_node_id_t node_a, occtl_node_id_t node_b, occtl_node_id_t *out_buf, size_t cap, size_t *out_count)
 
occtl_status_t occtl_topo_adjacent_edges (const occtl_graph_t *graph, occtl_node_id_t edge, occtl_node_id_t *out_buf, size_t cap, size_t *out_count)
 
occtl_status_t occtl_topo_adjacent_faces (const occtl_graph_t *graph, occtl_node_id_t face, occtl_node_id_t *out_buf, size_t cap, size_t *out_count)
 
occtl_status_t occtl_topo_connected_edges (const occtl_graph_t *graph, occtl_node_id_t seed_edge, occtl_node_id_t *out_buf, size_t cap, size_t *out_count)
 
occtl_status_t occtl_topo_connected_faces (const occtl_graph_t *graph, occtl_node_id_t seed_face, occtl_node_id_t *out_buf, size_t cap, size_t *out_count)
 
occtl_status_t occtl_topo_graph_distance (const occtl_graph_t *graph, occtl_node_id_t root, const occtl_node_id_t *sources, size_t source_count, occtl_node_id_t target, int32_t *out_distance)
 
occtl_status_t occtl_topo_classify_point (const occtl_graph_t *graph, occtl_node_id_t solid, occtl_point3_t point, double tolerance, occtl_topo_point_class_t *out_class)
 
occtl_status_t occtl_topo_is_inside (const occtl_graph_t *graph, occtl_node_id_t solid, occtl_point3_t point, double tolerance, int32_t include_boundary, int32_t *out_is_inside)
 
occtl_status_t occtl_topo_axis_hit_iter_next (occtl_topo_axis_hit_iter_t *iter, occtl_topo_axis_hit_t *out_hit)
 
void occtl_topo_axis_hit_iter_free (occtl_topo_axis_hit_iter_t *iter)
 
occtl_status_t occtl_topo_touch_iter_next (occtl_topo_touch_iter_t *iter, occtl_topo_touch_hit_t *out_hit)
 
void occtl_topo_touch_iter_free (occtl_topo_touch_iter_t *iter)
 
occtl_status_t occtl_topo_intersection_iter_next (occtl_topo_intersection_iter_t *iter, occtl_node_id_t *out_node)
 
void occtl_topo_intersection_iter_free (occtl_topo_intersection_iter_t *iter)
 
occtl_status_t occtl_topo_related_iter_next (occtl_topo_related_iter_t *iter, occtl_node_id_t *out_node, occtl_relation_kind_t *out_kind)
 
void occtl_topo_related_iter_free (occtl_topo_related_iter_t *iter)
 

Detailed Description

OCCT-Light: Topology relation queries, hit tests, and contact analysis.

Defines enums, structs, iterators, and functions for computing spatial relationships between topology entities: distance pairs, adjacency, connectivity, axis hits, touch points, intersection tests, and geometric classification.

Macro Definition Documentation

◆ OCCTL_TOPO_CHILD_EXPLORER_CONFIG_INIT

#define OCCTL_TOPO_CHILD_EXPLORER_CONFIG_INIT
Value:
{OCCTL_TOPO_CHILD_EXPLORER_CONFIG_VERSION_1, \
NULL, \
0, \
1, \
1}
@ OCCTL_KIND_INVALID
Definition occtl_core.h:189
@ OCCTL_TOPO_EXPLORER_RECURSIVE
Definition occtl_topo_relation.h:138

◆ OCCTL_TOPO_PARENT_EXPLORER_CONFIG_INIT

#define OCCTL_TOPO_PARENT_EXPLORER_CONFIG_INIT
Value:
{OCCTL_TOPO_PARENT_EXPLORER_CONFIG_VERSION_1, \
NULL, \
0}

Typedef Documentation

◆ occtl_orientation_t

Orientation used when placing a child entity inside its parent.

Values mirror TopAbs_Orientation 1:1 in numeric order so conversion is a static_cast (with a sanity assert in debug).

◆ occtl_oriented_node_t

(NodeId, orientation) pair used in builder info structs and ordered traversal results to specify a child entity and its parent orientation.

Passed by value; embedded in spans inside info structs. Not versioned.

◆ occtl_relation_kind_t

Semantic relation between two nodes in the graph.

◆ occtl_shape_continuity_t

Shape continuity level, mirroring GeomAbs_Shape.

Describes the geometric continuity at an edge between two adjacent faces.

◆ occtl_topo_axis_hit_iter_t

typedef struct occtl_topo_axis_hit_iter occtl_topo_axis_hit_iter_t

Opaque iterator over axis/face intersection hits.

Created by occtl_topo_axis_intersect_faces and released with occtl_topo_axis_hit_iter_free.

\par Thread Safety No — single-owner; concurrent reads on distinct iterators are safe when the owning graph is not mutated.

◆ occtl_topo_axis_hit_t

One intersection between an axis and a face under a graph root.

◆ occtl_topo_child_explorer_config_t

◆ occtl_topo_distance_pair_t

Closest-distance result between two graph nodes.

Support nodes are best-effort mappings from OCCT's support shapes back to graph node IDs. They are OCCTL_NODE_ID_INVALID when OCCT reports a support that is not represented by an active graph node.

◆ occtl_topo_explorer_iter_t

typedef struct occtl_topo_explorer_iter occtl_topo_explorer_iter_t

Opaque iterator over accumulated-location/orientation graph traversal.

Created by occtl_topo_child_explorer_create and occtl_topo_parent_explorer_create. Each yield includes the current node's definition ID, accumulated transform, and accumulated orientation. Release with occtl_topo_explorer_iter_free.

\par Thread Safety No — single-owner; concurrent reads on distinct iterators over the same graph are safe when the graph is not mutated.

See also
occtl_topo_child_explorer_create, occtl_topo_parent_explorer_create

◆ occtl_topo_explorer_traversal_t

Traversal mode for child and parent explorers.

◆ occtl_topo_intersection_iter_t

typedef struct occtl_topo_intersection_iter occtl_topo_intersection_iter_t

Opaque iterator over topology generated by an intersection query.

Created by occtl_topo_intersection_iter_create and released with occtl_topo_intersection_iter_free.

\par Thread Safety No — single-owner; concurrent reads on distinct iterators are safe when the owning graph is not mutated.

◆ occtl_topo_parent_explorer_config_t

◆ occtl_topo_point_class_t

Point classification result for graph topology.

◆ occtl_topo_related_iter_t

typedef struct occtl_topo_related_iter occtl_topo_related_iter_t

Opaque iterator over a node's semantic neighbours and their relation kinds.

Created by occtl_topo_related_iter_create. Release with occtl_topo_related_iter_free.

\par Thread Safety No — single-owner; concurrent reads on distinct iterators over the same graph are safe when the graph is not mutated.

◆ occtl_topo_relation_options_t

Options for relation/contact queries.

The first version is used by occtl_topo_touch_iter_create. Tangent contacts are distance-zero solutions reported by OCCT. Overlap solutions are included when include_overlaps is 1; set it to 0 to suppress OCCT inner-overlap reports.

◆ occtl_topo_touch_hit_t

One contact solution between two graph nodes.

Support node IDs are best-effort mappings from OCCT support shapes back to original graph nodes. They may be OCCTL_NODE_ID_INVALID when OCCT reports a support that is not represented directly by an active graph node.

◆ occtl_topo_touch_iter_t

typedef struct occtl_topo_touch_iter occtl_topo_touch_iter_t

Opaque iterator over contact solutions between two graph nodes.

Created by occtl_topo_touch_iter_create and released with occtl_topo_touch_iter_free.

\par Thread Safety No — single-owner; concurrent reads on distinct iterators are safe when the owning graph is not mutated.

Enumeration Type Documentation

◆ occtl_orientation

Orientation used when placing a child entity inside its parent.

Values mirror TopAbs_Orientation 1:1 in numeric order so conversion is a static_cast (with a sanity assert in debug).

Enumerator
OCCTL_ORIENTATION_FORWARD 

Forward orientation.

OCCTL_ORIENTATION_REVERSED 

Reversed orientation.

OCCTL_ORIENTATION_INTERNAL 

Internal orientation.

OCCTL_ORIENTATION_EXTERNAL 

External orientation.

◆ occtl_relation_kind

Semantic relation between two nodes in the graph.

Enumerator
OCCTL_RELATION_BOUNDARY_EDGE 

Boundary edge of a face.

OCCTL_RELATION_ADJACENT_FACE 

Face adjacent via shared edge.

OCCTL_RELATION_OUTER_WIRE 

Outer wire of a face.

OCCTL_RELATION_REFERENCED_BY 

Face referenced by this coedge.

OCCTL_RELATION_INCIDENT_VERTEX 

Vertex incident to this edge.

OCCTL_RELATION_WIRE_COEDGE 

Coedge belonging to this wire.

OCCTL_RELATION_OWNING_FACE 

Face owning this coedge/wire.

OCCTL_RELATION_INCIDENT_EDGE 

Edge incident to this vertex.

OCCTL_RELATION_PARENT_EDGE 

Parent edge of this coedge.

OCCTL_RELATION_SEAM_PAIR 

Seam-pair coedge.

◆ occtl_shape_continuity

Shape continuity level, mirroring GeomAbs_Shape.

Describes the geometric continuity at an edge between two adjacent faces.

Enumerator
OCCTL_CONTINUITY_C0 

Positional continuity only.

OCCTL_CONTINUITY_C1 

First-derivative continuity.

OCCTL_CONTINUITY_C2 

Second-derivative continuity.

OCCTL_CONTINUITY_C3 

Third-derivative continuity.

OCCTL_CONTINUITY_CN 

Infinite (analytical) continuity.

OCCTL_CONTINUITY_G1 

Tangent (geometric) continuity.

OCCTL_CONTINUITY_G2 

Curvature (geometric) continuity.

◆ occtl_topo_explorer_traversal

Traversal mode for child and parent explorers.

Enumerator
OCCTL_TOPO_EXPLORER_RECURSIVE 

Recursive depth-first traversal.

OCCTL_TOPO_EXPLORER_DIRECT_CHILDREN 

Direct children only.

◆ occtl_topo_point_class

Point classification result for graph topology.

Enumerator
OCCTL_TOPO_POINT_CLASS_IN 

Point is inside the target.

OCCTL_TOPO_POINT_CLASS_OUT 

Point is outside the target.

OCCTL_TOPO_POINT_CLASS_ON 

Point lies on the target boundary.

OCCTL_TOPO_POINT_CLASS_UNKNOWN 

Classification failed or is undefined.

Function Documentation

◆ occtl_topo_adjacent_edges()

occtl_status_t occtl_topo_adjacent_edges ( const occtl_graph_t graph,
occtl_node_id_t  edge,
occtl_node_id_t out_buf,
size_t  cap,
size_t *  out_count 
)

Lists edges adjacent to edge through shared vertices.

Two-call buffer (§10.1): pass out_buf as NULL with cap = 0 to learn the required count in out_count, then reissue with a buffer of at least that many occtl_node_id_t entries.

The input edge itself is not included.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]edgeEdge node ID.
[out]out_bufBorrows it. May be NULL on the sizing call.
[in]capCapacity of out_buf in entries.
[out]out_countBorrows it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_NOT_FOUNDedge is invalid or removed.
OCCTL_WRONG_KINDedge is not an edge.
OCCTL_BUFFER_TOO_SMALLout_buf is non-NULL and cap is too small.

\par Thread Safety Yes (read-only on graph).

See also
occtl_topo_connected_edges, occtl_topo_adjacent_faces

◆ occtl_topo_adjacent_faces()

occtl_status_t occtl_topo_adjacent_faces ( const occtl_graph_t graph,
occtl_node_id_t  face,
occtl_node_id_t out_buf,
size_t  cap,
size_t *  out_count 
)

Lists faces adjacent to face through shared edges.

Two-call buffer (§10.1): pass out_buf as NULL with cap = 0 to learn the required count in out_count, then reissue with a buffer of at least that many occtl_node_id_t entries.

The input face itself is not included.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]faceFace node ID.
[out]out_bufBorrows it. May be NULL on the sizing call.
[in]capCapacity of out_buf in entries.
[out]out_countBorrows it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_NOT_FOUNDface is invalid or removed.
OCCTL_WRONG_KINDface is not a face.
OCCTL_BUFFER_TOO_SMALLout_buf is non-NULL and cap is too small.

\par Thread Safety Yes (read-only on graph).

See also
occtl_topo_connected_faces, occtl_topo_adjacent_edges

◆ occtl_topo_axis_hit_iter_free()

void occtl_topo_axis_hit_iter_free ( occtl_topo_axis_hit_iter_t iter)

Releases an axis-hit iterator.

Parameters
[in]iterOwns it. May be NULL.

\par Thread Safety Yes.

See also
occtl_topo_axis_intersect_faces

◆ occtl_topo_axis_hit_iter_next()

occtl_status_t occtl_topo_axis_hit_iter_next ( occtl_topo_axis_hit_iter_t iter,
occtl_topo_axis_hit_t out_hit 
)

Advances an axis-hit iterator.

Parameters
[in,out]iterBorrows it. Must be non-NULL.
[out]out_hitBorrows it. Must be non-NULL.
Return values
OCCTL_OKNext hit written.
OCCTL_NOT_FOUNDIterator exhausted.
OCCTL_INVALID_ARGUMENTiter or out_hit is NULL.

\par Thread Safety No (mutates iterator).

See also
occtl_topo_axis_intersect_faces, occtl_topo_axis_hit_iter_free

◆ occtl_topo_axis_intersect_faces()

occtl_status_t occtl_topo_axis_intersect_faces ( const occtl_graph_t graph,
occtl_node_id_t  root,
occtl_axis1_placement_t  axis,
double  min_parameter,
double  max_parameter,
double  tolerance,
occtl_topo_axis_hit_iter_t **  out_iter 
)

Creates an iterator over faces intersected by an axis under root.

The calculation is delegated to OCCT's face/curve intersector. Hits are ordered by signed axis parameter and include the hit point, UV parameters, and a best-effort oriented surface normal.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]rootRoot shape node whose faces are tested.
[in]axisDirected axis used as the query line.
[in]min_parameterInclusive lower signed axis parameter.
[in]max_parameterInclusive upper signed axis parameter.
[in]toleranceIntersection tolerance. Must be non-negative.
[out]out_iterOwns it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_iter is NULL, tolerance is negative, the parameter interval is invalid, or axis direction is zero/non-finite.
OCCTL_NOT_FOUNDroot is invalid or removed.
OCCTL_GEOMETRY_INVALIDOCCT could not complete the intersection.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety Yes (read-only on graph; uses local OCCT intersector state).

See also
occtl_topo_axis_hit_iter_next, occtl_topo_axis_hit_iter_free

◆ occtl_topo_child_explorer_config_init()

void occtl_topo_child_explorer_config_init ( occtl_topo_child_explorer_config_t config)

Initialises config to default values via OCCTL_TOPO_CHILD_EXPLORER_CONFIG_INIT.

NULL-tolerant.

Parameters
[out]configBorrows it. May be NULL (no-op).

\par Thread Safety Yes.

See also
occtl_topo_child_explorer_create

◆ occtl_topo_child_explorer_create()

occtl_status_t occtl_topo_child_explorer_create ( const occtl_graph_t graph,
occtl_node_id_t  root,
const occtl_topo_child_explorer_config_t config,
occtl_topo_explorer_iter_t **  out_iter 
)

Creates a downward depth-first child explorer starting from root.

The explorer accumulates location and orientation along reference chains and yields each visited node with its accumulated transform and orientation. Use occtl_topo_explorer_iter_next to step and occtl_topo_explorer_iter_free to release.

Parameters
[in]graphMust be non-NULL.
[in]rootRoot node ID for the traversal.
[in]configBorrows it. May be NULL for defaults (recursive, all kinds, location+orientation accumulated).
[out]out_iterOwns it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_iter is NULL, or config->p_next is non-NULL.
OCCTL_NOT_FOUNDroot is invalid or removed.
OCCTL_VERSION_MISMATCHconfig->struct_version unsupported.
OCCTL_OUT_OF_RANGEconfig->mode, config->target_kind, or config->avoid_kind is not valid.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety Yes (read-only on graph).

See also
occtl_topo_explorer_iter_next, occtl_topo_parent_explorer_create

◆ occtl_topo_classify_point()

occtl_status_t occtl_topo_classify_point ( const occtl_graph_t graph,
occtl_node_id_t  solid,
occtl_point3_t  point,
double  tolerance,
occtl_topo_point_class_t out_class 
)

Classifies a 3D point relative to a solid node.

Classification is graph-native and delegates to OCCT BRepGraphAlgo_SolidClassifier.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]solidSolid node to classify against.
[in]pointPoint to classify.
[in]toleranceTolerance for boundary detection. Must be non-negative.
[out]out_classBorrows it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_class is NULL, or tolerance is negative.
OCCTL_NOT_FOUNDsolid is invalid or removed.
OCCTL_WRONG_KINDsolid is not a solid.

\par Thread Safety Yes (read-only on graph; may build classifier-local caches).

See also
occtl_topo_is_inside, occtl_topo_distance_pair

◆ occtl_topo_closest_point_to_point()

occtl_status_t occtl_topo_closest_point_to_point ( const occtl_graph_t graph,
occtl_node_id_t  node,
occtl_point3_t  point,
occtl_point3_t out_closest,
double *  out_distance 
)

Finds the closest point on a graph node to a world-space point.

The graph is not mutated. The returned point lies on node, and out_distance receives the world-space distance from point when requested.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]nodeNode to search.
[in]pointQuery point.
[out]out_closestBorrows it. Must be non-NULL. Receives the closest point on node.
[out]out_distanceBorrows it. May be NULL. Receives the minimum distance.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_closest is NULL.
OCCTL_NOT_FOUNDnode is invalid or removed.
OCCTL_GEOMETRY_INVALIDOCCT could not compute a closest solution.

\par Thread Safety Yes (read-only on graph; may populate internal shape caches).

See also
occtl_topo_distance_pair, occtl_graph_pair_distance_get

◆ occtl_topo_common_vertices()

occtl_status_t occtl_topo_common_vertices ( const occtl_graph_t graph,
occtl_node_id_t  node_a,
occtl_node_id_t  node_b,
occtl_node_id_t out_buf,
size_t  cap,
size_t *  out_count 
)

Lists vertex nodes common to two graph roots.

Two-call buffer (§10.1): pass out_buf as NULL with cap = 0 to learn the required count in out_count, then reissue with a buffer of at least that many occtl_node_id_t entries.

The order follows the first root's OCCT vertex traversal order. Duplicate vertex uses are collapsed.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]node_aFirst root node.
[in]node_bSecond root node.
[out]out_bufBorrows it. May be NULL on the sizing call.
[in]capCapacity of out_buf in entries.
[out]out_countBorrows it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_NOT_FOUNDnode_a or node_b is invalid or removed.
OCCTL_BUFFER_TOO_SMALLout_buf is non-NULL and cap is too small.

\par Thread Safety No (may update OCCT internal caches).

See also
occtl_graph_descendant_vertices_get, occtl_topo_related_iter_create

◆ occtl_topo_connected_edges()

occtl_status_t occtl_topo_connected_edges ( const occtl_graph_t graph,
occtl_node_id_t  seed_edge,
occtl_node_id_t out_buf,
size_t  cap,
size_t *  out_count 
)

Lists all edges connected to seed_edge through shared vertices.

Two-call buffer (§10.1): pass out_buf as NULL with cap = 0 to learn the required count in out_count, then reissue with a buffer of at least that many occtl_node_id_t entries.

The seed edge is included in the result.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]seed_edgeEdge where the walk starts.
[out]out_bufBorrows it. May be NULL on the sizing call.
[in]capCapacity of out_buf in entries.
[out]out_countBorrows it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_NOT_FOUNDseed_edge is invalid or removed.
OCCTL_WRONG_KINDseed_edge is not an edge.
OCCTL_BUFFER_TOO_SMALLout_buf is non-NULL and cap is too small.

\par Thread Safety Yes (read-only on graph).

See also
occtl_topo_connected_faces, occtl_topo_common_vertices

◆ occtl_topo_connected_faces()

occtl_status_t occtl_topo_connected_faces ( const occtl_graph_t graph,
occtl_node_id_t  seed_face,
occtl_node_id_t out_buf,
size_t  cap,
size_t *  out_count 
)

Lists all faces connected to seed_face through shared edges.

Two-call buffer (§10.1): pass out_buf as NULL with cap = 0 to learn the required count in out_count, then reissue with a buffer of at least that many occtl_node_id_t entries.

The seed face is included in the result.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]seed_faceFace where the walk starts.
[out]out_bufBorrows it. May be NULL on the sizing call.
[in]capCapacity of out_buf in entries.
[out]out_countBorrows it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_NOT_FOUNDseed_face is invalid or removed.
OCCTL_WRONG_KINDseed_face is not a face.
OCCTL_BUFFER_TOO_SMALLout_buf is non-NULL and cap is too small.

\par Thread Safety Yes (read-only on graph).

See also
occtl_topo_connected_edges, occtl_topo_common_vertices

◆ occtl_topo_distance_pair()

Computes the closest-distance pair between two graph nodes.

The calculation is delegated to OCCT and returns the minimum distance, closest points, and best-effort support-node IDs for the first closest solution.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]node_aFirst node to query.
[in]node_bSecond node to query.
[out]out_pairBorrows it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_pair is NULL.
OCCTL_NOT_FOUNDnode_a or node_b is invalid or removed.
OCCTL_GEOMETRY_INVALIDOCCT could not compute a closest solution.

\par Thread Safety Yes (read-only on graph; may populate internal shape caches).

See also
occtl_topo_related_iter_create, occtl_graph_pair_distance_get

◆ occtl_topo_explorer_iter_free()

void occtl_topo_explorer_iter_free ( occtl_topo_explorer_iter_t iter)

Releases an explorer iterator.

Parameters
[in]iterOwns it. NULL is a no-op.

\par Thread Safety Yes.

See also
occtl_topo_explorer_iter_next

◆ occtl_topo_explorer_iter_next()

occtl_status_t occtl_topo_explorer_iter_next ( occtl_topo_explorer_iter_t iter,
occtl_node_id_t out_node,
occtl_transform_t out_transform,
occtl_orientation_t out_orientation 
)

Advances the explorer iterator to the next node.

Writes the current node's definition ID, accumulated transform, and accumulated orientation.

Parameters
[in,out]iterBorrows it. Must be non-NULL.
[out]out_nodeBorrows it. Must be non-NULL.
[out]out_transformBorrows it. Must be non-NULL.
[out]out_orientationBorrows it. Must be non-NULL.
Return values
OCCTL_OKNext value written.
OCCTL_NOT_FOUNDExhausted; out params set to invalid/identity.
OCCTL_INVALID_ARGUMENTAn out-param is NULL.

\par Thread Safety No (mutates iter; concurrent reads on distinct iters OK).

See also
occtl_topo_child_explorer_create, occtl_topo_parent_explorer_create, occtl_topo_explorer_iter_free

◆ occtl_topo_graph_distance()

occtl_status_t occtl_topo_graph_distance ( const occtl_graph_t graph,
occtl_node_id_t  root,
const occtl_node_id_t sources,
size_t  source_count,
occtl_node_id_t  target,
int32_t *  out_distance 
)

Computes same-kind topological graph distance under a shared root.

Distance is the minimum number of adjacency hops from any source node to target while walking only peers of the same kind reachable from root. Supported peer kinds are Vertex, Edge, Wire, Face, Shell, and Solid. Vertex/Edge/Wire peers connect through shared vertices; Face peers connect through shared edges; Shell/Solid peers connect through shared faces.

A source node has distance 0 from itself. If target is reachable from root but not connected to any source peer, the function succeeds and writes -1 to out_distance.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]rootRoot that defines the peer set. Must be active.
[in]sourcesBorrows it. Array of source nodes. Must be non-NULL and contain source_count entries.
[in]source_countNumber of entries in sources. Must be non-zero.
[in]targetTarget node. Must have the same kind as all sources.
[out]out_distanceBorrows it. Must be non-NULL. Receives the hop count, or -1 when unreachable within the peer graph.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph, sources, or out_distance is NULL, or source_count is zero.
OCCTL_NOT_FOUNDroot, target, or a source is invalid, removed, or not reachable from root.
OCCTL_WRONG_KINDSources and target are not the same kind, or the kind is not supported for this query.

\par Thread Safety No (may populate graph caches for descendant vertices).

See also
occtl_topo_connected_edges, occtl_topo_connected_faces, occtl_topo_common_vertices

◆ occtl_topo_intersection_iter_create()

occtl_status_t occtl_topo_intersection_iter_create ( occtl_graph_t graph,
occtl_node_id_t  node_a,
occtl_node_id_t  node_b,
const occtl_topo_relation_options_t options,
occtl_topo_intersection_iter_t **  out_iter 
)

Creates an iterator over topology generated by intersecting two graph nodes.

The calculation is delegated to OCCT section/common algorithms. Generated intersection topology is inserted into graph as fresh topology roots so returned NodeIds are meaningful in the caller's graph. Section edges and vertices are returned first. When options is NULL or include_overlaps is 1, an OCCT common result is also used to return overlap faces when the two inputs have area/volume overlap. The iterator is valid but empty when no requested intersection topology is produced.

Parameters
[in,out]graphBorrows it. Must be non-NULL.
[in]node_aFirst node to intersect.
[in]node_bSecond node to intersect.
[in]optionsBorrows it. May be NULL for defaults.
[out]out_iterOwns it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_iter is NULL, or options contains an invalid p_next, tolerance, or 0/1 flag.
OCCTL_VERSION_MISMATCHoptions has an unsupported struct_version.
OCCTL_NOT_FOUNDnode_a or node_b is invalid or removed.
OCCTL_GEOMETRY_INVALIDOCCT could not compute the intersection.
OCCTL_TOPOLOGY_INVALIDthe generated topology could not be inserted.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety No (may mutate graph by inserting generated topology).

See also
occtl_topo_intersection_iter_next, occtl_topo_intersection_iter_free, occtl_topo_touch_iter_create

◆ occtl_topo_intersection_iter_free()

void occtl_topo_intersection_iter_free ( occtl_topo_intersection_iter_t iter)

Releases an intersection iterator.

Parameters
[in]iterOwns it. May be NULL.

\par Thread Safety Yes.

See also
occtl_topo_intersection_iter_create

◆ occtl_topo_intersection_iter_next()

occtl_status_t occtl_topo_intersection_iter_next ( occtl_topo_intersection_iter_t iter,
occtl_node_id_t out_node 
)

Advances an intersection iterator.

Parameters
[in,out]iterBorrows it. Must be non-NULL.
[out]out_nodeBorrows it. Must be non-NULL.
Return values
OCCTL_OKNext generated node written.
OCCTL_NOT_FOUNDIterator exhausted.
OCCTL_INVALID_ARGUMENTiter or out_node is NULL.

\par Thread Safety No (mutates iterator).

See also
occtl_topo_intersection_iter_create, occtl_topo_intersection_iter_free

◆ occtl_topo_is_inside()

occtl_status_t occtl_topo_is_inside ( const occtl_graph_t graph,
occtl_node_id_t  solid,
occtl_point3_t  point,
double  tolerance,
int32_t  include_boundary,
int32_t *  out_is_inside 
)

Tests whether a 3D point is inside a solid node.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]solidSolid node to test.
[in]pointPoint to test.
[in]toleranceTolerance for boundary detection. Must be non-negative.
[in]include_boundary1 treats boundary points as inside; 0 does not.
[out]out_is_insideBorrows it. Receives 1 or 0. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_is_inside is NULL, tolerance is negative, or include_boundary is not 0 or 1.
OCCTL_NOT_FOUNDsolid is invalid or removed.
OCCTL_WRONG_KINDsolid is not a solid.

\par Thread Safety Yes (read-only on graph; may build classifier-local caches).

See also
occtl_topo_classify_point

◆ occtl_topo_is_same_geometry()

occtl_status_t occtl_topo_is_same_geometry ( const occtl_graph_t graph,
occtl_node_id_t  node_a,
occtl_node_id_t  node_b,
double  tolerance,
int32_t *  out_is_same_geometry 
)

Tests whether two edge or face nodes share the same geometric support.

This is a geometry predicate, not topological identity: two different bounded edges/faces may compare equal when OCCT reports coincident support within tolerance. Node kinds must match and must be Edge or Face.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]node_aFirst edge or face node.
[in]node_bSecond edge or face node.
[in]toleranceLinear tolerance. Must be non-negative.
[out]out_is_same_geometryBorrows it. Receives 1 for same geometry, 0 otherwise. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_is_same_geometry is NULL, or tolerance is negative/non-finite.
OCCTL_NOT_FOUNDnode_a or node_b is invalid or removed.
OCCTL_WRONG_KINDNodes are not both edges or both faces.

\par Thread Safety Yes (read-only on graph; may use local OCCT projection state).

See also
occtl_topo_distance_pair, occtl_topo_axis_intersect_faces

◆ occtl_topo_parent_explorer_config_init()

void occtl_topo_parent_explorer_config_init ( occtl_topo_parent_explorer_config_t config)

Initialises config to default values via OCCTL_TOPO_PARENT_EXPLORER_CONFIG_INIT.

NULL-tolerant.

Parameters
[out]configBorrows it. May be NULL (no-op).

\par Thread Safety Yes.

See also
occtl_topo_parent_explorer_create

◆ occtl_topo_parent_explorer_create()

occtl_status_t occtl_topo_parent_explorer_create ( const occtl_graph_t graph,
occtl_node_id_t  node,
const occtl_topo_parent_explorer_config_t config,
occtl_topo_explorer_iter_t **  out_iter 
)

Creates an upward parent explorer starting from node.

The explorer walks the reverse reference indices upward from the starting node, accumulating location and orientation along each parent chain.

Parameters
[in]graphMust be non-NULL.
[in]nodeStarting node ID.
[in]configBorrows it. May be NULL for defaults.
[out]out_iterOwns it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_iter is NULL, or config->p_next is non-NULL.
OCCTL_NOT_FOUNDnode is invalid or removed.
OCCTL_VERSION_MISMATCHconfig->struct_version unsupported.
OCCTL_OUT_OF_RANGEconfig->mode, config->target_kind, or config->avoid_kind is not valid.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety Yes (read-only on graph).

See also
occtl_topo_explorer_iter_next, occtl_topo_child_explorer_create

◆ occtl_topo_related_iter_create()

occtl_status_t occtl_topo_related_iter_create ( const occtl_graph_t graph,
occtl_node_id_t  node,
occtl_topo_related_iter_t **  out_iter 
)

Creates an iterator over the semantic neighbours of node.

Neighbours are definition IDs without accumulated location or orientation. Each yield includes a occtl_relation_kind_t that describes the semantic relationship.

Parameters
[in]graphMust be non-NULL.
[in]nodeNode to query neighbours for.
[out]out_iterOwns it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_iter is NULL.
OCCTL_NOT_FOUNDnode is invalid or removed.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety Yes (read-only on graph).

See also
occtl_topo_related_iter_next, occtl_topo_related_iter_free

◆ occtl_topo_related_iter_free()

void occtl_topo_related_iter_free ( occtl_topo_related_iter_t iter)

Releases a related-iterator.

Parameters
[in]iterOwns it. NULL is a no-op.

\par Thread Safety Yes.

See also
occtl_topo_related_iter_next

◆ occtl_topo_related_iter_next()

occtl_status_t occtl_topo_related_iter_next ( occtl_topo_related_iter_t iter,
occtl_node_id_t out_node,
occtl_relation_kind_t out_kind 
)

Advances the related-iterator to the next semantic neighbour.

Parameters
[in,out]iterBorrows it. Must be non-NULL.
[out]out_nodeBorrows it. Must be non-NULL.
[out]out_kindBorrows it. Must be non-NULL.
Return values
OCCTL_OKNext value written.
OCCTL_NOT_FOUNDExhausted; out params set to invalid.
OCCTL_INVALID_ARGUMENTAn out-param is NULL.

\par Thread Safety No (mutates iter; concurrent reads on distinct iters OK).

See also
occtl_topo_related_iter_create, occtl_topo_related_iter_free

◆ occtl_topo_relation_options_init()

void occtl_topo_relation_options_init ( occtl_topo_relation_options_t options)

Runtime initialiser for occtl_topo_relation_options_t.

Sets all fields to OCCTL_TOPO_RELATION_OPTIONS_INIT.

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

\par Thread Safety Yes.

See also
occtl_topo_touch_iter_create

◆ occtl_topo_touch_iter_create()

occtl_status_t occtl_topo_touch_iter_create ( const occtl_graph_t graph,
occtl_node_id_t  node_a,
occtl_node_id_t  node_b,
const occtl_topo_relation_options_t options,
occtl_topo_touch_iter_t **  out_iter 
)

Creates an iterator over contact solutions between two graph nodes.

The calculation is delegated to OCCT BRepExtrema_DistShapeShape. When the minimum distance is greater than the requested tolerance, the iterator is valid but empty. Results are original-graph support nodes plus the OCCT contact / closest points; the queried graph is not mutated.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]node_aFirst node to query.
[in]node_bSecond node to query.
[in]optionsBorrows it. May be NULL for defaults.
[out]out_iterOwns it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_iter is NULL, or options contains an invalid p_next, tolerance, or 0/1 flag.
OCCTL_VERSION_MISMATCHoptions has an unsupported struct_version.
OCCTL_NOT_FOUNDnode_a or node_b is invalid or removed.
OCCTL_GEOMETRY_INVALIDOCCT could not compute distance/contact solutions.
OCCTL_OUT_OF_MEMORYAllocation failed.

\par Thread Safety Yes (read-only on graph; may populate internal shape caches).

See also
occtl_topo_touch_iter_next, occtl_topo_touch_iter_free, occtl_topo_distance_pair

◆ occtl_topo_touch_iter_free()

void occtl_topo_touch_iter_free ( occtl_topo_touch_iter_t iter)

Releases a touch iterator.

Parameters
[in]iterOwns it. May be NULL.

\par Thread Safety Yes.

See also
occtl_topo_touch_iter_create

◆ occtl_topo_touch_iter_next()

occtl_status_t occtl_topo_touch_iter_next ( occtl_topo_touch_iter_t iter,
occtl_topo_touch_hit_t out_hit 
)

Advances a touch iterator.

Parameters
[in,out]iterBorrows it. Must be non-NULL.
[out]out_hitBorrows it. Must be non-NULL.
Return values
OCCTL_OKNext hit written.
OCCTL_NOT_FOUNDIterator exhausted.
OCCTL_INVALID_ARGUMENTiter or out_hit is NULL.

\par Thread Safety No (mutates iterator).

See also
occtl_topo_touch_iter_create, occtl_topo_touch_iter_free

◆ occtl_topo_wire_order_edges()

occtl_status_t occtl_topo_wire_order_edges ( const occtl_graph_t graph,
occtl_node_id_t  wire,
occtl_oriented_node_t out_buf,
size_t  cap,
size_t *  out_count 
)

Lists a wire's edges in endpoint-chaining order.

Two-call buffer (§10.1): pass out_buf as NULL with cap = 0 to learn the required count in out_count, then reissue with a buffer of at least that many occtl_oriented_node_t entries.

Each returned entry contains an Edge node ID and the coedge orientation of that edge inside wire. The order matches occtl_topo_wire_explorer_create.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]wireWire node ID.
[out]out_bufBorrows it. May be NULL on the sizing call.
[in]capCapacity of out_buf in entries.
[out]out_countBorrows it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or out_count is NULL.
OCCTL_NOT_FOUNDwire is invalid or removed.
OCCTL_WRONG_KINDwire is not a wire.
OCCTL_BUFFER_TOO_SMALLout_buf is non-NULL and cap is too small.

\par Thread Safety Yes (read-only on graph).

See also
occtl_topo_wire_explorer_create, occtl_topo_make_wire