DistanceQueryInterface Class Reference

#include <distancequery.h>

Inheritance diagram for DistanceQueryInterface:

Detailed Description

DistanceQueryInterface provides functions for calculating the distance to a mesh, a spline or a line.

Public Member Functions

MAXON_METHOD Result< void > Init (PolygonObject *mesh, Bool initVoxelization=false)
 
MAXON_METHOD Result< void > Init (SplineObject *spline)
 
MAXON_METHOD Result< void > Init (LineObject *line)
 
MAXON_METHOD Result< void > Init (const Block< const Vector > points, const Block< const SimplePolygon > polygons, const Matrix &objectPosition)
 
MAXON_METHOD void Reset ()
 
MAXON_METHOD Float GetClosestMeshPrimitive (const Vector &pos, PrimitiveInformation &primInfo, const BaseBitSet<> *polyFilter=nullptr) const
 
MAXON_METHOD void GetDistanceToMesh (const Vector &pos, MeshDistanceData &distInfo, const BaseBitSet<> *polyFilter=nullptr, Bool onlyPolyPrimitives=false) const
 
MAXON_METHOD void GetDistanceToMeshMaxAngleToDirection (const Vector &pos, const Vector &direction, const Float angle, MeshDistanceData &distInfo, const BaseBitSet<> *polyFilter=nullptr, Bool onlyPolyPrimitives=false) const
 
MAXON_METHOD void GetDistanceToSpline (const Vector &pos, SplineDistanceData &distInfo) const
 
MAXON_METHOD Bool IsInitialized () const
 
MAXON_METHOD void SetThreading (Int32 threads)
 

Private Member Functions

 MAXON_INTERFACE (DistanceQueryInterface, MAXON_REFERENCE_NORMAL, "net.maxon.geom.interface.distancequery")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( DistanceQueryInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.geom.interface.distancequery"   
)
private

◆ Init() [1/4]

MAXON_METHOD Result<void> Init ( PolygonObject mesh,
Bool  initVoxelization = false 
)

Initializes the distance query with a polygon object.

Parameters
[in]meshReference to the polygon object that the distance query is initialized to.
[in]initVoxelizationInitializes a voxelization for the distance query. This Is useful for massive tests on high poly polygon objects.
Returns
OK on success.

◆ Init() [2/4]

MAXON_METHOD Result<void> Init ( SplineObject spline)

Initializes the distance query with a spline object.

Parameters
[in]splineReference to the spline object that the distance query is initialized to.
Returns
OK on success.

◆ Init() [3/4]

MAXON_METHOD Result<void> Init ( LineObject line)

Initializes the distance query with a line object.

Parameters
[in]lineReference to the line object that the distance query is initialized to.
Returns
OK on success.

◆ Init() [4/4]

MAXON_METHOD Result<void> Init ( const Block< const Vector points,
const Block< const SimplePolygon polygons,
const Matrix objectPosition 
)

Initializes the distance query with a list of points and polygons.

Parameters
[in]pointsBlock of Vectors that represent the points of the mesh.
[in]polygonsBlock to Simple polygons that represent the topology.
[in]objectPositionThe matrix of the geometry.
Returns
OK on success.

◆ Reset()

MAXON_METHOD void Reset ( )

Resets the Initialized data.

◆ GetClosestMeshPrimitive()

MAXON_METHOD Float GetClosestMeshPrimitive ( const Vector pos,
PrimitiveInformation primInfo,
const BaseBitSet<> *  polyFilter = nullptr 
) const

Retrieves the closest primitive of the initialized mesh.

Parameters
[in]posThe point in space the closest primitive should be found for.
[out]primInfoThe information for the primitive closest to the passed point.
[in]polyFilterAn optional bitset with the polygon indices that should be tested set, if nullptr all polygons will be tested.
Returns
The minimum distance to the closest primitive.

◆ GetDistanceToMesh()

MAXON_METHOD void GetDistanceToMesh ( const Vector pos,
MeshDistanceData distInfo,
const BaseBitSet<> *  polyFilter = nullptr,
Bool  onlyPolyPrimitives = false 
) const

Retrieves the closest primitive of the initialized mesh.

Parameters
[in]posThe point in space the distance information should be calculated for.
[out]distInfoThe calculated distance information for passed point.
[in]polyFilterAn optional bitset with the polygon indices that should be tested set, if nullptr all polygons will be tested.
[in]onlyPolyPrimitivesIf true the primitive information in the calculated distInfo will always be relative to polygons, false will return primitive information for points and edges as well.

◆ GetDistanceToMeshMaxAngleToDirection()

MAXON_METHOD void GetDistanceToMeshMaxAngleToDirection ( const Vector pos,
const Vector direction,
const Float  angle,
MeshDistanceData distInfo,
const BaseBitSet<> *  polyFilter = nullptr,
Bool  onlyPolyPrimitives = false 
) const

Retrieves the closest primitive of the initialized mesh. Same as GetDistanceToMesh This will filter out all polygons that have primitive normals with a higher angle from the passed direction.

Parameters
[in]posThe point in space the distance information should be calculated for.
[in]directionThe direction for which the found polygons are not allowed to deviate more than the passed angle.
[in]angleThe angle for which the found polygons normals are not allowed to deviate relative to the passed direction.
[out]distInfoThe calculated distance information for the passed point.
[in]polyFilterAn optional bitset with the polygon indices that should be tested set, if nullptr all polygons will be tested.
[in]onlyPolyPrimitivesIf true the primitive information in the calculated distInfo will always be relative to polygons, false will return primitive information for points and edges as well.

◆ GetDistanceToSpline()

MAXON_METHOD void GetDistanceToSpline ( const Vector pos,
SplineDistanceData distInfo 
) const

Retrieves the closest primitive of the initialized Spline or Line.

Parameters
[in]posThe point in space the distance information should be calculated for.
[out]distInfoThe calculated distance information for passed point.

◆ IsInitialized()

MAXON_METHOD Bool IsInitialized ( ) const

Retrieves if the class was initialized with a polygon object, a spline or a line.

Returns
True if the class was initialized, false otherwise.

◆ SetThreading()

MAXON_METHOD void SetThreading ( Int32  threads)

Set the thread count for the calculations.

Parameters
[in]threadsThe amount of threads to be used.