MeshLib C++ Docs
Loading...
Searching...
No Matches
MRMeshTriPoint.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRId.h"
4#include "MRTriPoint.h"
5#include "MREdgePoint.h"
6
7namespace MR
8{
9
10struct WeightedVertex
11{
12 VertId v;
13 float weight = 0;
14};
15
22struct MeshTriPoint
23{
24 EdgeId e;
29 TriPointf bary;
30
31 [[nodiscard]] MeshTriPoint() = default;
32 [[nodiscard]] MeshTriPoint( NoInit ) : e( noInit ), bary( noInit ) { }
33 [[nodiscard]] MeshTriPoint( EdgeId e, TriPointf bary ) : e( e ), bary( bary ) { }
34 [[nodiscard]] MeshTriPoint( const MeshEdgePoint & ep ) : e( ep.e ), bary( ep.a, 0 ) { }
35 [[nodiscard]] MeshTriPoint( const MeshTopology & topology, VertId v ) : MeshTriPoint( MeshEdgePoint( topology, v ) ) { }
36
38 template< typename T >
39 [[nodiscard]] MeshTriPoint( EdgeId e, const Vector3<T> & p, const Vector3<T> & v0, const Vector3<T> & v1, const Vector3<T> & v2 ) : e( e ), bary( p, v0, v1, v2 ) { }
40
42 [[nodiscard]] MRMESH_API VertId inVertex( const MeshTopology & topology ) const;
43
45 [[nodiscard]] bool inVertex() const { return bary.inVertex() >= 0; }
46
49 [[nodiscard]] MRMESH_API MeshEdgePoint onEdge( const MeshTopology & topology ) const;
50
52 [[nodiscard]] MRMESH_API bool isBd( const MeshTopology & topology, const FaceBitSet * region = nullptr ) const;
53
55 [[nodiscard]] MRMESH_API bool fromTriangle( const MeshTopology & topology, FaceId f ) const;
56
58 [[nodiscard]] bool valid() const { return e.valid(); }
59 [[nodiscard]] explicit operator bool() const { return e.valid(); }
60
62 [[nodiscard]] MRMESH_API MeshTriPoint lnext( const MeshTopology & topology ) const;
63
65 [[nodiscard]] MRMESH_API MeshTriPoint canonical( const MeshTopology & topology ) const;
66
68 [[nodiscard]] MRMESH_API std::array<WeightedVertex, 3> getWeightedVerts( const MeshTopology & topology ) const;
69
71 [[nodiscard]] bool operator==( const MeshTriPoint& rhs ) const = default;
72};
73
76
78[[nodiscard]] MRMESH_API bool same( const MeshTopology & topology, const MeshTriPoint& lhs, const MeshTriPoint & rhs );
79
82[[nodiscard]] MRMESH_API bool fromSameTriangle( const MeshTopology & topology, MeshTriPoint & a, MeshTriPoint & b );
83
86[[nodiscard]] inline bool fromSameTriangle( const MeshTopology & topology, MeshTriPoint && a, MeshTriPoint && b ) { return fromSameTriangle( topology, a, b ); }
87
89[[nodiscard]] MRMESH_API MeshTriPoint getVertexAsMeshTriPoint( const MeshTopology & topology, EdgeId e, VertId v );
90
92
93} // namespace MR
#define MRMESH_API
Definition MRMeshFwd.h:80
new unsafe MR.TriPointf bary
unsafe MeshTriPoint()
static unsafe bool fromSameTriangle(MR.Const_MeshTopology topology, MR.MeshTriPoint a, MR.MeshTriPoint b)
static unsafe MR.MeshTriPoint getVertexAsMeshTriPoint(MR.Const_MeshTopology topology, MR.EdgeId e, MR.VertId v)
Definition MRCameraOrientationPlugin.h:8
MRMESH_API bool same(const MeshTopology &topology, const EdgePoint &lhs, const EdgePoint &rhs)
returns true if two edge-points are equal considering different representations