HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_PrimCircle.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: Geometry Library (C++)
7  *
8  * COMMENTS: Circle (ellipse) primitive.
9  *
10  *
11  */
12 
13 #ifndef __GEO_PrimCircle_H__
14 #define __GEO_PrimCircle_H__
15 
16 #include "GEO_API.h"
17 #include "GEO_PrimType.h"
18 #include "GEO_Quadric.h"
19 #include "GEO_Vertex.h"
20 
21 #define GEO_CIRCLE_XSECT_XP 0
22 #define GEO_CIRCLE_XSECT_XN 1
23 #define GEO_CIRCLE_XSECT_YP 2
24 #define GEO_CIRCLE_XSECT_YN 3
25 
26 #define GEO_CIRCLE_GUIDEEDGE_X 0
27 #define GEO_CIRCLE_GUIDEEDGE_Y 1
28 
29 class GEO_Detail;
30 
32 {
33 protected:
34  /// NOTE: The constructor should only be called from subclass
35  /// constructors.
37  : GEO_Quadric(d, offset)
38  {}
39 
40  /// NOTE: The destructor should only be called from subclass
41  /// destructors.
42  virtual ~GEO_PrimCircle() {}
43 
44 public:
45  // Methods inherited from the parent class:
46  virtual int getBBox(UT_BoundingBox *bbox) const;
47  virtual void addToBSphere(UT_BoundingSphere *bsphere) const;
48  virtual UT_Vector3 computeNormal() const;
49  virtual UT_Vector3 baryCenter() const;
50 
51  virtual bool hasGuideEdge(int edgeid, UT_Vector3 &a,
52  UT_Vector3 &b) const;
53  virtual bool hasXsectPoint(int pointid, UT_Vector3 &p) const;
54 
55  virtual fpreal calcVolume(const UT_Vector3 &refpt) const;
56  virtual fpreal calcArea() const;
57  virtual fpreal calcPerimeter() const;
58 
59  virtual const GA_PrimitiveJSON *getJSON() const;
60 
61 protected:
63  { return GEO_Quadric::buildFamilyMask(); }
64 
65  /// All subclasses should call this method to register the curve intrinsics.
66  /// @see GA_IntrinsicManager
69  { return GEO_Quadric::registerIntrinsics(defn); }
70 
71  // Evaluate the position or the derivative at domain point (u,v), where
72  // u and v MUST be in [0,1]. "v" and "dv" will be ignored here. Return 0 if
73  // OK and -1 otherwise.
74  virtual bool evaluatePointRefMap(GA_Offset result_vtx,
75  GA_AttributeRefMap &hlist,
76  fpreal u_unit, fpreal,
77  uint du, uint) const;
78  virtual int evaluatePointV4( UT_Vector4 &pos, float u_unit,
79  float=0, unsigned du=0,
80  unsigned = 0) const;
81 
82 private:
83  friend std::ostream &operator<<(std::ostream &os, const GEO_PrimCircle &d)
84  {
85  d.saveH9(os, 0,
88  return os;
89  }
90 };
91 #endif
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
virtual UT_Vector3 baryCenter() const
3D Vector class.
GA_PrimitiveFamilyMask
#define GA_INVALID_OFFSET
Definition: GA_Types.h:654
GA_Size GA_Offset
Definition: GA_Types.h:617
virtual ~GEO_PrimCircle()
virtual fpreal calcArea() const
virtual const GA_PrimitiveJSON * getJSON() const =0
GLintptr offset
Definition: glcorearb.h:664
Provide a JSON interface to a primitive.
#define GEO_API
Definition: GEO_API.h:10
A handle to simplify manipulation of multiple attributes.
friend std::ostream & operator<<(std::ostream &os, const GEO_PrimCircle &d)
GEO_PrimCircle(GEO_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
virtual fpreal calcPerimeter() const
unsigned int uint
Definition: SYS_Types.h:40
static GA_PrimitiveFamilyMask buildFamilyMask()
static GA_IntrinsicManager::Registrar registerIntrinsics(GA_PrimitiveDefinition &defn)
double fpreal
Definition: SYS_Types.h:270
static const UT_Array< GA_AttribSaveDataH9 > & theEmptySaveAttribs
Convience objects to pass as arguments to saveH9()/loadH9().
static GA_PrimitiveFamilyMask buildFamilyMask()
Return the family mask for all quadric sub-classes.
Definition: GEO_Quadric.h:276
virtual UT_Vector3 computeNormal() const
Return a normal vector for the primitive.
virtual fpreal calcVolume(const UT_Vector3 &) const
virtual bool evaluatePointRefMap(GA_Offset result_vtx, GA_AttributeRefMap &map, fpreal u, fpreal v=0, uint du=0, uint dv=0) const =0
virtual void addToBSphere(UT_BoundingSphere *bsphere) const
Definition of a geometric primitive.
virtual bool hasGuideEdge(int edgeid, UT_Vector3 &a, UT_Vector3 &b) const
static GA_IntrinsicManager::Registrar registerIntrinsics(GA_PrimitiveDefinition &defn)
virtual bool saveH9(std::ostream &os, bool binary, const UT_Array< GA_AttribSaveDataH9 > &prim_attribs, const UT_Array< GA_AttribSaveDataH9 > &vtx_attribs) const
virtual int evaluatePointV4(UT_Vector4 &pos, float u, float v=0, unsigned du=0, unsigned dv=0) const
virtual int getBBox(UT_BoundingBox *bbox) const =0
virtual bool hasXsectPoint(int pointid, UT_Vector3 &p) const