MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::TriPoint< T > Struct Template Reference

encodes a point inside a triangle using barycentric coordinates More...

#include <MRTriPoint.h>

Public Member Functions

constexpr TriPoint () noexcept
 
 TriPoint (NoInit) noexcept
 
constexpr TriPoint (T a, T b) noexcept
 
template<typename U >
 MR_REQUIRES_IF_SUPPORTED (!std::is_same_v< T, U >) const expr TriPoint(const TriPoint< U > &s)
 The condition is needed for the bindings to not duplicate this ctor against the copy ctor.
 
 TriPoint (const Vector3< T > &p, const Vector3< T > &v0, const Vector3< T > &v1, const Vector3< T > &v2)
 given a point coordinates and triangle (v0,v1,v2) computes barycentric coordinates of the point
 
 TriPoint (const Vector3< T > &p, const Vector3< T > &v1, const Vector3< T > &v2)
 given a point coordinates and triangle (0,v1,v2) computes barycentric coordinates of the point
 
template<typename U >
interpolate (const U &v0, const U &v1, const U &v2) const
 given three values in three vertices, computes interpolated value at this barycentric coordinates
 
TriPoint lnext () const
 represents the same point relative to next edge in the same triangle
 
constexpr int inVertex () const
 returns [0,2] if the point is in a vertex or -1 otherwise
 
constexpr int onEdge () const
 
constexpr bool operator== (const TriPoint &rhs) const =default
 returns true if two points have equal (a,b) representation
 

Public Attributes

a
 a in [0,1], a=0 => point is on [v2,v0] edge, a=1 => point is in v1
 
b
 b in [0,1], b=0 => point is on [v0,v1] edge, b=1 => point is in v2
 

Static Public Attributes

static constexpr auto eps = SegmPoint<T>::eps
 

Friends

std::ostream & operator<< (std::ostream &s, const TriPoint &tp)
 
std::istream & operator>> (std::istream &s, TriPoint &tp)
 

Detailed Description

template<typename T>
struct MR::TriPoint< T >

encodes a point inside a triangle using barycentric coordinates

Notations used below: v0, v1, v2 - points of the triangle


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