MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / distance

Method distance

Tools/VolumeSampling/SamplingBase.cpp:297–309  ·  view source on GitHub ↗

Determine distance of a point x to the surface of the mesh and corresponding surface normal and next point on the surface.

Source from the content-addressed store, hash-verified

295// Determine distance of a point x to the surface of the mesh and corresponding surface normal and
296// next point on the surface.
297double SamplingBase::distance(const Vector3r& x, const Real tolerance, Vector3r& normal, Vector3r& nextSurfacePoint)
298{
299 Eigen::Vector3d n;
300 const double dist = m_distanceField->interpolate(0, x.template cast<double>(), &n);
301 if (dist == std::numeric_limits<double>::max())
302 return dist;
303 n.normalize();
304 normal = n.template cast<Real>();
305
306 nextSurfacePoint = (x - dist * normal);
307
308 return dist - tolerance;
309}
310
311// Determine distance of a point x to the surface of the mesh
312double SamplingBase::distance(const Vector3r& x, const Real tolerance)

Callers

nothing calls this directly

Calls 2

maxFunction · 0.85
normalizeMethod · 0.45

Tested by

no test coverage detected