15 #ifndef GENUA_TRIFACE_H
16 #define GENUA_TRIFACE_H
51 if (
v[0] ==
v[1] or
v[0] ==
v[2] or
v[1] ==
v[2])
83 for (uint k=0; k<3; ++k) {
85 if (vk != s and vk != t)
104 order(repl[
v[0]], repl[v[1]], repl[v[2]]);
109 for (uint k=0; k<3; ++k) {
135 Real
corner(uint i)
const;
177 else if (
v[0] > a.
v[0])
179 else if (
v[1] < a.
v[1])
181 else if (
v[1] > a.
v[1])
184 return (
v[2] < a.
v[2]);
191 else if (
v[1] != a.
v[1])
193 else if (
v[2] != a.
v[2])
203 else if (
v[1] == a.
v[1] and
v[2] == a.
v[2])
205 else if (
v[2] == a.
v[1] and
v[1] == a.
v[2])
213 return !(*
this == a);
224 uint64_t a = uint64_t(
v[0]);
225 uint64_t b = uint64_t(
v[1]);
226 uint64_t c = uint64_t(
v[2]);
227 uint64_t d = uint64_t(ptrdiff_t(
msh));
228 return jenkins_hash(a, b, c, d);
234 void order(uint a, uint b, uint c) {
235 if (a < b and a < c) {
239 }
else if (b < a and b < c) {
262 struct global_face_less
275 struct global_face_equal
290 size_t operator() (
const TriFace & a)
const {
return a.
hash();}
bool inRange() const
check if vertex indices are in range
Definition: triface.cpp:25
uint * vertices()
access vertices
Definition: triface.h:70
void xIntegrate(const Vector &p, const Vct3 &ref, Vct3 &pn, Vct3 &rxpn) const
surface integration, add int(p*n dA) and int(r x pn dA) to sums
Definition: triface.cpp:369
void tag(int t)
change tag value
Definition: triface.h:220
Vct3 project(const Vct3 &pt) const
project, return parameters and signed distance to projection
Definition: triface.cpp:144
uint v[3]
vertex indices
Definition: triface.h:253
Real corner(uint i) const
compute the internal angle at vertex i
Definition: triface.cpp:81
Vct3 eval(Real up, Real vp) const
compute point on triangle
Definition: triface.cpp:33
const uint * vertices() const
access vertices
Definition: triface.h:67
Real area() const
compute area
Definition: triface.cpp:62
void invalidate()
make triangle invalid, to force elimination by TriMesh::fixate()
Definition: triface.h:61
bool operator<(const TriFace &a) const
sorting criterion
Definition: triface.h:174
TriFace()
construct unconnected face
Definition: triface.h:37
Specialized triangular surface mesh.
Definition: trimesh.h:52
int tag() const
access tag value
Definition: triface.h:217
uint replace(uint iold, uint inew)
replace a single vertex index, fix ordering
Definition: triface.h:108
Triangular face of a TriMesh.
Definition: triface.h:32
void itranslate(const Indices &repl)
translate vertex indices
Definition: triface.h:103
uint64_t hash() const
compute a hash value
Definition: triface.h:223
bool isValid() const
check if all three vertices are distinct
Definition: triface.h:50
Vct3 center() const
compute triangle center
Definition: triface.cpp:44
bool intersect(const Plane &pln, Vct3 &src, Vct3 &trg) const
Determine intersection segment with plane pln.
Definition: triface.cpp:256
Vct3 pierce(const Vct3 &a, const Vct3 &b) const
Find the point where a line (a-b) would pierce this face, return the projection parameter (u...
Definition: triface.cpp:169
Fixed size matrix.
Definition: forward.h:412
void bind(const TriMesh *m, uint off=0)
rebind to different mesh and offset vertex indices
Definition: triface.h:92
void order(uint a, uint b, uint c)
set vertices in correct order
Definition: triface.h:234
A plane in three dimensions.
Definition: plane.h:42
Real solidAngle(uint idx) const
compute solid angle with respect to vertex idx
Definition: triface.cpp:98
Vct3 normal() const
compute normal vector (not normalized)
Definition: triface.cpp:53
void gradient(Mtx33 &gm) const
Gradient.
Definition: triface.cpp:309
bool equivalent(const TriFace &a) const
equivalent, but possibly flipped
Definition: triface.h:200
Real minDistance(const Vct3 &pt, Vct2 &foot) const
return minimum signed distance of pt to this triangle, set foot point parameter
Definition: triface.cpp:187
uint opposed(const TriEdge &e) const
find vertex opposed to edge ei
Definition: triface.h:80
TriFace(const TriMesh *m, uint a, uint b, uint c)
construct connected face
Definition: triface.h:40
bool operator==(const TriFace &a) const
equivalence
Definition: triface.h:188
Real dotIntegrate(const Vector &p, const PointList< 3 > &z) const
surface integration, return int( dot(pn,z) dA )
Definition: triface.cpp:404
void reverse()
flip normal direction
Definition: triface.h:100
bool operator!=(const TriFace &a) const
difference
Definition: triface.h:212
void getVertices(uint *vi) const
copy vertex indices
Definition: triface.h:73
void edgeLengths(Vct3 &elen) const
compute the length of all three edges
Definition: triface.cpp:433
const TriMesh * mesh() const
access mesh
Definition: triface.h:64
int ftag
marker tag
Definition: triface.h:256
const TriMesh * msh
connected mesh
Definition: triface.h:259
void assign(const TriMesh *m, uint a, uint b, uint c)
set mesh and vertices
Definition: triface.h:44