00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GEO_PrimSphere_H__
00020 #define __GEO_PrimSphere_H__
00021
00022 #include "GEO_API.h"
00023 #include <UT/UT_Vector3.h>
00024 #include "GEO_Quadric.h"
00025 #include "GEO_PrimType.h"
00026 #include "GEO_Vertex.h"
00027
00028 #define GEO_SPHERE_XSECT_XP 0
00029 #define GEO_SPHERE_XSECT_XN 1
00030 #define GEO_SPHERE_XSECT_YP 2
00031 #define GEO_SPHERE_XSECT_YN 3
00032 #define GEO_SPHERE_XSECT_ZP 4
00033 #define GEO_SPHERE_XSECT_ZN 5
00034
00035 #define GEO_SPHERE_GUIDEEDGE_X 0
00036 #define GEO_SPHERE_GUIDEEDGE_Y 1
00037 #define GEO_SPHERE_GUIDEEDGE_Z 2
00038
00039 class GEO_API GEO_PrimSphere : public GEO_Quadric {
00040 public:
00041 GEO_PrimSphere(GEO_Detail *d);
00042 virtual ~GEO_PrimSphere();
00043
00044 virtual unsigned getPrimitiveId() const;
00045
00046
00047
00048
00049
00050 virtual bool evaluatePoint( GEO_Vertex &result,
00051 GEO_AttributeHandleList &hlist,
00052 fpreal u, fpreal v,
00053 unsigned du, unsigned dv) const;
00054 virtual int evaluatePoint( UT_Vector4 &pos, float u, float v = 0,
00055 unsigned du=0, unsigned dv=0) const;
00056 virtual int evaluatePointWAttrib(UT_Vector4 &pos,
00057 GB_AttributeData &adata,
00058 const GB_FloatOffsets &foffsets,
00059 float u, float v = 0, unsigned du = 0,
00060 unsigned dv = 0) const;
00061 virtual int evaluateNormalVector(UT_Vector3 &nml, float u,
00062 float v = 0) const;
00063
00064 virtual int getBBox(UT_BoundingBox *bbox) const;
00065 virtual void addToBSphere(UT_BoundingSphere *bsphere) const;
00066
00067
00068 virtual int hasGuideEdge(int edgeid, UT_Vector4 &a,
00069 UT_Vector4 &b) const;
00070 virtual int hasXsectPoint(int pointid, UT_Vector4 &p) const;
00071
00072 virtual float calcVolume(UT_Vector3 &refpt) const;
00073 virtual float calcArea() const;
00074 virtual float calcPerimeter() const;
00075 protected:
00076
00077 private:
00078 friend ostream &operator<<(ostream &os, const GEO_PrimSphere &d)
00079 {
00080 d.save(os, 0);
00081 return os;
00082 }
00083 };
00084 #endif