00001
00002
00003
00004
00005
00006 #ifndef TORUS_H
00007 #define TORUS_H
00008
00009 #include<ImplicitShape.h>
00010 #include<Vertex3.h>
00011 #include<real.h>
00012
00015 class Torus : public ImplicitShape
00016 {
00017 DYNAMIC_OBJECT;
00018 public:
00019 Torus(
00020 Vertex3 position = Vertex3(0.0, 0.0, 0.0),
00021 Vertex3 normal = Vertex3(0.0, 1.0, 0.0),
00022 real major = 1.0,
00023 real minor = 0.1
00024 ) : p(position), n(normal), R(major), r(minor) {
00025 n.normalize();
00026 }
00027
00028
00029 real distance(const Vertex3 &v);
00030
00031
00032 Vertex3 normal(const Vertex3 &v);
00033
00034
00035 void parseSymbol(Token &t, ObjectFile &file);
00036 void writeParams(ostream &stream);
00037
00038 protected:
00039
00040 void createSymbols();
00041
00042 Vertex3 p;
00043 Vertex3 n;
00044 real r;
00045 real R;
00046
00047 private:
00048 typedef ImplicitShape super;
00049 };
00050 #endif