How to implement your own implicit functions

You need to make a class inheriting from built-in class ImplicitFunction. You have to write your function using interval objects. Then, instanciate an Implicit object with an instance of your class :

class MySphereClass : public ImplicitFunction {
public:
   MySphereClass(double radius) {
      squaredRadius = radius*radius;
   }
   interval f(interval x, interval y, interval z) {

      return x*x + y*y + z*z - r2;
   }


private:
   double squaredRadius;
};


Then, in the scene declaration :

MySphereClass mySphere(1.2);
Implicit myImplicit(mySphere)
// set material, position and orientation here
myScene.addObject(myImplicit)