LibCapy - sdfcsg

Sdf class.

Macros:

Maximum number of transformation per SdfShape

Enumerations:

Types of transformation applied to a CapySdfShape or CapySdfCsg

Type of shape

Indices of shape parameters

Typedefs:

Predeclaration of CapySdf

Struct CapySdfTransform :

Struct CapySdfTransform's properties:

Type of the transformation

Transformation's values. For translate, the 3 first values are used. For scale the first value is used. For rotation, the 4 values are the quaternion values (x,y,z and theta). For extrusion, the first value is used (distance from origin along z axis)

Struct CapySdfTransform's methods:

None.

Struct CapyRayMarchingRes :

Struct CapyRayMarchingRes's properties:

Flag to memorise if the ray intersects the shape

Flag to memorise if the ray marching reached the maximum number of steps

Reference to the shape of the nearest intersection

Distance from the ray origin to the intersection

Shortest observed signed distance between the ray and a shape during the steps of ray marching

Coordinates of the intersection in world coordinate system

Coordinates of the intersection in the shape local coordinate system

Normal at the intersection in world coordinate system

Struct CapyRayMarchingRes's methods:

None.

Functions:

Getter and setter for the epsilon value

Getter and setter for the maximum number of step (to avoid infinite loop) during ray marching.

Create a CapySdf (by defaut a unit box)

Output and side effect(s):

Return a CapySdf

Allocate memory for a new CapySdf and create it (by defaut a unit box)

Output and side effect(s):

Return a CapySdf

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapySdf* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapySdf to free

Create a CapySdf for a box of given dimensions Inputs: width: width of the box (x axis) height: height of the box (y axis) depth: depth of the box (z axis)

Output and side effect(s):

Return a CapySdf

Allocate memory for a new CapySdf for a box of given dimensions and create it Inputs: width: width of the box (x axis) height: height of the box (y axis) depth: depth of the box (z axis)

Output and side effect(s):

Return a CapySdf

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for a plane Inputs: norm: normal of the plane (toward the 'out' side of the plane) dist: distance from the origin in the direction of the normal

Output and side effect(s):

Return a CapySdf

Allocate memory for a new CapySdf for a plane and create it Inputs: norm: normal of the plane (toward the 'out' side of the plane) dist: distance from the origin in the direction of the normal

Output and side effect(s):

Return a CapySdf

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for a sphere of given dimensions Inputs: radius: radius of the sphere

Output and side effect(s):

Return a CapySdf

Allocate memory for a new CapySdf for a sphere of given dimensions and create it Inputs: radius: radius of the sphere

Output and side effect(s):

Return a CapySdf

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for a cone (center at the origin, rotation axis along the y axis, top toward +y) of given dimensions and create it Inputs: radius: radius of the sphere

Output and side effect(s):

Return a CapySdf

Allocate memory for a new CapySdf for a cone (center at the origin, rotation axis along the y axis, top toward +y) of given dimensions and create it Inputs: baseRadius: radius of the cone at

Output and side effect(s):

Return a CapySdf

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for an ellipsoid of given dimensions (aligned with x, y,z axis) Inputs: radiusX: radius of the ellipsoid along the x axis radiusY: radius of the ellipsoid along the y axis radiusZ: radius of the ellipsoid along the z axis

Output and side effect(s):

Return a CapySdf

Allocate memory for a new CapySdf for an ellipsoid of given dimensions (aligned with x, y,z axis) and create it Inputs: radiusX: radius of the ellipsoid along the x axis radiusY: radius of the ellipsoid along the y axis radiusZ: radius of the ellipsoid along the z axis

Output and side effect(s):

Return a CapySdf

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for a torus of given dimensions (in xz plane) Inputs: majorRadius: major radius of the torus minorRadius: minor radius of the torus

Output and side effect(s):

Return a CapySdf

Create a CapySdf for a capsule (aligned with y axis) of given dimensions Inputs: radius: radius of the capsule length: length of the capsule

Output and side effect(s):

Return a CapySdf

Allocate memory for a new CapySdf for a capsule (aligned with y axis) of given dimensions and create it Inputs: radius: radius of the capsule length: length of the capsule

Output and side effect(s):

Return a CapySdf

Exception(s):

May raise CapyExc_MallocFailed.

Allocate memory for a new CapySdf for a torus of given dimensions (in xz plane) and create it Inputs: majorRadius: major radius of the torus minorRadius: minor radius of the torus

Output and side effect(s):

Return a CapySdf

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for a merge of two shapes Inputs: shapeA: the first shape shapeB: the second shape

Output and side effect(s):

Return a CapySdf. Component shapes can't be shared with between several CSG, they must be dynamically allocated, and they are free-d by their parent.

Allocate memory for a new CapySdf for a merge of two shapes and create it Inputs: shapeA: the first shape shapeB: the second shape

Output and side effect(s):

Return a CapySdf. Component shapes can't be shared with between several CSG, they must be dynamically allocated, and they are free-d by their parent.

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for an union of two shapes Inputs: shapeA: the first shape shapeB: the second shape

Output and side effect(s):

Return a CapySdf. Component shapes can't be shared with between several CSG, they must be dynamically allocated, and they are free-d by their parent.

Allocate memory for a new CapySdf for an union of two shapes and create it Inputs: shapeA: the first shape shapeB: the second shape

Output and side effect(s):

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for an intersection of two shapes Inputs: shapeA: the first shape shapeB: the second shape

Output and side effect(s):

Allocate memory for a new CapySdf for an intersection of two shapes and create it Inputs: shapeA: the first shape shapeB: the second shape

Output and side effect(s):

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for a difference of two shapes Inputs: shapeA: the first shape shapeB: the second shape

Output and side effect(s):

Allocate memory for a new CapySdf for a difference of two shapes and create it Inputs: shapeA: the first shape shapeB: the second shape

Output and side effect(s):

Exception(s):

May raise CapyExc_MallocFailed.

Create a CapySdf for a user defined distance field Inputs: sdf: the user defined signed distance field (canonical shape untransformed, taking a reference to the shape and a position in local coordinate system)

Output and side effect(s):

Return a CapySdf.

Allocate memory for a new CapySdf for a user defined distance field and create it Inputs: sdf: the user defined signed distance field (canonical shape untransformed, taking a reference to the shape and a position in local coordinate system)

Output and side effect(s):

Return a CapySdf.

Exception(s):

May raise CapyExc_MallocFailed.