I am working with adding geometry to a program I am making, and have some questions about the uses of classes.
Here is my class(s) so far. The idea is to have on base class that has the information that is common for all the geometry types, and then have subclasses(?) for the things that are different.
Is this a good way of doing it?Code:
void setType(); // ??
void getType(); // ??
void setName(std::string n);
void setMaterial(Material m);
void setPos(Vector3D pos);
class sphere : public Primitive
void setRadius(float r);
result intersectionTest(Ray r);
Also, for the setType/getType, how would you do them? I want to be able to do something like:
and than it knows that that primitive is a sphere. Should I define SPHERE as 1, BOX as 2 and so on, and do it that way?