VoxelizationInterface Class Reference

#include <voxelization.h>

Inheritance diagram for VoxelizationInterface:

Detailed Description

VoxelizationInterface provides a class for building up a voxelization of different kinds of index based mesh data structures.

Public Member Functions

MAXON_METHOD Result< BoolInit (PolygonObject *polyObject, Int32 voxelResolution, Int32 minResolution, BaseArray< Range< Vector >> &polyRanges, const Vector *pointOverride=nullptr, Bool precise=false)
 
MAXON_METHOD Result< BoolInit (PolygonObject *polyObject, BaseArray< Int32 > &polyIslands, Int32 voxelResolution, Int32 minResolution, BaseArray< Range< Vector >> &polyRanges, const Vector *pointOverride=nullptr)
 
MAXON_METHOD Result< BoolInit (const ConvexHullData *hull, Int32 voxelResolution, Int32 minResolution, BaseArray< Range< Vector >> &polyRanges)
 
MAXON_METHOD Result< BoolInit (const BaseArray< BaseArray< Int32 >> &facePoints, const BaseArray< Vector > &points, Int32 voxelResolution, Int32 minResolution, BaseArray< Range< Vector >> &polyRanges)
 
MAXON_METHOD Result< void > GetClosestPolys (const Vector pos, BaseBitSet<> &voxelPolys, const BaseBitSet<> *polyFilter=nullptr) const
 
MAXON_METHOD Result< void > GetIntersectingIndices (const Range< Vector > &toTestBox, BaseArray< Int32 > &indexList) const
 
MAXON_METHOD Result< void > GetIntersectingIndicesPrecise (const Range< Vector > &toTestBox, const BaseArray< Range< Vector >> &polyRanges, BaseArray< Int32 > &indexList) const
 
MAXON_METHOD Result< BoolGetIntersectingIndices (const Vector &point, BaseArray< Int32 > &indexList) const
 
const MAXON_METHOD Range< Vector > & GetBoundingBox () const
 
MAXON_METHOD Range< IntVector32GetVoxelRangesFromBoundingBox (const Range< Vector > &boundingBox) const
 
MAXON_METHOD Bool IsInitialized () const
 

Private Member Functions

 MAXON_INTERFACE (VoxelizationInterface, MAXON_REFERENCE_NORMAL, "net.maxon.geom.interface.voxelization")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( VoxelizationInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.geom.interface.voxelization"   
)
private

◆ Init() [1/4]

MAXON_METHOD Result<Bool> Init ( PolygonObject polyObject,
Int32  voxelResolution,
Int32  minResolution,
BaseArray< Range< Vector >> &  polyRanges,
const Vector pointOverride = nullptr,
Bool  precise = false 
)

Initializes the voxelization with a polygon object.

Parameters
[in]polyObjectPointer to the polygon object to be added to the voxelization.
[in]voxelResolutionThe voxel resolution of the largest dimension.
[in]minResolutionThe minimal resolution of either dimension.
[out]polyRangesCalculated bounding boxes for every polygon.
[in]pointOverrideOverride option for the polygon points. If not nullptr, these points will be used for the polygon vertices.
[in]preciseIf true, only the voxels touching a polygon will hold the specific polygon index. If false, all voxels touching the polygon AABB will hold the polygon index.
Returns
True if the voxelization was properly initialized, false otherwise.

◆ Init() [2/4]

MAXON_METHOD Result<Bool> Init ( PolygonObject polyObject,
BaseArray< Int32 > &  polyIslands,
Int32  voxelResolution,
Int32  minResolution,
BaseArray< Range< Vector >> &  polyRanges,
const Vector pointOverride = nullptr 
)

Initializes the voxelization with a polygon object.

Parameters
[in]polyObjectPointer to the polygon object to be added to the voxelization.
[in]polyIslandsA list of polygon indices. Only those polygons will be added to the voxelization.
[in]voxelResolutionThe voxel resolution of the largest dimension.
[in]minResolutionThe minimal resolution of either dimension.
[out]polyRangesCalculated bounding boxes for every polygon.
[in]pointOverrideOverride option for the polygon points. If not nullptr, these points will be used for the polygon vertices.
Returns
True if the voxelization was properly initialized, false otherwise.

◆ Init() [3/4]

MAXON_METHOD Result<Bool> Init ( const ConvexHullData hull,
Int32  voxelResolution,
Int32  minResolution,
BaseArray< Range< Vector >> &  polyRanges 
)

Initializes the voxelization with a convex hull data struct.

Parameters
[in]hullThe convex hull data to be added to the voxelization.
[in]voxelResolutionThe voxel resolution of the largest dimension.
[in]minResolutionThe minimal resolution of either dimension.
[out]polyRangesCalculated bounding boxes for every polygon.
Returns
True if the voxelization was properly initialized, false otherwise.

◆ Init() [4/4]

MAXON_METHOD Result<Bool> Init ( const BaseArray< BaseArray< Int32 >> &  facePoints,
const BaseArray< Vector > &  points,
Int32  voxelResolution,
Int32  minResolution,
BaseArray< Range< Vector >> &  polyRanges 
)

Initializes the voxelization with a list of polygon indices and points.

Parameters
[in]facePointsA list of list holding the point indices for each polygon.
[in]pointsThe vertex positions.
[in]voxelResolutionThe voxel resolution of the largest dimension.
[in]minResolutionThe minimal resolution of either dimension.
[out]polyRangesCalculated bounding boxes for every polygon.
Returns
True if the voxelization was properly initialized, false otherwise.

◆ GetClosestPolys()

MAXON_METHOD Result<void> GetClosestPolys ( const Vector  pos,
BaseBitSet<> &  voxelPolys,
const BaseBitSet<> *  polyFilter = nullptr 
) const

Retrieve the polygon indices of the closest polygons to a point in space.

Parameters
[in]posThe position in space to test for.
[out]voxelPolysA bitset with the closest polygon indices set.
[in]polyFilterAn optional bitset with polygon indices set that should be respected. if nullptr all initialized polygons can be found.
Returns
OK on success.

◆ GetIntersectingIndices() [1/2]

MAXON_METHOD Result<void> GetIntersectingIndices ( const Range< Vector > &  toTestBox,
BaseArray< Int32 > &  indexList 
) const

Retrieve the polygon indices of all polygons stored in voxels overlappint a axis-aligned bounding box.

Parameters
[in]toTestBoxThe bounding box to find the polygon indices for.
[out]indexListA list of polygon indices that are stored in voxels overlapping the passed bounding box.
Returns
OK on success.

◆ GetIntersectingIndicesPrecise()

MAXON_METHOD Result<void> GetIntersectingIndicesPrecise ( const Range< Vector > &  toTestBox,
const BaseArray< Range< Vector >> &  polyRanges,
BaseArray< Int32 > &  indexList 
) const

Retrieve the polygon indices of all polygons stored in voxels overlapping a axis-aligned bounding box.

Parameters
[in]toTestBoxThe bounding box to find the polygon indices for.
[in]polyRangesThe bounding box for each polygon. This list can be retrieved from the initialization of the voxelization.
[out]indexListA list of polygon indices that are stored in voxels overlapping the passed bounding box.
Returns
OK on success.

◆ GetIntersectingIndices() [2/2]

MAXON_METHOD Result<Bool> GetIntersectingIndices ( const Vector point,
BaseArray< Int32 > &  indexList 
) const

Retrieve the polygon indices of all polygons stored in the voxel that contains the passed point.

Parameters
[in]pointThe point to find the polygon indices for.
[out]indexListA list of polygon indices that are stored in voxel containing the passed point.
Returns
True if the point was inside of a voxel, false otherwise.

◆ GetBoundingBox()

const MAXON_METHOD Range<Vector>& GetBoundingBox ( ) const

Retrieve the bounding box of the voxelization.

Returns
The bounding box as range of all voxels of this voxelization.

◆ GetVoxelRangesFromBoundingBox()

MAXON_METHOD Range<IntVector32> GetVoxelRangesFromBoundingBox ( const Range< Vector > &  boundingBox) const

Retrieve the voxel ranges for a passed bounding box.

Returns
A voxel range bounding box with minimum and maximum indices in each dimension.

◆ IsInitialized()

MAXON_METHOD Bool IsInitialized ( ) const

Retrieve the initialization state of the voxelization.

Returns
True if the voxelization is initialized, false otherwise.