Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CSG.h

00001 /*
00002   File: CSG.h
00003 
00004   Copyright(C) C. Kotterink, Computed Graphics
00005 */
00006 #ifndef CSG_H
00007 #define CSG_H
00008 #include<ImplicitShape.h>
00009 
00010 #include<vector>
00011 
00014 class CSG : public ImplicitShape
00015 {
00016     DYNAMIC_OBJECT;
00017 public:
00018     typedef enum Operation {
00019         Union,
00020         Intersection,
00021         Difference
00022     };
00023     
00024     CSG(): operation(Union) {}
00025 
00026     virtual ~CSG();
00027 
00028     // Inherited from ImplicitShape
00029     real distance(const Vertex3 &v);
00030 
00031     // Inherited from Shape
00032     real intersect(
00033         const Ray &ray, real t = step, real T = infinity);
00034     Vertex3 normal(const Vertex3 &v);
00035     Color4 calculateShade(
00036         const SurfaceInfo &s, Vertex3 &transformed, Scene &scene);
00037 
00038     // Inherited from DynamicObject
00039     void parseSymbol(Token &t, ObjectFile &file);
00040     void writeParams(ostream &stream);
00041 
00042 protected:
00043     typedef ImplicitShape *ImplicitPointer;
00044 
00045     real closestShape(const Vertex3 &v, ImplicitPointer &shape);
00046     real intersectUnion(const Ray &ray, real t = step, real T = infinity);
00047 
00048     // Inherited from DynamicObject
00049     void createSymbols();
00050 
00051     Operation operation;
00052     vector<ImplicitShape*> array;
00053 
00054 private:
00055     typedef ImplicitShape super;
00056 };
00057 #endif

This documentation was generated using doxygen. If you have any comments or additions please mail me.