HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_Profiles.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:
9  * This defines the detail of domain profiles.
10  */
11 
12 #ifndef __GEO_Profiles_h__
13 #define __GEO_Profiles_h__
14 
15 #include "GEO_API.h"
16 #include <GD/GD_Detail.h>
17 #include <GD/GD_TrimLoop.h>
18 #include <UT/UT_BoundingBox.h>
19 
20 class GA_Basis;
21 class GA_PrimitiveGroup;
22 class GD_Face;
23 class GD_TrimLoop;
24 class GEO_Face;
25 class GEO_TPSurf;
26 class GEO_Detail;
27 class UT_MemoryCounter;
28 
30 {
31  friend class GEO_TPSurf;
32 
33 public:
34  GEO_Profiles(GEO_TPSurf &tpsurf);
35  ~GEO_Profiles() override;
36 
37  GA_Detail *cloneEmptyDetail(bool clone_attributes) const override;
38 
39  // Take a GEO face and map it parametrically onto our surface. If the
40  // bbox pointer is zero, we compute the face's bbox. Otherwise, we use
41  // the given bbox instead.
42  GD_Face *map(const GEO_Face &face, UT_Axis3::axis uaxis,
43  UT_Axis3::axis vaxis, float umin, float umax,
44  float vmin, float vmax, int unif,
45  UT_BoundingBox *bbox = 0);
46 
47  // Take a GEO face and map it parametrically onto our surface without
48  // constraining it to a uvmin/uvmax range.
49  GD_Face *map(const GEO_Face &face,
52 
53  // Map a whole group of primitives onto the surface. The method filters
54  // out the non face types and returns the number of faces mapped (0 or
55  // more). If problems occur, the value returned is -1. If gdp is 0, we
56  // assume it's the gdp our surface lives in.
57  int map(const GA_PrimitiveGroup &faces,
58  UT_Axis3::axis uaxis,
59  UT_Axis3::axis vaxis, float umin, float umax,
60  float vmin, float vmax, int unif,
61  const GEO_Detail *gdp = 0);
62 
63  // Remap an existing curve on surface so that it translates and/or
64  // scales itself in the domain of the surface. Return 0 if OK and -1
65  // otherwise.
66  int remap(GD_Primitive &profile, float umin, float umax,
67  float vmin, float vmax, int unif)
68  {
69  return remap(profile.getMapIndex(),umin, umax,
70  vmin, vmax, unif);
71  }
72  int remap(int profileidx, float umin, float umax,
73  float vmin, float vmax, int unif);
74 
75  //
76  // Reverse the faces and the trim regions:
77  void reverseU();
78  void reverseV();
79 
80  // Return the bounds of the valid interval of the surface we're defined
81  // for.
82  void getDomainBBox(float &u0, float &v0,
83  float &u1, float &v1) const override;
84 
85  GD_TrimLoop *getTrimLoops(GD_TrimRule rule);
86 
87  int getMaxHeight();
88  int getBaseDir();
89 
90  const GEO_TPSurf &getSurf() const { return mySurf; }
91 
92  int64 getMemoryUsage(bool inclusive) const override
93  {
94  int64 mem = inclusive ? sizeof(*this) : 0;
95  mem += GD_Detail::getMemoryUsage(false);
96  return mem;
97  }
98 
99  void countMemory(UT_MemoryCounter &counter, bool inclusive) const override;
100 
101 private:
102  // The surface we belong to:
103  GEO_TPSurf &mySurf;
104 
105  int getUVRange(float umin, float umax, float vmin,
106  float vmax, int unif, float &uka,
107  float &ukb, float &vka, float &vkb,
108  GA_Basis *&ubunif, GA_Basis *&vbunif,
109  GA_Basis *&uchrd, GA_Basis *&vchrd) const;
110 
111  GD_Face *doMap(const GEO_Face &face,
112  UT_Axis3::axis uaxis, UT_Axis3::axis vaxis,
113  float uka, float ulen, float vka, float vlen,
114  int unif, GA_Basis *ubunif, GA_Basis *vbunif,
115  GA_Basis *ubchord, GA_Basis *vbchord,
116  UT_BoundingBox *bbox);
117 
118  void doMap(GD_Face &face,
119  float uka, float ulen, float vka, float vlen,
120  int unif, GA_Basis *ubunif, GA_Basis *vbunif,
121  GA_Basis *ubchord, GA_Basis *vbchord);
122 
123  /// Delete the primitive at the given offset. Optionally, delete the points
124  /// referenced by the primitive.
127  bool and_points = false) override;
128 
129  /// Destroy the given primitives. Optionally destroy any referenced points
130  /// that will no longer be in use after this operation. Note that this
131  /// option requires full topology.
133  const GA_Range &it,
134  bool and_points = false) override;
135 
136  // Friends:
137  friend std::ostream &operator<<(std::ostream &os, const GEO_Profiles &d)
138  {
139  d.save(os, 0, 0);
140  return os;
141  }
142 };
143 
144 #endif
const GEO_TPSurf & getSurf() const
Definition: GEO_Profiles.h:90
GA_Size destroyPrimitiveOffsets(const GA_Range &it, bool and_points=false) override
virtual GA_Detail * cloneEmptyDetail(bool clone_attributes) const =0
int remap(GD_Primitive &profile, float umin, float umax, float vmin, float vmax, int unif)
Definition: GEO_Profiles.h:66
void countMemory(UT_MemoryCounter &counter, bool inclusive) const override
void reverseV() override
GLdouble u1
Definition: glad.h:2676
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:235
friend std::ostream & operator<<(std::ostream &os, const GEO_Profiles &d)
Definition: GEO_Profiles.h:137
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_Size GA_Offset
Definition: GA_Types.h:641
GD_TrimRule
Definition: GD_TrimLoop.h:51
GLintptr offset
Definition: glcorearb.h:665
#define GEO_API
Definition: GEO_API.h:14
Bezier or NURBS basis classes which maintain knot vectors.
Definition: GA_Basis.h:49
long long int64
Definition: SYS_Types.h:116
IOStatus save(const char *filename, const GA_SaveOptions *options, UT_StringArray *errors=0) const
void reverseU() override
GLfloat v0
Definition: glcorearb.h:816
SYS_FORCE_INLINE GA_Index getMapIndex() const
Gets the index of this primitive in the detail containing it.
Definition: GA_Primitive.h:151
int64 getMemoryUsage(bool inclusive) const override
Compute memory usage (includes all shared memory)
Definition: GEO_Profiles.h:92
bool destroyPrimitiveOffset(GA_Offset offset, bool and_points=false) override
GLfloat GLfloat v1
Definition: glcorearb.h:817
virtual void getDomainBBox(float &u0, float &v0, float &u1, float &v1) const =0
Container class for all geometry.
Definition: GA_Detail.h:96
int64 getMemoryUsage(bool inclusive) const override
Compute memory usage (includes all shared memory)