MeVisLab Scripting Reference
MLWEMBoundingVolumeHierarchyWrapper Class Reference

Inherits MLRefCountedBaseWrapper.

Public Types

enum  IntersectionMode { AllHits = ml::WEMIntersectionMode::AllHits , RemoveDuplicateHits = ml::WEMIntersectionMode::RemoveDuplicateHits }
 

Public Slots

bool rayOccluded (const QList< double > &position, const QList< double > &direction, float rayNear=0.f, float rayFar=ML_FLOAT_MAX)
 
MLWEMIntersectionWrapperrayIntersectClosest (const QList< double > &position, const QList< double > &direction, float rayNear=0.f, float rayFar=ML_FLOAT_MAX)
 
QList< MLWEMIntersectionWrapper * > rayIntersect (const QList< double > &position, const QList< double > &direction, IntersectionMode mode=AllHits, float rayNear=0.f, float rayFar=ML_FLOAT_MAX)
 

Static Public Member Functions

static ml::RefCountedBase * createObject (const QVariantList &arguments)
 

Detailed Description

A class that wraps WEMBoundingVolumeHierarchy objects for fast ray intersection.

The precision of the ray intersection is only float precision, since the underlying Embree library does not (yet?) support double precision.

wem = ctx.field("SomeWEMModule.outWEM").object()
bvh = MLAB.createMLBaseObject("WEMBoundingVolumeHierarchy", [wem])
result = bvh.rayIntersectClosest([30., 0., 0.], [-1., 0., 0.])
Access to all global functions and objects of MLAB.
Definition: mlabGlobalScriptAccess.h:81
QObject * createMLBaseObject(const QString &baseClassName, const QVariantList &arguments=QVariantList())
Creates a new reference-counted ml::Base object, conveniently wrapped for scripting; which arguments ...

Member Enumeration Documentation

◆ IntersectionMode

Enumeration of intersection mode.

Enumerator
AllHits 

Collect all hits (even two triangles on the same edge).

RemoveDuplicateHits 

Remove duplicate hits.

Member Function Documentation

◆ createObject()

static ml::RefCountedBase* MLWEMBoundingVolumeHierarchyWrapper::createObject ( const QVariantList &  arguments)
static

Create new WEMBoundingVolumeHierarchy object; this is used by MLAB.createMLBaseObject to create a WEMBoundingVolumeHierarchy.

If the arguments is a list with a single WEM wrapper, a new WEMBoundingVolumeHierarchy will be returned.

◆ rayIntersect

QList<MLWEMIntersectionWrapper*> MLWEMBoundingVolumeHierarchyWrapper::rayIntersect ( const QList< double > &  position,
const QList< double > &  direction,
IntersectionMode  mode = AllHits,
float  rayNear = 0.f,
float  rayFar = ML_FLOAT_MAX 
)
slot

Intersects the triangles with the given ray (position, direction) between rayNear and rayFar and returns the hit sorted by the nearest hit.

◆ rayIntersectClosest

MLWEMIntersectionWrapper* MLWEMBoundingVolumeHierarchyWrapper::rayIntersectClosest ( const QList< double > &  position,
const QList< double > &  direction,
float  rayNear = 0.f,
float  rayFar = ML_FLOAT_MAX 
)
slot

Intersects the triangles with the given ray (position, direction) between rayNear and rayFar and returns the nearest hit (or None if there is no hit).

◆ rayOccluded

bool MLWEMBoundingVolumeHierarchyWrapper::rayOccluded ( const QList< double > &  position,
const QList< double > &  direction,
float  rayNear = 0.f,
float  rayFar = ML_FLOAT_MAX 
)
slot

Intersects the triangles with the given ray (position, direction) between rayNear and rayFar and returns if the ray hits anything (is occluded).

(direction has to be normalized!)