Wildmeshing Toolkit
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
wmtk::components::topological_offset::SimplicialComplexBVH Class Reference

Public Member Functions

void init (const MatrixXd &V, const MatrixXi &T, const MatrixXi &F, const MatrixXi &E, const MatrixXi &P)
 initialize BVH from "closed" simplicial complex
 
bool inside_any_tet (const Vector3d &p) const
 check if a point is inside any tet.
 
double squared_dist (const VectorXd &p) const
 compute distance to complex
 
double dist (const VectorXd &p) const
 
Vector3d nearest_point (const VectorXd &p) const
 find the nearest point on the complex (triangles and edges) to p
 
double nearest_point_feature (const Eigen::Vector2d &p, Eigen::Vector2d &result, bool &on_corner, Eigen::Vector2d &seg_normal, int &feature_id) const
 2D: the nearest point of the complex together with which feature it is.
 
void clear ()
 

Private Attributes

igl::AABB< MatrixXd, 3 > m_tet_aabb_tree
 
bool m_has_tets = false
 
SimpleBVH::BVH m_tri_bvh
 
bool m_has_tris = false
 
SimpleBVH::BVH m_edge_bvh
 
bool m_has_edges = false
 
bool m_is_3d
 
MatrixXd m_V_T = MatrixXd(0, 3)
 
MatrixXi m_T_T = MatrixXi(0, 4)
 
std::vector< Eigen::Vector2d > m_v2
 
std::vector< Eigen::Vector2i > m_e2
 

Member Function Documentation

◆ init()

void wmtk::components::topological_offset::SimplicialComplexBVH::init ( const MatrixXd &  V,
const MatrixXi &  T,
const MatrixXi &  F,
const MatrixXi &  E,
const MatrixXi &  P 
)
inline

initialize BVH from "closed" simplicial complex

Parameters
VNx2 or Nx3, all vertices contained anywhere in complex
TMx4, tets contained in complex
FLx3, isolated faces contained in complex (ie, faces not in any tet)
EKx2, the complex's edge set: isolated edges (edges not in any faces or tets), plus the boundary segments of F when the caller wants the 2D feature query to answer for a solid complex. Boundary segments lie on the faces, so including them leaves squared_dist() unchanged; nearest_point_feature() searches exactly this set.
PJx1, isolated vertices contained in complex (ie, verts not in any edges, faces, or tets)

◆ nearest_point()

Vector3d wmtk::components::topological_offset::SimplicialComplexBVH::nearest_point ( const VectorXd &  p) const
inline

find the nearest point on the complex (triangles and edges) to p

Note
unlike squared_dist(), this does not special-case points inside a tet of the complex – for those the returned point is still the nearest surface point, not p itself

◆ nearest_point_feature()

double wmtk::components::topological_offset::SimplicialComplexBVH::nearest_point_feature ( const Eigen::Vector2d &  p,
Eigen::Vector2d &  result,
bool &  on_corner,
Eigen::Vector2d &  seg_normal,
int &  feature_id 
) const
inline

2D: the nearest point of the complex together with which feature it is.

The same algorithm SampleEnvelope::nearest_point_feature runs (Envelope.cpp). nearest_facet seeds the search, and the foot is then re-derived on every box candidate from the input arrays, so classification and the returned point come from the same arithmetic – the BVH's own foot can differ in the last ulp. A hit at t <= 0 or t >= 1 is the endpoint itself: on_corner, with the polyline vertex index as the feature id, canonical across the two segments sharing it. A pseudo-edge (i, i) has len2 == 0 and lands on the corner branch.

Returns
squared distance to the returned foot point.

Member Data Documentation

◆ m_v2

std::vector<Eigen::Vector2d> wmtk::components::topological_offset::SimplicialComplexBVH::m_v2
private

Input copies backing nearest_point_feature (2D only): the BVH's nearest_facet returns its internal primitive index, so classifying the hit needs the input arrays at hand. m_e2 must stay in the edge BVH's own primitive order – real edges first, then the pseudo-edges (i, i) that carry isolated vertices – because intersect_box reports ids in that order.


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