waLBerla 7.2
Loading...
Searching...
No Matches
walberla::mesh::distance_octree::DistanceOctree< MeshType > Class Template Reference

#include <DistanceOctree.h>

Public Types

using Point = typename MeshType::Point
 
using Normal = typename MeshType::Normal
 
using Scalar = typename MeshType::Scalar
 
using FaceHandle = typename MeshType::FaceHandle
 
using AABB = typename math::GenericAABB<Scalar>
 

Public Member Functions

 DistanceOctree (const shared_ptr< TriangleDistance< MeshType > > &triDist, uint_t maxDepth=20u, uint_t minNumTriangles=25u)
 
Scalar sqSignedDistance (const Point &p) const
 
Scalar sqSignedDistance (const Point &p, FaceHandle &closestTriangle) const
 
Scalar sqSignedDistance (const Point &p, Point &closestPoint) const
 
Scalar sqSignedDistance (const Point &p, Point &closestPoint, Normal &normal) const
 
Scalar sqDistance (const Point &p) const
 
Scalar sqDistance (const Point &p, FaceHandle &closestTriangle) const
 
Scalar sqDistance (const Point &p, Point &closestPoint) const
 
Scalar sqDistance (const Point &p, Point &closestPoint, Normal &normal) const
 
Scalar getRayDistanceToMeshObject (const Point &ray_origin, const Point &normalised_ray_direction) const
 This function calculates the distance from a point to the closest intersection point of a mesh object along a specified ray (origin and direction).
 
uint_t numTriangles () const
 
void numTrianglesToStream (std::ostream &os)
 
uint_t height () const
 
const AABBgetAABB () const
 
void writeVTKOutput (const std::string &filestem) const
 Write the distance octree to a VTK file.
 

Static Public Member Functions

static Point toPoint (const Vector3< Scalar > &p)
 
static Vector3< ScalarfromPoint (const Point &p)
 
static Vector3< ScalarfromNormal (const Normal &p)
 
static Scalar toScalar (const real_t &x)
 
static real_t fromScalar (const Scalar &x)
 

Protected Attributes

shared_ptr< const Node< MeshType > > rootNode_
 

Member Typedef Documentation

◆ AABB

template<typename MeshType >
using walberla::mesh::distance_octree::DistanceOctree< MeshType >::AABB = typename math::GenericAABB<Scalar>

◆ FaceHandle

template<typename MeshType >
using walberla::mesh::distance_octree::DistanceOctree< MeshType >::FaceHandle = typename MeshType::FaceHandle

◆ Normal

template<typename MeshType >
using walberla::mesh::distance_octree::DistanceOctree< MeshType >::Normal = typename MeshType::Normal

◆ Point

template<typename MeshType >
using walberla::mesh::distance_octree::DistanceOctree< MeshType >::Point = typename MeshType::Point

◆ Scalar

template<typename MeshType >
using walberla::mesh::distance_octree::DistanceOctree< MeshType >::Scalar = typename MeshType::Scalar

Constructor & Destructor Documentation

◆ DistanceOctree()

template<typename MeshType >
walberla::mesh::distance_octree::DistanceOctree< MeshType >::DistanceOctree ( const shared_ptr< TriangleDistance< MeshType > > & triDist,
uint_t maxDepth = 20u,
uint_t minNumTriangles = 25u )
inline

Member Function Documentation

◆ fromNormal()

template<typename MeshType >
static Vector3< Scalar > walberla::mesh::distance_octree::DistanceOctree< MeshType >::fromNormal ( const Normal & p)
inlinestatic

◆ fromPoint()

template<typename MeshType >
static Vector3< Scalar > walberla::mesh::distance_octree::DistanceOctree< MeshType >::fromPoint ( const Point & p)
inlinestatic

◆ fromScalar()

template<typename MeshType >
static real_t walberla::mesh::distance_octree::DistanceOctree< MeshType >::fromScalar ( const Scalar & x)
inlinestatic

◆ getAABB()

template<typename MeshType >
const AABB & walberla::mesh::distance_octree::DistanceOctree< MeshType >::getAABB ( ) const
inline

◆ getRayDistanceToMeshObject()

template<typename MeshType >
Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::getRayDistanceToMeshObject ( const Point & ray_origin,
const Point & normalised_ray_direction ) const
inline

This function calculates the distance from a point to the closest intersection point of a mesh object along a specified ray (origin and direction).

This is done via the Möller-Trumbore Fast Minimum Storage Ray/Triangle Intersection Algorithm. For more information, see: Möller, T., & Trumbore, B. (1997). Fast, Minimum Storage Ray-Triangle Intersection. Journal of Graphics Tools, 2(1), 21–28. https://doi.org/10.1080/10867651.1997.10487468

Parameters
ray_originThe origin of the ray as a MeshType::Point.
normalised_ray_directionThe direction of the ray as a MeshType::Point in its normalised state, i.e. if the direction vector is: ray_direction = [1,1,0] normalised_ray_direction = [1/sqrt(2), 1/sqrt(2), 0]
Returns
The distance to the closest intersection point, or std::numeric_limits<Scalar>::max() if no intersection occurs.

Usage:

const MeshType::Point ray_origin { ... };
MeshType::Point ray_direction { ... };
auto q = distanceOctree_->getRayDistanceToMeshObject(ray_origin, ray_direction.normalize());
Warning
If the ray and a triangle are parallel (within a small epsilon value), or do not intersect, the function returns std::numeric_limits<Scalar>::max().

◆ height()

template<typename MeshType >
uint_t walberla::mesh::distance_octree::DistanceOctree< MeshType >::height ( ) const
inline

◆ numTriangles()

template<typename MeshType >
uint_t walberla::mesh::distance_octree::DistanceOctree< MeshType >::numTriangles ( ) const
inline

◆ numTrianglesToStream()

template<typename MeshType >
void walberla::mesh::distance_octree::DistanceOctree< MeshType >::numTrianglesToStream ( std::ostream & os)
inline

◆ sqDistance() [1/4]

template<typename MeshType >
Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::sqDistance ( const Point & p) const
inline

◆ sqDistance() [2/4]

template<typename MeshType >
Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::sqDistance ( const Point & p,
FaceHandle & closestTriangle ) const
inline

◆ sqDistance() [3/4]

template<typename MeshType >
Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::sqDistance ( const Point & p,
Point & closestPoint ) const
inline

◆ sqDistance() [4/4]

template<typename MeshType >
Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::sqDistance ( const Point & p,
Point & closestPoint,
Normal & normal ) const
inline

◆ sqSignedDistance() [1/4]

template<typename MeshType >
Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::sqSignedDistance ( const Point & p) const
inline

◆ sqSignedDistance() [2/4]

template<typename MeshType >
Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::sqSignedDistance ( const Point & p,
FaceHandle & closestTriangle ) const
inline

◆ sqSignedDistance() [3/4]

template<typename MeshType >
Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::sqSignedDistance ( const Point & p,
Point & closestPoint ) const
inline

◆ sqSignedDistance() [4/4]

template<typename MeshType >
Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::sqSignedDistance ( const Point & p,
Point & closestPoint,
Normal & normal ) const
inline

◆ toPoint()

template<typename MeshType >
static Point walberla::mesh::distance_octree::DistanceOctree< MeshType >::toPoint ( const Vector3< Scalar > & p)
inlinestatic

◆ toScalar()

template<typename MeshType >
static Scalar walberla::mesh::distance_octree::DistanceOctree< MeshType >::toScalar ( const real_t & x)
inlinestatic

◆ writeVTKOutput()

template<typename MeshType >
void walberla::mesh::distance_octree::DistanceOctree< MeshType >::writeVTKOutput ( const std::string & filestem) const

Write the distance octree to a VTK file.

This method should only be called by the root process:

{
distanceOctree->writeVTKOutput("distanceOctree");
}
#define WALBERLA_ROOT_SECTION()
Definition MPIManager.h:287
Parameters
filestemname of the VTK file without extension

Member Data Documentation

◆ rootNode_

template<typename MeshType >
shared_ptr< const Node<MeshType> > walberla::mesh::distance_octree::DistanceOctree< MeshType >::rootNode_
protected

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