OCC.Voxel module¶
Data structuire and visualization engine for voxel modeling.
-
class
Handle_Voxel_Prs
(*args)¶ Bases:
OCC.AIS.Handle_AIS_InteractiveObject
-
static
DownCast
()¶
-
GetObject
()¶
-
IsNull
()¶
-
Nullify
()¶
-
thisown
¶ The membership flag
-
static
-
class
SwigPyIterator
(*args, **kwargs)¶ Bases:
object
-
advance
()¶
-
copy
()¶
-
decr
()¶
-
distance
()¶
-
equal
()¶
-
incr
()¶
-
next
()¶
-
previous
()¶
-
thisown
¶ The membership flag
-
value
()¶
-
-
class
Voxel_BoolDS
(*args)¶ Bases:
OCC.Voxel.Voxel_DS
- An empty constructor.
Return type: None - A constructor initializing the voxel model. (x, y, z) - the start point of the box. (x_len, y_len, z_len) - lengths in x, y and z directions along axes of a co-ordinate system. (nb_x, nb_y, nb_z) - number of splits (voxels) along x, y and z directions.
Parameters: Return type: -
Get
()¶ - Returns the value of voxel with co-ordinates (ix, iy, iz).
Parameters: Return type:
-
Set
()¶ - Defines a value for voxel with co-ordinates (ix, iy, iz). Initial state of the model is so that all voxels have value 0 (false), and this data doesn’t occupy memory. Memory for data is allocating during setting non-zero values (true).
Parameters: Return type:
-
thisown
¶ The membership flag
-
class
Voxel_BooleanOperation
(*args)¶ Bases:
object
- An empty constructor.
Return type: None -
Cut
()¶ - Cuts two cubes of voxels. It modifies the first cube of voxels. It returns false in case of different dimension of the cube, different number of voxels.
Parameters: - theVoxels1 (Voxel_BoolDS &) –
- theVoxels2 (Voxel_BoolDS &) –
Return type: - Cuts two cubes of voxels. It modifies the first cube of voxels. It returns false in case of different dimension of the cube, different number of voxels. It subtracts the value of corresponding voxels and puts the result to theVoxels1.
Parameters: - theVoxels1 (Voxel_ColorDS &) –
- theVoxels2 (Voxel_ColorDS &) –
Return type: - Cuts two cubes of voxels. It modifies the first cube of voxels. It returns false in case of different dimension of the cube, different number of voxels. It subtracts the value of corresponding voxels and puts the result to theVoxels1.
Parameters: - theVoxels1 (Voxel_FloatDS &) –
- theVoxels2 (Voxel_FloatDS &) –
Return type:
-
Fuse
()¶ - Fuses two cubes of voxels. It modifies the first cube of voxels. It returns false in case of different dimension of the cube, different number of voxels.
Parameters: - theVoxels1 (Voxel_BoolDS &) –
- theVoxels2 (Voxel_BoolDS &) –
Return type: - Fuses two cubes of voxels. It modifies the first cube of voxels. It returns false in case of different dimension of the cube, different number of voxels. It summerizes the value of corresponding voxels and puts the result to theVoxels1. If the result exceeds 15 or becomes greater, it keeps 15.
Parameters: - theVoxels1 (Voxel_ColorDS &) –
- theVoxels2 (Voxel_ColorDS &) –
Return type: - Fuses two cubes of voxels. It modifies the first cube of voxels. It returns false in case of different dimension of the cube, different number of voxels. It summerizes the value of corresponding voxels and puts the result to theVoxels1.
Parameters: - theVoxels1 (Voxel_FloatDS &) –
- theVoxels2 (Voxel_FloatDS &) –
Return type:
-
thisown
¶ The membership flag
-
class
Voxel_CollisionDetection
(*args)¶ Bases:
object
- An empty constructor.
Return type: None - A constructor. It defines deflection of triangulation for the shapes. As lower the deflection is, as proper the triangulation is generated. Also, it defines number of splits along X, Y and Z axes for generation of voxels. As greater the numbers are, as greater number of voxels is used for detection of collision.
Parameters: Return type: -
AddShape
()¶ - Adds a shape. Returns an index of the shape.
Parameters: shape (TopoDS_Shape &) – Return type: int
-
Compute
()¶ - Computes the collisions. This method may be called many times if, for example, the shapes are being moved.
Return type: bool
-
GetCollisions
()¶ - Returns the collided voxels.
Return type: Voxel_BoolDS
-
KeepCollisions
()¶ - Doesn’t clean the collision points on new call to the method Compute(). It allows to see the collisions for a moving shape.
Parameters: keep (bool) – Return type: None
-
ReplaceShape
()¶ - Replaces a shape by another one. <ishape> is an index of the shape. This method is useful for moving shape, for example.
Parameters: - ishape (int) –
- shape (TopoDS_Shape &) –
Return type:
-
SetBoundaryBox
()¶ - Defines a user-defined boundary box for generation of voxels. If this method is not called, the algorithm calculates the boundary box itself.
Parameters: box (Bnd_Box &) – Return type: None
-
SetDeflection
()¶ - Defines the deflection of triangulation of shapes.
Parameters: deflection (float) – Return type: None
-
SetNbVoxels
()¶ - Defines the number of voxels along X, Y and Z axes.
Parameters: Return type:
-
SetUsageOfVolume
()¶ - Defines usage of volume of shapes in collision detection algorithm. Beware, usage of volume a little bit decreases the speed of algorithm.
Parameters: usage (bool) – Return type: None
-
Voxelize
()¶ - Prepares data for computation of collisions. It checks the inner parameters (number of voxels along X, Y and Z axes) and voxelizes the shapes. If the shape is not changed since the last call to this method, this method may be not called for this shape. <ishape> - is the index of the shape for processing by this method. If it is equal to -1, all shapes will be processed.
Parameters: ishape (int) – default value is -1 Return type: bool
-
thisown
¶ The membership flag
-
class
Voxel_ColorDS
(*args)¶ Bases:
OCC.Voxel.Voxel_DS
- An empty constructor.
Return type: None - A constructor initializing the voxel model. (x, y, z) - the start point of the box. (x_len, y_len, z_len) - lengths in x, y and z directions along axes of a co-ordinate system. (nb_x, nb_y, nb_z) - number of splits (voxels) along x, y and z directions.
Parameters: Return type: -
Get
()¶ - Returns the value of voxel with co-ordinates (ix, iy, iz).
Parameters: Return type: Standard_Byte
-
Set
()¶ - Defines a value for voxel with co-ordinates (ix, iy, iz). Only the first four bits are used! Initial state of the model is so that all voxels have value 0x0000, and this data doesn’t occupy memory. Memory for data is allocating during setting non-zero values (0x0101, for example).
Parameters: Return type:
-
thisown
¶ The membership flag
-
class
Voxel_DS
(*args)¶ Bases:
object
- An empty constructor.
Return type: None - A constructor initializing the voxel model. (x, y, z) - the start point of the box. (x_len, y_len, z_len) - lengths in x, y and z directions along axes of a co-ordinate system. (nb_x, nb_y, nb_z) - number of splits (voxels) along x, y and z directions.
Parameters: Return type: -
GetCenter
()¶ - Returns the center point of a voxel with co-ordinates (ix, iy, iz).
Parameters: Return type:
-
GetOrigin
()¶ - Returns the origin point of a voxel with co-ordinates (ix, iy, iz).
Parameters: Return type:
-
GetVoxel
()¶ - Finds a voxel corresponding to a 3D point. Returns true if it is found.
Parameters: Return type:
-
GetVoxelX
()¶ - Returns x-index of a voxel corresponding to x-coordinate.
Parameters: - x (float) –
- ix (int &) –
Return type:
-
GetVoxelY
()¶ - Returns y-index of a voxel corresponding to y-coordinate.
Parameters: - y (float) –
- iy (int &) –
Return type:
-
GetVoxelZ
()¶ - Returns z-index of a voxel corresponding to z-coordinate.
Parameters: - z (float) –
- iz (int &) –
Return type:
-
Init
()¶ - Initialization of the voxel model. (x, y, z) - the start point of the box. (x_len, y_len, z_len) - lengths in x, y and z directions along axes of a co-ordinate system. (nb_x, nb_y, nb_z) - number of splits (voxels) along x, y and z directions. The methods below return initial data of the voxel model.
Parameters: Return type: void
-
thisown
¶ The membership flag
-
class
Voxel_FastConverter
(*args)¶ Bases:
object
- A constructor for conversion of a shape into a cube of boolean voxels. It allocates the voxels in memory. ‘nbthreads’ defines the number of threads used to convert the shape.
Parameters: Return type: - A constructor for conversion of a shape into a cube of colored voxels. It allocates the voxels in memory. ‘nbthreads’ defines the number of threads used to convert the shape.
Parameters: Return type: - A constructor for conversion of a shape into a cube of boolean voxels split into 8 sub-voxels recursively. It allocates the voxels in memory. ‘nbthreads’ defines the number of threads used to convert the shape.
Parameters: Return type: -
Convert
()¶ - Converts a shape into a voxel representation. It sets to 0 the outside volume of the shape and 1 for surfacic part of the shape. ‘ithread’ is the index of the thread for current call of ::Convert(). Start numeration of ‘ithread’ with 1, please.
Parameters: - progress (int &) –
- ithread (int) – default value is 1
Return type:
-
ConvertUsingSAT
()¶ - Converts a shape into a voxel representation using separating axis theorem. It sets to 0 the outside volume of the shape and 1 for surfacic part of the shape. ‘ithread’ is the index of the thread for current call of ::Convert(). Start numeration of ‘ithread’ with 1, please.
Parameters: - progress (int &) –
- ithread (int) – default value is 1
Return type:
-
FillInVolume
()¶ - Fills-in volume of the shape by a value.
Parameters: - inner (Standard_Byte) –
- ithread (int) – default value is 1
Return type: - Fills-in volume of the shape by a value. Uses the topological information from the provided shape to judge whether points are inside the shape or not (only when processing vertical faces). The inner value has to be positive.
Parameters: - inner (Standard_Byte) –
- shape (TopoDS_Shape &) –
- ithread (int) – default value is 1
Return type:
-
thisown
¶ The membership flag
-
class
Voxel_FloatDS
(*args)¶ Bases:
OCC.Voxel.Voxel_DS
- An empty constructor.
Return type: None - A constructor initializing the voxel model. (x, y, z) - the start point of the box. (x_len, y_len, z_len) - lengths in x, y and z directions along axes of a co-ordinate system. (nb_x, nb_y, nb_z) - number of splits (voxels) along x, y and z directions.
Parameters: Return type: -
Get
()¶ - Returns the value of voxel with co-ordinates (ix, iy, iz).
Parameters: Return type: Standard_ShortReal
-
Set
()¶ - Defines a value for voxel with co-ordinates (ix, iy, iz). Initial state of the model is so that all voxels have value 0.0f, and this data doesn’t occupy memory. Memory for data is allocating during setting non-zero values.
Parameters: Return type:
-
thisown
¶ The membership flag
-
class
Voxel_OctBoolDS
(*args)¶ Bases:
OCC.Voxel.Voxel_DS
- An empty constructor.
Return type: None - A constructor initializing the voxel model. (x, y, z) - the start point of the box. (x_len, y_len, z_len) - lengths in x, y and z directions along axes of a co-ordinate system. (nb_x, nb_y, nb_z) - number of splits (voxels) along x, y and z directions.
Parameters: Return type: -
Get
()¶ - Returns the value of voxel with co-ordinates (ix, iy, iz). Warning!: the returned value may not coincide with the value of its 8 sub-voxels. Use the method ::IsSplit() to check whether a voxel has sub-voxels.
Parameters: Return type: - Returns the value of a sub-voxel of a voxel with co-ordinates (ix, iy, iz). If the voxel is not split, it returns the value of the voxel. Range of sub-voxels is 0 - 7.
Parameters: Return type:
-
IsSplit
()¶ - Returns true if the voxel is split into 8 sub-voxels.
Parameters: Return type:
-
OptimizeMemory
()¶ - The method searches voxels with equal-value of sub-voxels and removes them (remaining the value for the voxel).
Return type: None
-
Set
()¶ - Defines a value for voxel with co-ordinates (ix, iy, iz). If the voxel is split into 8 sub-voxels, the split disappears. Initial state of the model is so that all voxels have value 0 (false), and this data doesn’t occupy memory. Memory for data is allocating during setting non-zero values (true).
Parameters: Return type: - Defines a value for a sub-voxel of a voxel with co-ordinates (ix, iy, iz). If the voxel is not split into 8 sub-voxels yet, this method splits the voxel. Range of sub-voxels is 0 - 7.
Parameters: Return type:
-
thisown
¶ The membership flag
-
class
Voxel_Prs
(*args)¶ Bases:
OCC.AIS.AIS_InteractiveObject
- An empty constructor.
Return type: None -
GetHandle
()¶
-
Highlight
()¶ - Highlights a voxel. It doesn’t re-computes the whole interactive object, but only marks a voxels as ‘highlighted’. The voxel becomes highlighted on next swapping of buffers. In order to unhighlight a voxel, set ix = iy = iz = -1.
Parameters: Return type:
-
SetBoolVoxels
()¶ - <theVoxels> is a Voxel_BoolDS* object.
Parameters: theVoxels (Standard_Address) – Return type: None
-
SetColorRange
()¶ - Defines min-max values for visualization of voxels of ColorDS structure. By default, min value = 1, max value = 15 (all non-zero values).
Parameters: - theMinValue (Standard_Byte) –
- theMaxValue (Standard_Byte) –
Return type:
-
SetColorVoxels
()¶ - <theVoxels> is a Voxel_ColorDS* object.
Parameters: theVoxels (Standard_Address) – Return type: None
-
SetColors
()¶ - Defines the color of points, quadrangles… for ColorDS. For ColorDS the size of array is 0 .. 15. 0 - means no color, this voxel is not drawn.
Parameters: theColors (Handle_Quantity_HArray1OfColor &) – Return type: None
-
SetDegenerateMode
()¶ - Simplifies visualization of voxels in case of view rotation, panning and zooming.
Parameters: theDegenerate (bool) – Return type: None
-
SetDisplayMode
()¶ - Sets a display mode for voxels.
Parameters: theMode (Voxel_VoxelDisplayMode) – Return type: None
-
SetPointSize
()¶ - Defines the size of points for all types of voxels.
Parameters: theSize (float) – Return type: None
-
SetQuadrangleSize
()¶ - Defines the size of quadrangles in per cents (0 .. 100).
Parameters: theSize (int) – Return type: None
-
SetROctBoolVoxels
()¶ - <theVoxels> is a Voxel_ROctBoolDS* object.
Parameters: theVoxels (Standard_Address) – Return type: None
-
SetSizeRange
()¶ - Defines the displayed area of voxels. By default, the range is equal to the box of voxels (all voxels are displayed).
Parameters: Return type:
-
SetSmoothPoints
()¶ - Switches visualization of points from smooth to rough.
Parameters: theSmooth (bool) – Return type: None
-
SetTriangulation
()¶ - Sets a triangulation for visualization.
Parameters: theTriangulation (Handle_Poly_Triangulation &) – Return type: None
-
SetUsageOfGLlists
()¶ - GL lists accelerate view rotation, panning and zooming operations, but it takes additional memory… It is up to the user of this interactive object to decide whether he has enough memory and may use GL lists or he is lack of memory and usage of GL lists is not recommended. By default, usage of GL lists is on. Also, as I noticed, the view without GL lists looks more precisely.
Parameters: theUsage (bool) – Return type: None
-
thisown
¶ The membership flag
-
class
Voxel_ROctBoolDS
(*args)¶ Bases:
OCC.Voxel.Voxel_DS
- An empty constructor.
Return type: None - A constructor initializing the voxel model. (x, y, z) - the start point of the box. (x_len, y_len, z_len) - lengths in x, y and z directions along axes of a co-ordinate system. (nb_x, nb_y, nb_z) - number of splits (voxels) along x, y and z directions.
Parameters: Return type: -
Deepness
()¶ - Returns the deepness of splits of a voxel. 0 - no splits (::IsSplit() being called would return false). 1 - the voxel is split into 8 sub-voxels. 2 - the voxels is split into 8 sub-voxels, and each of the sub-voxels is split into 8 sub-sub-voxels. 3 - …
Parameters: Return type:
-
Get
()¶ - Returns the value of voxel with co-ordinates (ix, iy, iz). Warning!: the returned value may not coincide with the value of its 8 sub-voxels. Use the method ::IsSplit() to check whether a voxel has sub-voxels.
Parameters: Return type: - Returns the value of a sub-voxel of a voxel with co-ordinates (ix, iy, iz). If the voxel is not split, it returns the value of the voxel. Range of sub-voxels is 0 - 7.
Parameters: Return type: - Returns the value of a sub-voxel of a sub-voxel of a voxel with co-ordinates (ix, iy, iz). If the voxel is not split, it returns the value of the voxel. Range of sub-voxels is 0 - 7.
Parameters: Return type:
-
GetCenter
()¶ - Returns the center point of a sub-voxel with co-ordinates (ix, iy, iz, i).
Parameters: Return type: - Returns the center point of a sub-voxel with co-ordinates (ix, iy, iz, i, j).
Parameters: Return type:
-
IsSplit
()¶ - Returns true if the voxel is split into 8 sub-voxels.
Parameters: Return type:
-
OptimizeMemory
()¶ - The method searches voxels with equal-value of sub-voxels and removes them (remaining the value for the voxel).
Return type: None
-
Set
()¶ - Defines a value for voxel with co-ordinates (ix, iy, iz). If the voxel is split into 8 sub-voxels, the split disappears. Initial state of the model is so that all voxels have value 0 (false), and this data doesn’t occupy memory. Memory for data is allocating during setting non-zero values (true).
Parameters: Return type: - Defines a value for a sub-voxel of a voxel with co-ordinates (ix, iy, iz). If the voxel is not split into 8 sub-voxels yet, this method splits the voxel. Range of sub-voxels is 0 - 7.
Parameters: Return type: - Defines a value for a sub-voxel of a sub-voxel of a voxel with co-ordinates (ix, iy, iz). If the voxel is not split into 8 sub-voxels yet, this method splits the voxel. Range of sub-voxels is 0 - 7.
Parameters: Return type:
-
thisown
¶ The membership flag
-
class
Voxel_Reader
(*args)¶ Bases:
object
- An empty constructor.
Return type: None -
GetBoolVoxels
()¶ - Returns a pointer to the read 1bit voxels.
Return type: Standard_Address
-
GetColorVoxels
()¶ - Returns a pointer to the read 4bit voxels.
Return type: Standard_Address
-
GetFloatVoxels
()¶ - Returns a pointer to the read 4bytes voxels.
Return type: Standard_Address
-
Read
()¶ - Reads the voxels from disk
Parameters: file (TCollection_ExtendedString &) – Return type: bool
-
thisown
¶ The membership flag
-
class
Voxel_Selector
(*args)¶ Bases:
object
- An empty constructor.
Return type: None - A constructor of the selector, which initializes the classes by a view, where the user selects the voxels.
Parameters: view (Handle_V3d_View &) – Return type: None -
Detect
()¶ - Detects a voxel under the mouse cursor.
Parameters: Return type:
-
Init
()¶ - Initializes the selector by a view, where the user selects the voxels.
Parameters: view (Handle_V3d_View &) – Return type: None
-
SetVoxels
()¶ - Defines the voxels (1bit).
Parameters: voxels (Voxel_BoolDS &) – Return type: None - Defines the voxels (4bit).
Parameters: voxels (Voxel_ColorDS &) – Return type: None - Defines the voxels (1bit recursive splitting).
Parameters: voxels (Voxel_ROctBoolDS &) – Return type: None
-
thisown
¶ The membership flag
-
class
Voxel_SplitData
(*args)¶ Bases:
object
- An empty constructor.
Return type: None -
GetSplitData
()¶ - Gives access to the next split data.
Return type: Standard_Address
-
GetValues
()¶ - Gives access to the values.
Return type: Standard_Address
-
thisown
¶ The membership flag
-
class
Voxel_Writer
(*args)¶ Bases:
object
- An empty constructor.
Return type: None -
SetFormat
()¶ - Defines the file format for voxels. ASCII - slow and occupies more space on disk. BINARY - fast and occupies less space on disk.
Parameters: format (Voxel_VoxelFileFormat) – Return type: None
-
SetVoxels
()¶ - Defines the voxels (1bit).
Parameters: voxels (Voxel_BoolDS &) – Return type: None - Defines the voxels (4bit).
Parameters: voxels (Voxel_ColorDS &) – Return type: None - Defines the voxels (4bytes).
Parameters: voxels (Voxel_FloatDS &) – Return type: None
-
Write
()¶ - Writes the voxels on disk using the defined format and file name.
Parameters: file (TCollection_ExtendedString &) – Return type: bool
-
thisown
¶ The membership flag
-
new_instancemethod
(func, inst, cls)¶
-
register_handle
(handle, base_object)¶ Inserts the handle into the base object to prevent memory corruption in certain cases