Center is an attribute of ImplicitSurface.

This way the search space for Marching Cubes is way smaller.
This commit is contained in:
Rémi Oudin 2018-02-12 11:37:38 +01:00
parent 1e059742f4
commit 9e605b0fec
4 changed files with 6 additions and 4 deletions

View file

@ -6,4 +6,8 @@ class ImplicitSurface {
public: public:
virtual double operator() (double x, double y, double z) const = 0; virtual double operator() (double x, double y, double z) const = 0;
double operator()(const Point& pt) const; double operator()(const Point& pt) const;
Point getCenter() { return center;}
protected:
Point center;
ImplicitSurface(Point _center) : center(_center) {}
}; };

View file

@ -5,7 +5,7 @@
#include "spheroid.hpp" #include "spheroid.hpp"
Spheroid::Spheroid(Point& _center, size_t _p, size_t _q) : Spheroid::Spheroid(Point& _center, size_t _p, size_t _q) :
center(_center), p(_p), q(_q), stiffness(0) { ImplicitSurface(_center), p(_p), q(_q), stiffness(0) {
_compute_volume(); _compute_volume();
} }

View file

@ -31,7 +31,6 @@ class Spheroid : public ImplicitSurface {
* V is the volume. Extremely useful to have a constant volume in the * V is the volume. Extremely useful to have a constant volume in the
* ball * ball
**/ **/
Point& center;
double p, q; double p, q;
size_t stiffness; size_t stiffness;
double V; double V;

View file

@ -5,10 +5,9 @@
class TestImplicitSphere: public ImplicitSurface { class TestImplicitSphere: public ImplicitSurface {
public: public:
TestImplicitSphere(const Point& center, double r): TestImplicitSphere(const Point& center, double r):
center(center), radius(r) {} ImplicitSurface(center), radius(r) {}
virtual double operator()(double x, double y, double z) const; virtual double operator()(double x, double y, double z) const;
private: private:
Point center;
double radius; double radius;
}; };