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

Function triangleSolidAngle

source/MRTest/MRDipoleTests.cpp:12–23  ·  view source on GitHub ↗

see (6) in https://users.cs.utah.edu/~ladislav/jacobson13robust/jacobson13robust.pdf

Source from the content-addressed store, hash-verified

10
11/// see (6) in https://users.cs.utah.edu/~ladislav/jacobson13robust/jacobson13robust.pdf
12static float triangleSolidAngle( const Vector3f & p, const Triangle3f & tri )
13{
14 Matrix3f m;
15 m.x = tri[0] - p;
16 m.y = tri[1] - p;
17 m.z = tri[2] - p;
18 auto x = m.x.length();
19 auto y = m.y.length();
20 auto z = m.z.length();
21 auto den = x * y * z + dot( m.x, m.y ) * z + dot( m.y, m.z ) * x + dot( m.z, m.x ) * y;
22 return 2 * std::atan2( m.det(), den );
23}
24
25TEST(MRMesh, TriangleSolidAngle)
26{

Callers 1

TESTFunction · 0.70

Calls 3

dotFunction · 0.50
lengthMethod · 0.45
detMethod · 0.45

Tested by

no test coverage detected