Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members Related Pages
bvolume.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 # ifndef OPENVRML_BVOLUME_H
00022 # define OPENVRML_BVOLUME_H
00023
00024 # include <iosfwd>
00025 # include "common.h"
00026
00027 namespace OpenVRML {
00028
00029 class VrmlFrustum;
00030 class AABox;
00031 class BSphere;
00032 class VrmlMatrix;
00033
00034 class OPENVRML_SCOPE BVolume {
00035 public:
00036 enum Intersection { inside = 1, outside = -1, partial = 0 };
00037
00038 virtual ~BVolume() = 0;
00039 virtual bool isMAX() const = 0;
00040 virtual void setMAX() = 0;
00041 virtual Intersection
00042 intersectFrustum(const VrmlFrustum & frustum) const = 0;
00043 virtual void extend(const BVolume & b) = 0;
00044 virtual void extend(const float p[3]) = 0;
00045 virtual void extend(const AABox & b) = 0;
00046 virtual void extend(const BSphere & b) = 0;
00047 virtual void enclose(const float* p, int n) = 0;
00048 virtual void orthoTransform(const VrmlMatrix & M) = 0;
00049 virtual void transform(const VrmlMatrix & M) = 0;
00050 };
00051
00052
00053 class SFVec3f;
00054
00055 class OPENVRML_SCOPE BSphere : public BVolume {
00056 float c[3];
00057 float r;
00058
00059 public:
00060 BSphere();
00061 BSphere(const BSphere & rhs);
00062 virtual ~BSphere();
00063
00064 void reset();
00065
00066 virtual Intersection
00067 intersectFrustum(const VrmlFrustum & frustum) const;
00068
00069 virtual void extend(const BVolume & b);
00070 virtual void extend(const float p[3]) ;
00071 virtual void extend(const AABox & b);
00072 virtual void extend(const BSphere & b);
00073 virtual void enclose(const float* p, int n);
00074
00075 virtual bool isMAX() const;
00076 virtual void setMAX();
00077
00078 virtual void orthoTransform(const VrmlMatrix & M);
00079 virtual void transform(const VrmlMatrix & M);
00080
00081 const float* getCenter() const;
00082 void setCenter(const SFVec3f & c);
00083 void setCenter(float x, float y, float z);
00084 void setCenter(const float ac[3]);
00085
00086 float getRadius() const;
00087 void setRadius(float r);
00088 };
00089
00090
00091 class OPENVRML_SCOPE AABox : public BVolume {
00092 public:
00093 virtual ~AABox();
00094 virtual Intersection
00095 intersectFrustum(const VrmlFrustum & frustum) const;
00096 virtual void extend(const BVolume & b);
00097 virtual void extend(const float p[3]);
00098 virtual void extend(const AABox & b);
00099 virtual void extend(const BSphere & b);
00100 virtual void enclose(const float* p, int n);
00101 virtual bool isMAX() const;
00102 virtual void setMAX();
00103 virtual void orthoTransform(const VrmlMatrix & M);
00104 virtual void transform(const VrmlMatrix & M);
00105 };
00106 }
00107
00108 #endif