1.3.64
 
Loading...
Searching...
No Matches
VoxelIntersection Class Reference

Public Member Functions

 VoxelIntersection (helios::Context *context)
 Default constructor.
 
void calculatePrimitiveVoxelIntersection ()
 Calculate primitives that reside in all voxels for every primitive in the Context.
 
void calculatePrimitiveVoxelIntersection (std::vector< uint > UUIDs)
 Calculate primitives that reside in all voxels for a subset of primitives in the Context.
 
void disableMessages ()
 Disable output messages (enabled by default)
 
void enableMessages ()
 Re-enable output messages.
 
helios::vec3 linesIntersection (helios::vec3 line1_point, helios::vec3 line1_direction, helios::vec3 line2_point, helios::vec3 line2_direction)
 Calculate the intersection point of two lines.
 
std::vector< uintslicePrimitive (uint UUID, std::vector< helios::vec3 > voxel_face_vertices, helios::WarningAggregator &warnings)
 Slice a primitive (patch or triangle) into multiple triangles using a defined plane (often a voxel face)
 
std::vector< uintslicePrimitivesUsingGrid (std::vector< uint > UUIDs, helios::vec3 grid_center, helios::vec3 grid_size, helios::int3 grid_divisions)
 Slice a primitives based on a defined grid of voxels.
 
std::vector< std::vector< uint > > getCellPrimitives ()
 get 2D vector storing the UUIDs within each grid cell
 
bool approxSame (float a, float b, float absTol, float relTol)
 compare two floating point numbers to within an absolute and relative error tolerance
 
bool approxSame (helios::vec3 a, helios::vec3 b, float absTol)
 compare two vec3's to within an absolute and relative error tolerance
 
helios::vec2 interpolate_texture_UV_to_slice_point (helios::vec3 p1, helios::vec2 uv1, helios::vec3 p2, helios::vec2 uv2, helios::vec3 ps)
 find the uv coordinate of a slice point
 

Static Public Member Functions

static int selfTest (int argc=0, char **argv=nullptr)
 Self-test function (unit tests)
 

Detailed Description

Definition at line 21 of file VoxelIntersection.h.

Constructor & Destructor Documentation

◆ VoxelIntersection()

VoxelIntersection::VoxelIntersection ( helios::Context context)

Default constructor.

Parameters
[in]contextPointer to Helios context

Definition at line 20 of file VoxelIntersection.cpp.

Member Function Documentation

◆ approxSame() [1/2]

bool VoxelIntersection::approxSame ( float  a,
float  b,
float  absTol,
float  relTol 
)

compare two floating point numbers to within an absolute and relative error tolerance

Parameters
[in]afirst floating point number to be compared
[in]bsecond floating point number to be compared
[in]absTolabsolute tolerance for comparison
[in]relTolrelative tolerance for comparison
Returns
boolean true if absolute difference between a and b is within absolute or relative tolerances

Definition at line 1435 of file VoxelIntersection.cpp.

◆ approxSame() [2/2]

bool VoxelIntersection::approxSame ( helios::vec3  a,
helios::vec3  b,
float  absTol 
)

compare two vec3's to within an absolute and relative error tolerance

Parameters
[in]afirst vec3 to be compared
[in]bsecond vec3 to be compared
[in]absTolabsolute tolerance for comparison
Returns
boolean true if absolute difference between each element of a and b is within the absolute tolerance

Definition at line 1440 of file VoxelIntersection.cpp.

◆ calculatePrimitiveVoxelIntersection() [1/2]

void VoxelIntersection::calculatePrimitiveVoxelIntersection ( void  )

Calculate primitives that reside in all voxels for every primitive in the Context.

Definition at line 221 of file VoxelIntersection.cu.

◆ calculatePrimitiveVoxelIntersection() [2/2]

void VoxelIntersection::calculatePrimitiveVoxelIntersection ( std::vector< uint UUIDs)

Calculate primitives that reside in all voxels for a subset of primitives in the Context.

Parameters
[in]UUIDsUnique universal identifiers for primitives (non-voxels) to include in intersection calculation

Definition at line 225 of file VoxelIntersection.cu.

◆ disableMessages()

void VoxelIntersection::disableMessages ( void  )

Disable output messages (enabled by default)

Definition at line 213 of file VoxelIntersection.cu.

◆ enableMessages()

void VoxelIntersection::enableMessages ( void  )

Re-enable output messages.

Definition at line 217 of file VoxelIntersection.cu.

◆ getCellPrimitives()

std::vector< std::vector< uint > > VoxelIntersection::getCellPrimitives ( void  )

get 2D vector storing the UUIDs within each grid cell

Returns
2D vector of UUIDs within grid cells with grid cell ID as the first index and primitive ID as second index
Note
vector is one element longer than the number of grid cells, with the last element storing UUIDs that didn't fall into any grid cell

Definition at line 1430 of file VoxelIntersection.cpp.

◆ interpolate_texture_UV_to_slice_point()

helios::vec2 VoxelIntersection::interpolate_texture_UV_to_slice_point ( helios::vec3  p1,
helios::vec2  uv1,
helios::vec3  p2,
helios::vec2  uv2,
helios::vec3  ps 
)

find the uv coordinate of a slice point

Parameters
[in]p1xyz coordinate of first vertex of the primitive edge that has the slice point on it
[in]uv1uv coordinate of first vertex of the primitive edge that has the slice point on it
[in]p2xyz coordinate of second vertex of the primitive edge that has the slice point on it
[in]uv2uv coordinate of second vertex of the primitive edge that has the slice point on it
[in]psxyz coordinate of the slice point
Returns
vec2 uvs the uv coordinate of the slice point

Definition at line 1444 of file VoxelIntersection.cpp.

◆ linesIntersection()

helios::vec3 VoxelIntersection::linesIntersection ( helios::vec3  line1_point,
helios::vec3  line1_direction,
helios::vec3  line2_point,
helios::vec3  line2_direction 
)

Calculate the intersection point of two lines.

Parameters
[in]line1_pointpoint on the first line
[in]line1_directiondirection vector of first line
[in]line2_pointpoint on the second line
[in]line2_directiondirection vector of second line
Note
this function assumes that the lines intersect - behavior for lines that don't intersect currently untested
Returns
coordinate of the intersection point between the two lines

Definition at line 46 of file VoxelIntersection.cpp.

◆ selfTest()

int VoxelIntersection::selfTest ( int  argc = 0,
char **  argv = nullptr 
)
static

Self-test function (unit tests)

Definition at line 205 of file selfTest.cpp.

◆ slicePrimitive()

std::vector< uint > VoxelIntersection::slicePrimitive ( uint  UUID,
std::vector< helios::vec3 voxel_face_vertices,
helios::WarningAggregator warnings 
)

Slice a primitive (patch or triangle) into multiple triangles using a defined plane (often a voxel face)

Parameters
[in]UUIDUnique universal identifier (UUID) of primitive to be sliced
[in]voxel_face_verticesa vector of at least 3 points on the plane that will be used to do the slicing
[in]warningsReference to WarningAggregator for collecting warnings
Returns
the number of new triangles created by slicing the original primitive

Definition at line 67 of file VoxelIntersection.cpp.

◆ slicePrimitivesUsingGrid()

std::vector< uint > VoxelIntersection::slicePrimitivesUsingGrid ( std::vector< uint UUIDs,
helios::vec3  grid_center,
helios::vec3  grid_size,
helios::int3  grid_divisions 
)

Slice a primitives based on a defined grid of voxels.

Parameters
[in]UUIDsvector of Unique universal identifiers (UUIDs) of primitives to be sliced
[in]grid_centercoordinates of the center of the grid
[in]grid_sizesize of the grid in the x, y, z dimensions
[in]grid_divisionsnumber of grid divisions in the x, y, and z dimensions
Returns
vector of new planar primitives representing the original surfaces provided in UUIDs

Definition at line 1187 of file VoxelIntersection.cpp.


The documentation for this class was generated from the following files: