MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / compute_angle

Function compute_angle

src/geode/geometry/quality.cpp:44–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42{
43 template < geode::index_t dimension >
44 double compute_angle( const geode::Point< dimension >& point,
45 const geode::Point< dimension >& point_prev,
46 const geode::Point< dimension >& point_next )
47 {
48 const auto prev =
49 geode::Vector< dimension >{ point, point_prev }.normalize();
50 const auto next =
51 geode::Vector< dimension >{ point, point_next }.normalize();
52 const auto dot = std::clamp( prev.dot( next ), -1.0, 1.0 );
53 const auto angle = std::acos( dot );
54 if( std::isnan( angle ) )
55 {
56 return 0;
57 }
58 return angle;
59 }
60
61 std::array< geode::local_index_t, 3 > lu_decomposition(
62 geode::SquareMatrix3D& matrix )

Callers 1

Calls 2

normalizeMethod · 0.80
dotMethod · 0.80

Tested by

no test coverage detected