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{
11
12
14{
15 VertId v;
16 float weight = 0;
17};
18
26{
27 EdgeId e;
32 TriPointf bary;
33
34 [[nodiscard]] MeshTriPoint() = default;
35 [[nodiscard]] MeshTriPoint( NoInit ) : e( noInit ), bary( noInit ) { }
36 [[nodiscard]] MeshTriPoint( EdgeId e, TriPointf bary ) : e( e ), bary( bary ) { }
37 [[nodiscard]] MeshTriPoint( const MeshEdgePoint & ep ) : e( ep.e ), bary( ep.a, 0 ) { }
38 [[nodiscard]] MeshTriPoint( const MeshTopology & topology, VertId v ) : MeshTriPoint( MeshEdgePoint( topology, v ) ) { }
39
41 template< typename T >
42 [[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 ) { }
43
45 [[nodiscard]] MRMESH_API VertId inVertex( const MeshTopology & topology ) const;
46
48 [[nodiscard]] bool inVertex() const { return bary.inVertex() >= 0; }
49
52 [[nodiscard]] MRMESH_API MeshEdgePoint onEdge( const MeshTopology & topology ) const;
53
55 [[nodiscard]] MRMESH_API bool isBd( const MeshTopology & topology, const FaceBitSet * region = nullptr ) const;
56
58 [[nodiscard]] MRMESH_API bool fromTriangle( const MeshTopology & topology, FaceId f ) const;
59
61 [[nodiscard]] bool valid() const { return e.valid(); }
62 [[nodiscard]] explicit operator bool() const { return e.valid(); }
63
65 [[nodiscard]] MRMESH_API MeshTriPoint lnext( const MeshTopology & topology ) const;
66
68 [[nodiscard]] MRMESH_API MeshTriPoint canonical( const MeshTopology & topology ) const;
69
71 [[nodiscard]] MRMESH_API std::array<WeightedVertex, 3> getWeightedVerts( const MeshTopology & topology ) const;
72
74 [[nodiscard]] bool operator==( const MeshTriPoint& rhs ) const = default;
75};
76
79
81[[nodiscard]] MRMESH_API bool same( const MeshTopology & topology, const MeshTriPoint& lhs, const MeshTriPoint & rhs );
82
85[[nodiscard]] MRMESH_API bool fromSameTriangle( const MeshTopology & topology, MeshTriPoint & a, MeshTriPoint & b );
86
89[[nodiscard]] inline bool fromSameTriangle( const MeshTopology & topology, MeshTriPoint && a, MeshTriPoint && b ) { return fromSameTriangle( topology, a, b ); }
90
92[[nodiscard]] MRMESH_API MeshTriPoint getVertexAsMeshTriPoint( const MeshTopology & topology, EdgeId e, VertId v );
93
95
96}
Definition MRMeshTopology.h:22
float weight
Definition MRMeshTriPoint.h:16
MeshTriPoint()=default
MRMESH_API MeshTriPoint lnext(const MeshTopology &topology) const
represents the same point relative to next edge in the same triangle
MRMESH_API bool fromSameTriangle(const MeshTopology &topology, MeshTriPoint &a, MeshTriPoint &b)
VertId v
Definition MRMeshTriPoint.h:15
MRMESH_API MeshEdgePoint onEdge(const MeshTopology &topology) const
bool valid() const
consider this valid if the edge ID is valid
Definition MRMeshTriPoint.h:61
MeshTriPoint(NoInit)
Definition MRMeshTriPoint.h:35
bool fromSameTriangle(const MeshTopology &topology, MeshTriPoint &&a, MeshTriPoint &&b)
Definition MRMeshTriPoint.h:89
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...
bool inVertex() const
returns true if the point is in a vertex
Definition MRMeshTriPoint.h:48
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
MeshTriPoint(EdgeId e, TriPointf bary)
Definition MRMeshTriPoint.h:36
TriPointf bary
Definition MRMeshTriPoint.h:32
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 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,...
MRMESH_API bool same(const MeshTopology &topology, const MeshTriPoint &lhs, const MeshTriPoint &rhs)
returns true if two points are equal considering different representations
MeshTriPoint(const MeshTopology &topology, VertId v)
Definition MRMeshTriPoint.h:38
MRMESH_API VertId inVertex(const MeshTopology &topology) const
returns valid vertex id if the point is in vertex, otherwise returns invalid id
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
Definition MRMeshTriPoint.h:42
MeshTriPoint(const MeshEdgePoint &ep)
Definition MRMeshTriPoint.h:37
bool operator==(const MeshTriPoint &rhs) const =default
returns true if two points are equal including equal not-unique representation
MRMESH_API MeshTriPoint canonical(const MeshTopology &topology) const
represents the same point relative to the topology.edgeWithLeft( topology.left( e ) )
EdgeId e
Definition MRMeshTriPoint.h:27
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRMeshTriPoint.h:26
Definition MRVector3.h:33
Definition MRMeshTriPoint.h:14