ReconstructMe SDK
2.6.43-0
Real-time 3D reconstruction engine
|
Constructive Solid Geometry operations. More...
Typedefs | |
typedef int | reme_csg_t |
Handle referencing a CSG object. More... | |
typedef enum _reme_set_operation_t | reme_set_operation_t |
Enumeration of available CSG set operations. More... | |
Enumerations | |
enum | _reme_set_operation_t { REME_SET_UNION, REME_SET_SUBTRACTION, REME_SET_INTERSECTION } |
Enumeration of available CSG set operations. More... | |
reme_error_t | reme_csg_create (reme_context_t c, reme_volume_t v, reme_csg_t *csg) |
Create a new CSG module for performing boolean set operations. More... | |
reme_error_t | reme_csg_destroy (reme_context_t c, reme_csg_t *csg) |
Destroy a previously created CSG object. More... | |
reme_error_t | reme_csg_update_with_spheres (reme_context_t c, reme_csg_t csg, reme_set_operation_t op, const float *spheres, int numspheres) |
Perform boolean set operation on the volume and one or more spheres. More... | |
reme_error_t | reme_csg_update_with_boxes (reme_context_t c, reme_csg_t csg, reme_set_operation_t op, const float *boxes, int numboxes) |
Perform boolean set operation on the volume and one or more boxes. More... | |
reme_error_t | reme_csg_update_with_planes (reme_context_t c, reme_csg_t csg, reme_set_operation_t op, const float *planes, int numplanes) |
Perform boolean set operation on the volume and one or more planes. More... | |
reme_error_t | reme_csg_update_with_surface (reme_context_t c, reme_csg_t csg, reme_set_operation_t op, reme_surface_t s) |
Perform boolean set operation on the volume and a freeform solid mesh. More... | |
reme_error_t | reme_csg_close_volume_borders (reme_context_t c, reme_csg_t csg) |
Make sure that volume borders are closed. More... | |
Constructive Solid Geometry operations.
The CSG module is able to create complex watertight surfaces by combining solid objects using the following Boolean set operations: union, intersection and subtraction. The CSG module works directly on the reconstruction volume and can thus be used to post-process the reconstruction in many ways (e.g. cut the model, add a stand).
The following images show the supported Boolean set operations by the reme_csg_t module applied to box and a sphere primitive.
Currently, the CSG module supports two types of solid objects to work with. First, you can work with primitive objects such as spheres, boxes and planes. Besides that, you can also use closed free-form surfaces.
To use the CSG module, you would first create a new one.
Since the CSG module works on concrete reconstruction volume, you need to pass one when you construct it.
Next, you would start to model using primitives or free-form closed surfaces. For example the images from the section above were created using the following two primitives
To merge (union) both primitives the CSG module is used in the following way
Subtraction is done by
And finally, intersection can be accomplished by
Once you are done with the CSG module you can extract the surface from the volume as always using reme_surface_t.
The entire example can be found in example_reconstructmesdk_csg.cpp For a more complex example involving the reconstruction itself see example_reconstructmesdk_bust.cpp
typedef int reme_csg_t |
Handle referencing a CSG object.
The CSG object allows you to modify the reconstruction content by applying set operations on solids.
typedef enum _reme_set_operation_t reme_set_operation_t |
Enumeration of available CSG set operations.
The CSG module updates the content of the reconstruction volume by performing a binary set operation on it. The left hand side of the operation is the content of the volume. The right hand side is one of the available solids. The reme_set_operation_t defines the operation to apply. The result of the operation is an updated volume content.
Enumeration of available CSG set operations.
The CSG module updates the content of the reconstruction volume by performing a binary set operation on it. The left hand side of the operation is the content of the volume. The right hand side is one of the available solids. The reme_set_operation_t defines the operation to apply. The result of the operation is an updated volume content.
reme_error_t reme_csg_create | ( | reme_context_t | c, |
reme_volume_t | v, | ||
reme_csg_t * | csg | ||
) |
Create a new CSG module for performing boolean set operations.
c | A valid context object |
v | A valid volume object to work on |
csg | A pointer to receive the created CSG object handle. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_csg_destroy | ( | reme_context_t | c, |
reme_csg_t * | csg | ||
) |
Destroy a previously created CSG object.
c | A pointer to a valid context object |
csg | A mutable pointer to a valid CSG handle to destroy |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_csg_update_with_spheres | ( | reme_context_t | c, |
reme_csg_t | csg, | ||
reme_set_operation_t | op, | ||
const float * | spheres, | ||
int | numspheres | ||
) |
Perform boolean set operation on the volume and one or more spheres.
Update the content of the volume by applying a boolean set operation with one ore more spheres. Each sphere is represented by four coordinates: its center (cx, cy, cz) and its radius (r). The spheres are are assumed to be stored in a single consecutive array in the following format cx cy cz r cx cy cz r ...
.
c | A valid context object. |
csg | A valid CSG object. |
op | Set operation to apply. |
spheres | Sphere data array. |
numspheres | Number of spheres in array. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_csg_update_with_boxes | ( | reme_context_t | c, |
reme_csg_t | csg, | ||
reme_set_operation_t | op, | ||
const float * | boxes, | ||
int | numboxes | ||
) |
Perform boolean set operation on the volume and one or more boxes.
Update the content of the volume by applying a boolean set operation with one ore more axis aligned boxes. Each box is represented by six coordinates: its minimum corner (minx, miny, minz) and maximum corner (maxx, maxy, maxz). The boxes are are assumed to be stored in a single consecutive array in the following format minx miny minz maxx maxy maxz minx miny minz maxx maxy maxz ...
.
c | A valid context object. |
csg | A valid CSG object. |
op | Set operation to apply. |
boxes | Box data array. |
numboxes | Number of boxes in array. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_csg_update_with_planes | ( | reme_context_t | c, |
reme_csg_t | csg, | ||
reme_set_operation_t | op, | ||
const float * | planes, | ||
int | numplanes | ||
) |
Perform boolean set operation on the volume and one or more planes.
Update the content of the volume by applying a boolean set operation with one ore more planes. Each plane is represented in Hessian normal form using four coordinates: its unit-length normal vector (nx, ny, nz) and its signed distance from the origin (d). The planes are are assumed to be stored in a single consecutive array in the following format nx ny nz d nx ny nz d ...
.
c | A valid context object. |
csg | A valid CSG object. |
op | Set operation to apply. |
planes | Plane data array. |
numplanes | Number of planes in array. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_csg_update_with_surface | ( | reme_context_t | c, |
reme_csg_t | csg, | ||
reme_set_operation_t | op, | ||
reme_surface_t | s | ||
) |
Perform boolean set operation on the volume and a freeform solid mesh.
Update the content of the volume by applying a boolean set operation with a freeform solid mesh. The surface needs to be a closed manifold triangular mesh.
c | A valid context object. |
csg | A valid CSG object. |
op | Set operation to apply. |
s | A valid surface handle. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_csg_close_volume_borders | ( | reme_context_t | c, |
reme_csg_t | csg | ||
) |
Make sure that volume borders are closed.
Due to the way the surface is extracted from the reconstruction volume, objects sticking out of the volume might not be closed. This method will ensure that all unclosed objects are filled watertight on volume borders through a planar solid.
c | A valid context object. |
csg | A valid CSG object. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |