mpri-graphics-project/tests/TestImplicitSphere.cpp
Théophile Bastian 7b374c70ae Surfaces now provide a location hint
This is supposed to be a point in space close to the surface
2018-02-13 18:42:15 +01:00

13 lines
383 B
C++

#include "TestImplicitSphere.hpp"
double TestImplicitSphere::operator()(double x, double y, double z) const {
auto sq = [](double x) { return x*x; };
return - (sq(center.x - x)
+ sq(center.y - y)
+ sq(center.z - z))
+ sq(radius);
}
Point TestImplicitSphere::location_hint() const {
return Point(center.x + radius, center.y, center.z);
}