MeshLib Documentation
Loading...
Searching...
No Matches
MR::MeshTriPoint Struct Reference

#include <MRMeshTriPoint.h>

Public Member Functions

 MeshTriPoint ()=default
 
 MeshTriPoint (NoInit)
 
 MeshTriPoint (EdgeId e, TriPointf bary)
 
 MeshTriPoint (const MeshEdgePoint &ep)
 
 MeshTriPoint (const MeshTopology &topology, VertId v)
 
template<typename T >
 MeshTriPoint (EdgeId e, const Vector3< T > &p, const Vector3< T > &v0, const Vector3< T > &v1, const Vector3< T > &v2)
 given a point coordinates computes its barycentric coordinates
 
MRMESH_API VertId inVertex (const MeshTopology &topology) const
 returns valid vertex id if the point is in vertex, otherwise returns invalid id
 
bool inVertex () const
 returns true if the point is in a vertex
 
MRMESH_API MeshEdgePoint onEdge (const MeshTopology &topology) const
 
MRMESH_API bool isBd (const MeshTopology &topology, const FaceBitSet *region=nullptr) const
 returns true if the point is in vertex or on edge, and that location is on the boundary of the region
 
MRMESH_API bool fromTriangle (const MeshTopology &topology, FaceId f) const
 returns true if the point is inside or on the boundary of given triangular face
 
bool valid () const
 consider this valid if the edge ID is valid
 
 operator bool () const
 
MRMESH_API MeshTriPoint lnext (const MeshTopology &topology) const
 represents the same point relative to next edge in the same triangle
 
MRMESH_API MeshTriPoint canonical (const MeshTopology &topology) const
 represents the same point relative to the topology.edgeWithLeft( topology.left( e ) )
 
MRMESH_API std::array< WeightedVertex, 3 > getWeightedVerts (const MeshTopology &topology) const
 returns three weighted triangle's vertices with the sum of not-negative weights equal to 1, and the largest weight in the closest vertex
 
bool operator== (const MeshTriPoint &rhs) const =default
 returns true if two points are equal including equal not-unique representation
 

Public Attributes

EdgeId e
 
TriPointf bary
 

Related Symbols

(Note that these are not member symbols.)

MRMESH_API bool same (const MeshTopology &topology, const MeshTriPoint &lhs, const MeshTriPoint &rhs)
 returns true if two points are equal considering different representations
 
MRMESH_API bool fromSameTriangle (const MeshTopology &topology, MeshTriPoint &a, MeshTriPoint &b)
 
bool fromSameTriangle (const MeshTopology &topology, MeshTriPoint &&a, MeshTriPoint &&b)
 
MRMESH_API MeshTriPoint getVertexAsMeshTriPoint (const MeshTopology &topology, EdgeId e, VertId v)
 returns MeshTriPoint representation of given vertex with given edge field; or invalid MeshTriPoint if it is not possible
 

Detailed Description

encodes a point inside a triangular mesh face using barycentric coordinates

Notations used below:
v0 - the value in org( e )
v1 - the value in dest( e )
v2 - the value in dest( next( e ) )

Constructor & Destructor Documentation

◆ MeshTriPoint() [1/6]

MR::MeshTriPoint::MeshTriPoint ( )
nodiscarddefault

◆ MeshTriPoint() [2/6]

MR::MeshTriPoint::MeshTriPoint ( NoInit )
inlinenodiscard

◆ MeshTriPoint() [3/6]

MR::MeshTriPoint::MeshTriPoint ( EdgeId e,
TriPointf bary )
inlinenodiscard

◆ MeshTriPoint() [4/6]

MR::MeshTriPoint::MeshTriPoint ( const MeshEdgePoint & ep)
inlinenodiscard

◆ MeshTriPoint() [5/6]

MR::MeshTriPoint::MeshTriPoint ( const MeshTopology & topology,
VertId v )
inlinenodiscard

◆ MeshTriPoint() [6/6]

template<typename T >
MR::MeshTriPoint::MeshTriPoint ( EdgeId e,
const Vector3< T > & p,
const Vector3< T > & v0,
const Vector3< T > & v1,
const Vector3< T > & v2 )
inlinenodiscard

given a point coordinates computes its barycentric coordinates

Member Function Documentation

◆ canonical()

MRMESH_API MeshTriPoint MR::MeshTriPoint::canonical ( const MeshTopology & topology) const
nodiscard

represents the same point relative to the topology.edgeWithLeft( topology.left( e ) )

◆ fromTriangle()

MRMESH_API bool MR::MeshTriPoint::fromTriangle ( const MeshTopology & topology,
FaceId f ) const
nodiscard

returns true if the point is inside or on the boundary of given triangular face

◆ getWeightedVerts()

MRMESH_API std::array< WeightedVertex, 3 > MR::MeshTriPoint::getWeightedVerts ( const MeshTopology & topology) const
nodiscard

returns three weighted triangle's vertices with the sum of not-negative weights equal to 1, and the largest weight in the closest vertex

◆ inVertex() [1/2]

bool MR::MeshTriPoint::inVertex ( ) const
inlinenodiscard

returns true if the point is in a vertex

◆ inVertex() [2/2]

MRMESH_API VertId MR::MeshTriPoint::inVertex ( const MeshTopology & topology) const
nodiscard

returns valid vertex id if the point is in vertex, otherwise returns invalid id

◆ isBd()

MRMESH_API bool MR::MeshTriPoint::isBd ( const MeshTopology & topology,
const FaceBitSet * region = nullptr ) const
nodiscard

returns true if the point is in vertex or on edge, and that location is on the boundary of the region

◆ lnext()

MRMESH_API MeshTriPoint MR::MeshTriPoint::lnext ( const MeshTopology & topology) const
nodiscard

represents the same point relative to next edge in the same triangle

◆ onEdge()

MRMESH_API MeshEdgePoint MR::MeshTriPoint::onEdge ( const MeshTopology & topology) const
nodiscard

returns valid value if the point is on edge and topology.left(result.e) == topology.left(this->e), otherwise returns invalid MeshEdgePoint

◆ operator bool()

MR::MeshTriPoint::operator bool ( ) const
inlineexplicitnodiscard

◆ operator==()

bool MR::MeshTriPoint::operator== ( const MeshTriPoint & rhs) const
nodiscarddefault

returns true if two points are equal including equal not-unique representation

◆ valid()

bool MR::MeshTriPoint::valid ( ) const
inlinenodiscard

consider this valid if the edge ID is valid

Friends And Related Symbol Documentation

◆ fromSameTriangle() [1/2]

bool fromSameTriangle ( const MeshTopology & topology,
MeshTriPoint && a,
MeshTriPoint && b )
related

returns true if points a and b are located insides or on a boundary of the same triangle; if true a.e and b.e are updated to have that triangle on the left

◆ fromSameTriangle() [2/2]

MRMESH_API bool fromSameTriangle ( const MeshTopology & topology,
MeshTriPoint & a,
MeshTriPoint & b )
related

returns true if points a and b are located insides or on a boundary of the same triangle; if true a.e and b.e are updated to have that triangle on the left

◆ getVertexAsMeshTriPoint()

MRMESH_API MeshTriPoint getVertexAsMeshTriPoint ( const MeshTopology & topology,
EdgeId e,
VertId v )
related

returns MeshTriPoint representation of given vertex with given edge field; or invalid MeshTriPoint if it is not possible

◆ same()

MRMESH_API bool same ( const MeshTopology & topology,
const MeshTriPoint & lhs,
const MeshTriPoint & rhs )
related

returns true if two points are equal considering different representations

Member Data Documentation

◆ bary

TriPointf MR::MeshTriPoint::bary

barycentric coordinates

a in [0,1], a=0 => point is on next( e ) edge, a=1 => point is in dest( e ) b in [0,1], b=0 => point is on e edge, b=1 => point is in dest( next( e ) ) a+b in [0,1], a+b=0 => point is in org( e ), a+b=1 => point is on prev( e.sym() ) edge

◆ e

EdgeId MR::MeshTriPoint::e

left face of this edge is considered


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