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  bool getBBox(UT_BoundingBox *bbox) const override;
47  void addToBSphere(UT_BoundingSphere *bsphere) const override;
48  UT_Vector3D computeNormalD() const override;
49  UT_Vector3 computeNormal() const override;
50  UT_Vector3 baryCenter() const override;
51 
52  bool hasGuideEdge(int edgeid,
53  UT_Vector3 &a,
54  UT_Vector3 &b) const override;
55  bool hasXsectPoint(int pointid,
56  UT_Vector3 &p) const override;
57 
58  fpreal calcVolume(const UT_Vector3 &refpt) const override;
59  fpreal calcArea() const override;
60  fpreal calcPerimeter() const override;
61 
62  const GA_PrimitiveJSON *getJSON() const override;
63 
64 protected:
66  { return GEO_Quadric::buildFamilyMask(); }
67 
68  /// All subclasses should call this method to register the curve intrinsics.
69  /// @see GA_IntrinsicManager
72  { return GEO_Quadric::registerIntrinsics(defn); }
73 
74  // Evaluate the position or the derivative at domain point (u,v), where
75  // u and v MUST be in [0,1]. "v" and "dv" will be ignored here. Return 0 if
76  // OK and -1 otherwise.
78  GA_Offset result_vtx,
79  GA_AttributeRefMap &hlist,
80  fpreal u_unit, fpreal,
81  uint du, uint) const override;
82  int evaluatePointV4(
83  UT_Vector4 &pos,
84  float u_unit, float=0,
85  unsigned du=0, unsigned = 0) const override;
86 
87 private:
88  friend std::ostream &operator<<(std::ostream &os, const GEO_PrimCircle &d)
89  {
90  d.saveH9(os, 0,
93  return os;
94  }
95 };
96 #endif
fpreal calcPerimeter() const override
fpreal calcVolume(const UT_Vector3 &) const override
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
UT_Vector3D computeNormalD() const override
fpreal calcArea() const override
GA_PrimitiveFamilyMask
#define GA_INVALID_OFFSET
Definition: GA_Types.h:687
GA_Size GA_Offset
Definition: GA_Types.h:646
GLintptr offset
Definition: glcorearb.h:665
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)
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
~GEO_PrimCircle() override
static GA_PrimitiveFamilyMask buildFamilyMask()
static GA_IntrinsicManager::Registrar registerIntrinsics(GA_PrimitiveDefinition &defn)
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:220
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.
bool getBBox(UT_BoundingBox *bbox) const override=0
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