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

OCCT-Light: boolean operations module public API. More...

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

Go to the source code of this file.

Classes

struct  occtl_bool_options
 

Macros

#define OCCTL_BOOL_OPTIONS_VERSION_1   1u
 
#define OCCTL_BOOL_OPTIONS_INIT   {OCCTL_BOOL_OPTIONS_VERSION_1, NULL, 0.0, 0, 0, 1.0e-2, 1}
 

Typedefs

typedef struct occtl_bool_options occtl_bool_options_t
 

Functions

void occtl_bool_options_init (occtl_bool_options_t *options)
 
occtl_status_t occtl_bool_fuse (occtl_graph_t *graph, const occtl_node_id_t *objects, size_t n_objects, const occtl_node_id_t *tools, size_t n_tools, const occtl_bool_options_t *opts, occtl_node_id_t *out_root)
 
occtl_status_t occtl_bool_cut (occtl_graph_t *graph, const occtl_node_id_t *objects, size_t n_objects, const occtl_node_id_t *tools, size_t n_tools, const occtl_bool_options_t *opts, occtl_node_id_t *out_root)
 
occtl_status_t occtl_bool_common (occtl_graph_t *graph, const occtl_node_id_t *objects, size_t n_objects, const occtl_node_id_t *tools, size_t n_tools, const occtl_bool_options_t *opts, occtl_node_id_t *out_root)
 
occtl_status_t occtl_bool_section (occtl_graph_t *graph, const occtl_node_id_t *objects, size_t n_objects, const occtl_node_id_t *tools, size_t n_tools, const occtl_bool_options_t *opts, occtl_node_id_t *out_root)
 
occtl_status_t occtl_bool_split (occtl_graph_t *graph, const occtl_node_id_t *objects, size_t n_objects, const occtl_node_id_t *tools, size_t n_tools, const occtl_bool_options_t *opts, occtl_node_id_t *out_root)
 

Detailed Description

OCCT-Light: boolean operations module public API.

Five operations:

  • Fuse (union of two argument groups)
  • Cut (subtraction of tools from objects)
  • Common (intersection of two argument groups)
  • Section (intersection edges/vertices of all arguments)
  • Split (splits objects using tools as cutters)

Every entry point takes a single occtl_graph_t* in which the inputs already live, runs the operation, and merges the result back into that same graph as a new topology root. The result root's NodeId is returned in out_root. Input NodeIds remain valid and continue to refer to the originating subgraph; the operation does not mutate them.

When opts->build_history is non-zero, per-input Modified / Generated / Deleted mappings are recorded on graph and queried with occtl_graph_history_modified, occtl_graph_history_generated, and occtl_graph_history_deleted_all.

Macro Definition Documentation

◆ OCCTL_BOOL_OPTIONS_INIT

#define OCCTL_BOOL_OPTIONS_INIT   {OCCTL_BOOL_OPTIONS_VERSION_1, NULL, 0.0, 0, 0, 1.0e-2, 1}

Static initialiser for occtl_bool_options_t. Suitable for

#define OCCTL_BOOL_OPTIONS_INIT
Definition occtl_bool.h:82
Definition occtl_bool.h:67

◆ OCCTL_BOOL_OPTIONS_VERSION_1

#define OCCTL_BOOL_OPTIONS_VERSION_1   1u

Current options struct version. Bumped only on a binary-incompatible change. New fields are appended via p_next-chained extension structs.

Typedef Documentation

◆ occtl_bool_options_t

Tunable parameters shared by all five boolean operations.

Defaults (see OCCTL_BOOL_OPTIONS_INIT and occtl_bool_options_init) are the conservative ones: no fuzzy tolerance override, single-threaded execution, no post-op simplification, history collection enabled.

Function Documentation

◆ occtl_bool_common()

occtl_status_t occtl_bool_common ( occtl_graph_t graph,
const occtl_node_id_t objects,
size_t  n_objects,
const occtl_node_id_t tools,
size_t  n_tools,
const occtl_bool_options_t opts,
occtl_node_id_t out_root 
)

Boolean Common (intersection) of two argument groups.

Arguments may have any dimension; the result has the minimum dimension among the inputs.

Parameters and return codes mirror occtl_bool_fuse.

Parameters
[in,out]graphSee occtl_bool_fuse.
[in]objectsSee occtl_bool_fuse.
[in]n_objectsSee occtl_bool_fuse.
[in]toolsSee occtl_bool_fuse.
[in]n_toolsSee occtl_bool_fuse.
[in]optsSee occtl_bool_fuse.
[out]out_rootSee occtl_bool_fuse.

\par Thread Safety No.

See also
occtl_bool_fuse

◆ occtl_bool_cut()

occtl_status_t occtl_bool_cut ( occtl_graph_t graph,
const occtl_node_id_t objects,
size_t  n_objects,
const occtl_node_id_t tools,
size_t  n_tools,
const occtl_bool_options_t opts,
occtl_node_id_t out_root 
)

Boolean Cut (objects minus tools).

The result has the dimension of the objects: tools must have dimension not less than the maximum dimension of the objects.

Parameters and return codes mirror occtl_bool_fuse.

Parameters
[in,out]graphSee occtl_bool_fuse.
[in]objectsSee occtl_bool_fuse.
[in]n_objectsSee occtl_bool_fuse.
[in]toolsSee occtl_bool_fuse.
[in]n_toolsSee occtl_bool_fuse.
[in]optsSee occtl_bool_fuse.
[out]out_rootSee occtl_bool_fuse.

\par Thread Safety No.

See also
occtl_bool_fuse

◆ occtl_bool_fuse()

occtl_status_t occtl_bool_fuse ( occtl_graph_t graph,
const occtl_node_id_t objects,
size_t  n_objects,
const occtl_node_id_t tools,
size_t  n_tools,
const occtl_bool_options_t opts,
occtl_node_id_t out_root 
)

Boolean Fuse (union) of two argument groups.

Both groups must hold entities of equal dimension. The result is added to graph as a single new topology root.

Parameters
[in,out]graphBorrows it. Must be non-NULL. Mutated: receives the new topology merged in.
[in]objectsBorrows it. Array of n_objects input NodeIds that already live in graph. Must be non-NULL when n_objects > 0.
[in]n_objectsNumber of object inputs. Must be >= 1.
[in]toolsBorrows it. Array of n_tools input NodeIds.
[in]n_toolsNumber of tool inputs. Must be >= 1.
[in]optsBorrows it. Must be non-NULL with a recognised struct_version.
[out]out_rootBorrows it. Must be non-NULL. On success receives the result topology root NodeId.
Return values
OCCTL_OKSuccess.
OCCTL_INVALID_ARGUMENTRequired pointer is NULL; n_objects or n_tools is 0; options flags are not 0/1; opts->p_next is non-NULL; or numeric options are out of range / non-finite.
OCCTL_VERSION_MISMATCHstruct_version is unrecognised.
OCCTL_NOT_FOUNDAn input NodeId is invalid or removed.
OCCTL_GEOMETRY_INVALIDThe boolean algorithm failed to produce a valid result (e.g. the input dimensions were incompatible).
OCCTL_TOPOLOGY_INVALIDThe result topology was rejected.
OCCTL_INTERNALAn unexpected internal error occurred.

\par Thread Safety No — mutates graph.

See also
occtl_bool_cut, occtl_bool_common, occtl_graph_history_modified

◆ occtl_bool_options_init()

void occtl_bool_options_init ( occtl_bool_options_t options)

Runtime initialiser for occtl_bool_options_t.

Sets all fields to OCCTL_BOOL_OPTIONS_INIT.

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

\par Thread Safety Yes.

See also
occtl_bool_fuse

◆ occtl_bool_section()

occtl_status_t occtl_bool_section ( occtl_graph_t graph,
const occtl_node_id_t objects,
size_t  n_objects,
const occtl_node_id_t tools,
size_t  n_tools,
const occtl_bool_options_t opts,
occtl_node_id_t out_root 
)

Boolean Section: the intersection edges and vertices of all arguments.

Arguments may be of any type. The result is typically a Compound of edges (and possibly vertices) added to graph as a single root.

Parameters and return codes mirror occtl_bool_fuse.

Parameters
[in,out]graphSee occtl_bool_fuse.
[in]objectsSee occtl_bool_fuse.
[in]n_objectsSee occtl_bool_fuse.
[in]toolsSee occtl_bool_fuse.
[in]n_toolsSee occtl_bool_fuse.
[in]optsSee occtl_bool_fuse.
[out]out_rootSee occtl_bool_fuse.

\par Thread Safety No.

See also
occtl_bool_fuse

◆ occtl_bool_split()

occtl_status_t occtl_bool_split ( occtl_graph_t graph,
const occtl_node_id_t objects,
size_t  n_objects,
const occtl_node_id_t tools,
size_t  n_tools,
const occtl_bool_options_t opts,
occtl_node_id_t out_root 
)

Boolean Split: split each object using the tools as cutters.

Tools contribute nothing to the result body; they merely partition the objects. The result is a Compound of the partitions, added as a single new topology root.

Parameters and return codes mirror occtl_bool_fuse.

Parameters
[in,out]graphSee occtl_bool_fuse.
[in]objectsSee occtl_bool_fuse.
[in]n_objectsSee occtl_bool_fuse.
[in]toolsSee occtl_bool_fuse.
[in]n_toolsSee occtl_bool_fuse.
[in]optsSee occtl_bool_fuse.
[out]out_rootSee occtl_bool_fuse.

\par Thread Safety No.

See also
occtl_bool_fuse