Library of Assembled Shared Sources
|
One of the simplier meshes. More...
#include <triangle_mesh_3d.h>
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. | |
One of the simplier meshes.
Definition at line 87 of file triangle_mesh_3d.h.
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().
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.
[in] | ray | the ray to intersect with |
[out] | triangle | the triangle that was hit |
[out] | t | the distance along the ray to the intersection point, with t > tMin |
[in] | tMin | the minimum distance along the ray to consider, so that t > tMin |
[out] | context | the context to be filled with intersection information (optional) |
Definition at line 718 of file triangle_mesh_3d.inl.
References intersect(), and intersectFilter().
Referenced by intersect().
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.
[in] | ray | the ray to intersect with |
[in] | tMin | the minimum distance along the ray to consider, so that t > tMin |
[in] | tMax | the maximum distance along the ray to consider, so that t < tMax |
Definition at line 779 of file triangle_mesh_3d.inl.
References intersects(), and intersectsFilter().
Referenced by intersects().
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.
[in] | ray | the ray to intersect with |
[out] | triangle | the triangle that was hit |
[out] | t | the distance along the ray to the intersection point, with t > tMin |
[in] | tMin | the minimum distance along the ray to consider, so that t > tMin |
[in] | filter | the filter to apply to the intersection points |
[out] | context | the context to be filled with intersection information (optional) |
Definition at line 744 of file triangle_mesh_3d.inl.
References intersectFilter(), lass::prim::rNone, and lass::prim::rOne.
Referenced by intersect(), and intersectFilter().
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.
[in] | ray | the ray to intersect with |
[in] | tMin | the minimum distance along the ray to consider, so that t > tMin |
[in] | tMax | the maximum distance along the ray to consider, so that t < tMax |
[in] | filter | the filter to apply to the intersection points |
Definition at line 801 of file triangle_mesh_3d.inl.
References intersectsFilter().
Referenced by intersects(), and intersectsFilter().