MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / orient3d

Function orient3d

source/MRMesh/MRPrecisePredicates3.cpp:111–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109} // anonymous namespace
110
111bool orient3d( const Vector3i & a, const Vector3i& b, const Vector3i& c )
112{
113 auto vhp = dot( Vector3i128fast{ a }, Vector3i128fast{ cross( Vector3i64{ b }, Vector3i64{ c } ) } );
114 if ( vhp ) return vhp > 0;
115
116 auto v = cross( Vector2i64{ b.x, b.y }, Vector2i64{ c.x, c.y } );
117 if ( v ) return v > 0;
118
119 v = -cross( Vector2i64{ b.x, b.z }, Vector2i64{ c.x, c.z } );
120 if ( v ) return v > 0;
121
122 v = cross( Vector2i64{ b.y, b.z }, Vector2i64{ c.y, c.z } );
123 if ( v ) return v > 0;
124
125 v = -cross( Vector2i64{ a.x, a.y }, Vector2i64{ c.x, c.y } );
126 if ( v ) return v > 0;
127
128 if ( c.x ) return c.x > 0;
129
130 if ( c.y ) return c.y < 0;
131
132 v = cross( Vector2i64{ a.x, a.z }, Vector2i64{ c.x, c.z } );
133 if ( v ) return v > 0;
134
135 if ( c.z ) return c.z > 0;
136
137#ifndef NDEBUG
138 v = -cross( Vector2i64{ a.y, a.z }, Vector2i64{ c.y, c.z } );
139 assert( v == 0 );
140 if ( v ) return v > 0;
141#endif
142
143 v = cross( Vector2i64{ a.x, a.y }, Vector2i64{ b.x, b.y } );
144 if ( v ) return v > 0;
145
146 if ( b.x ) return b.x < 0;
147
148 if ( b.y ) return b.y > 0;
149
150 if ( a.x ) return a.x > 0;
151
152 return true;
153}
154
155bool orient3d( const PreciseVertCoords* vs )
156{

Callers 2

segmentIntersectionOrderFunction · 0.70

Calls 4

dotFunction · 0.70
crossFunction · 0.70
swapFunction · 0.70
dataMethod · 0.45

Tested by

no test coverage detected