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  ~GEO_PrimCircle() override {}
43 
44 public:
45  // Methods inherited from the parent class:
46  int getBBox(UT_BoundingBox *bbox) const override;
47  void addToBSphere(UT_BoundingSphere *bsphere) const override;
48  UT_Vector3 computeNormal() const override;
49  UT_Vector3 baryCenter() const override;
50 
51  bool hasGuideEdge(int edgeid,
52  UT_Vector3 &a,
53  UT_Vector3 &b) const override;
54  bool hasXsectPoint(int pointid,
55  UT_Vector3 &p) const override;
56 
57  fpreal calcVolume(const UT_Vector3 &refpt) const override;
58  fpreal calcArea() const override;
59  fpreal calcPerimeter() const override;
60 
61  const GA_PrimitiveJSON *getJSON() const override;
62 
63 protected:
65  { return GEO_Quadric::buildFamilyMask(); }
66 
67  /// All subclasses should call this method to register the curve intrinsics.
68  /// @see GA_IntrinsicManager
71  { return GEO_Quadric::registerIntrinsics(defn); }
72 
73  // Evaluate the position or the derivative at domain point (u,v), where
74  // u and v MUST be in [0,1]. "v" and "dv" will be ignored here. Return 0 if
75  // OK and -1 otherwise.
77  GA_Offset result_vtx,
78  GA_AttributeRefMap &hlist,
79  fpreal u_unit, fpreal,
80  uint du, uint) const override;
81  int evaluatePointV4(
82  UT_Vector4 &pos,
83  float u_unit, float=0,
84  unsigned du=0, unsigned = 0) const override;
85 
86 private:
87  friend std::ostream &operator<<(std::ostream &os, const GEO_PrimCircle &d)
88  {
89  d.saveH9(os, 0,
92  return os;
93  }
94 };
95 #endif
fpreal calcPerimeter() const override
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
fpreal calcVolume(const UT_Vector3 &) const override
4D Vector class.
Definition: UT_Vector4.h:166
fpreal calcArea() const override
GA_PrimitiveFamilyMask
#define GA_INVALID_OFFSET
Definition: GA_Types.h:676
GA_Size GA_Offset
Definition: GA_Types.h:639
virtual const GA_PrimitiveJSON * getJSON() const =0
Provide a JSON interface to a primitive.
#define GEO_API
Definition: GEO_API.h:14
A handle to simplify manipulation of multiple attributes.
UT_Vector3 baryCenter() const override
friend std::ostream & operator<<(std::ostream &os, const GEO_PrimCircle &d)
GEO_PrimCircle(GEO_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
~GEO_PrimCircle() override
static GA_PrimitiveFamilyMask buildFamilyMask()
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
GLfloat GLfloat p
Definition: glew.h:16321
static GA_IntrinsicManager::Registrar registerIntrinsics(GA_PrimitiveDefinition &defn)
int getBBox(UT_BoundingBox *bbox) const override=0
static const UT_Array< GA_AttribSaveDataH9 > & theEmptySaveAttribs
Convience objects to pass as arguments to saveH9()/loadH9().
bool saveH9(std::ostream &os, bool binary, const UT_Array< GA_AttribSaveDataH9 > &prim_attribs, const UT_Array< GA_AttribSaveDataH9 > &vtx_attribs) const override
fpreal64 fpreal
Definition: SYS_Types.h:277
static GA_PrimitiveFamilyMask buildFamilyMask()
Return the family mask for all quadric sub-classes.
Definition: GEO_Quadric.h:219
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)
unsigned int uint
Definition: SYS_Types.h:45
UT_Vector3 computeNormal() const override
Return a normal vector for the primitive.
virtual int evaluatePointV4(UT_Vector4 &pos, float u, float v=0, unsigned du=0, unsigned dv=0) const
virtual bool hasXsectPoint(int pointid, UT_Vector3 &p) const
GLintptr offset
Definition: glew.h:1682