Library of Assembled Shared Sources
lass::prim::TriangleMesh3D< T, BoundingVolumeHierarchy, SplitHeuristics > Class Template Reference

One of the simplier meshes. More...

#include <triangle_mesh_3d.h>

Inheritance diagram for lass::prim::TriangleMesh3D< T, BoundingVolumeHierarchy, SplitHeuristics >:

Public Member Functions

void flatFaces ()
 remove all normals, so that faces become flat
 
template<typename Func>
void subdivisionWithLimitSurface (unsigned level, Func snapToLimitSurface)
 global subdivision with function to resnap new vertices.
 
void autoSew ()
 automatically sews (unconnected) triangles by comparing geometrical vertices and normals
 
void autoCrease (unsigned level, TParam maxAngleInRadians)
 automatically assign crease levels to edges with discontinued normals
 
Result intersect (const TRay &ray, TTriangleIterator &triangle, TReference t, TParam tMin=0, IntersectionContext *context=0) const
 Find nearest intersection with ray with t > tMin.
 
bool intersects (const TRay &ray, TParam tMin, TParam tMax) const
 Checks if the ray has any intersection with the mesh, with t > tMin and t < tMax.
 
Result intersectFilter (const TRay &ray, TTriangleIterator &triangle, TReference t, TParam tMin, TFilter filter, IntersectionContext *context=0) const
 Find nearest intersection with ray that passes the filter, and with t > tMin.
 
bool intersectsFilter (const TRay &ray, TParam tMin, TParam tMax, TFilter filter) const
 Checks if the ray has any intersection that passes the filter, and with t > tMin and t < tMax.
 

Detailed Description

template<typename T, template< typename TT, typename OT, typename SH > class BoundingVolumeHierarchy, typename SplitHeuristics>
class lass::prim::TriangleMesh3D< T, BoundingVolumeHierarchy, SplitHeuristics >

One of the simplier meshes.

Author
Bram de Greve [BdG]

Definition at line 87 of file triangle_mesh_3d.h.

Member Function Documentation

◆ subdivisionWithLimitSurface()

template<typename T, template< typename, typename, typename > class BHV, typename SH>
template<typename Func>
void lass::prim::TriangleMesh3D< T, BHV, SH >::subdivisionWithLimitSurface ( unsigned level,
Func snapToLimitSurface )

global subdivision with function to resnap new vertices.

void snapToLimitSurface(TPoint& vert, TVector* n1, TVector* n2, TUv* uv1, TUv* uv2, const size_t* attr1, const size_t* attr2)

Definition at line 450 of file triangle_mesh_3d.inl.

References subdivisionWithLimitSurface().

Referenced by subdivisionWithLimitSurface().

◆ intersect()

template<typename T, template< typename, typename, typename > class BHV, typename SH>
Result lass::prim::TriangleMesh3D< T, BHV, SH >::intersect ( const TRay & ray,
TTriangleIterator & triangle,
TReference t,
TParam tMin = 0,
IntersectionContext * context = 0 ) const

Find nearest intersection with ray with t > tMin.

Of all triangles that intersect with the ray, return the one that is nearest to the ray origin while still being further away than tMin. The distance along the ray to the intersection point is returned in t. If an intersection was found, the context (if provided) is filled with intersection information.

Parameters
[in]raythe ray to intersect with
[out]trianglethe triangle that was hit
[out]tthe distance along the ray to the intersection point, with t > tMin
[in]tMinthe minimum distance along the ray to consider, so that t > tMin
[out]contextthe context to be filled with intersection information (optional)
Returns
rOne if an intersection was found, rNone otherwise

Definition at line 718 of file triangle_mesh_3d.inl.

References intersect(), and intersectFilter().

Referenced by intersect().

◆ intersects()

template<typename T, template< typename, typename, typename > class BHV, typename SH>
bool lass::prim::TriangleMesh3D< T, BHV, SH >::intersects ( const TRay & ray,
TParam tMin,
TParam tMax ) const

Checks if the ray has any intersection with the mesh, with t > tMin and t < tMax.

Parameters
[in]raythe ray to intersect with
[in]tMinthe minimum distance along the ray to consider, so that t > tMin
[in]tMaxthe maximum distance along the ray to consider, so that t < tMax
Returns
true if an intersection was found, false otherwise

Definition at line 779 of file triangle_mesh_3d.inl.

References intersects(), and intersectsFilter().

Referenced by intersects().

◆ intersectFilter()

template<typename T, template< typename, typename, typename > class BHV, typename SH>
Result lass::prim::TriangleMesh3D< T, BHV, SH >::intersectFilter ( const TRay & ray,
TTriangleIterator & triangle,
TReference t,
TParam tMin,
TFilter filter,
IntersectionContext * context = 0 ) const

Find nearest intersection with ray that passes the filter, and with t > tMin.

Similar to intersect, but the filter function is evaluated for each candidate intersection point. If the filter returns true, the intersection is accepted. If the filter returns false, the next candidate is evaluated. This allows for implementing an alpha mask on the triangle mesh, for example.

Parameters
[in]raythe ray to intersect with
[out]trianglethe triangle that was hit
[out]tthe distance along the ray to the intersection point, with t > tMin
[in]tMinthe minimum distance along the ray to consider, so that t > tMin
[in]filterthe filter to apply to the intersection points
[out]contextthe context to be filled with intersection information (optional)
Returns
rOne if an intersection was found, rNone otherwise

Definition at line 744 of file triangle_mesh_3d.inl.

References intersectFilter(), lass::prim::rNone, and lass::prim::rOne.

Referenced by intersect(), and intersectFilter().

◆ intersectsFilter()

template<typename T, template< typename, typename, typename > class BHV, typename SH>
bool lass::prim::TriangleMesh3D< T, BHV, SH >::intersectsFilter ( const TRay & ray,
TParam tMin,
TParam tMax,
TFilter filter ) const

Checks if the ray has any intersection that passes the filter, and with t > tMin and t < tMax.

Similar to intersects, but the filter function is evaluated for each candidate intersection point. Only if it returns true, it's considered as a valid intersection. This allows for implementing an alpha mask on the triangle mesh, for example.

Parameters
[in]raythe ray to intersect with
[in]tMinthe minimum distance along the ray to consider, so that t > tMin
[in]tMaxthe maximum distance along the ray to consider, so that t < tMax
[in]filterthe filter to apply to the intersection points
Returns
true if an intersection was found, false otherwise

Definition at line 801 of file triangle_mesh_3d.inl.

References intersectsFilter().

Referenced by intersects(), and intersectsFilter().


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