MCPcopy Create free account
hub / github.com/ImageEngine/cortex / signedDistance

Method signedDistance

src/IECoreScene/PrimitiveEvaluator.cpp:88–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88bool PrimitiveEvaluator::signedDistance( const Imath::V3f &p, float &distance, Result *result ) const
89{
90 distance = 0.0f;
91
92 bool success = closestPoint( p, result );
93 if ( !success )
94 {
95 return false;
96 }
97
98 float planeConstant = result->normal().dot( result->point() );
99 float sign = result->normal().dot( p ) - planeConstant;
100
101 distance = (result->point() - p ).length() * (sign < std::numeric_limits<float>::epsilon() ? -1.0 : 1.0 );
102
103 return true;
104}

Callers

nothing calls this directly

Calls 2

normalMethod · 0.45
pointMethod · 0.45

Tested by

no test coverage detected