HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_PrimHexahedron.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: GEO_PrimHexahedron.h (GEO Library, C++)
7  *
8  * COMMENTS: This is the hexahedron primitive type.
9  */
10 
11 #pragma once
12 
13 #ifndef __GEO_PrimHexahedron__
14 #define __GEO_PrimHexahedron__
15 
16 #include "GEO_API.h"
17 #include "GEO_Primitive.h"
18 #include "GEO_Detail.h"
19 #include "GEO_VolumeElementBase.h"
20 #include <GA/GA_Defines.h>
21 #include <UT/UT_Array.h>
22 #include <SYS/SYS_Inline.h>
23 
24 class GA_Detail;
25 class GEO_ConvertParms;
26 
27 // So it doesn't look like a magic number
28 #define PT_PER_HEX 8
29 #define FACE_PER_HEX 6
30 #define EDGE_PER_HEX 12
31 
33 {
34 public:
35  /// NOTE: This constructor should only be called via GU_PrimitiveFactory.
39  {}
40 
41  /// This constructor is for making a representation of a hexahedron
42  /// on the stack, so that you can call GEO_PrimHexahedron functions on
43  /// the hexahedron without needing the detail to allocate one.
46  : GEO_VolumeElementBase(gdp, offset)
47  {
48  UT_ASSERT_P(vertex_list.size() == PT_PER_HEX);
49  myVertexList = vertex_list;
50  }
51 
52  const GA_PrimitiveDefinition &getTypeDef() const override;
53 
54  /// Report approximate memory usage.
55  int64 getMemoryUsage() const override;
56 
57  /// Count memory usage using a UT_MemoryCounter in order to count
58  /// shared memory correctly.
59  /// NOTE: This should always include sizeof(*this).
60  void countMemory(UT_MemoryCounter &counter) const override;
61 
62  void reverse() override;
63  UT_Vector3D computeNormalD() const override;
64  UT_Vector3 computeNormal() const override;
65 
66  // Compute the location of the breakpoint. Return 0 if OK, else -1.
67  fpreal calcVolume(const UT_Vector3 &refpt) const override;
68  fpreal calcArea() const override;
69  fpreal calcPerimeter() const override;
70 
71  /// @{
72  /// Save/Load vertex list to a JSON stream
73  bool saveVertexArray(UT_JSONWriter &w,
74  const GA_SaveMap &map) const;
75  bool loadVertexArray(UT_JSONParser &p,
76  const GA_LoadMap &map);
77  /// @}
78 
79  bool isDegenerate() const override;
80 
81  // Take the whole set of points into consideration when applying the
82  // point removal operation to this primitive. The method returns 0 if
83  // successful, -1 if it failed because it would have become degenerate,
84  // and -2 if it failed because it would have had to remove the primitive
85  // altogether.
86  int detachPoints (GA_PointGroup &grp) override;
87 
88  /// Before a point is deleted, all primitives using the point will be
89  /// notified. The method should return "false" if it's impossible to
90  /// delete the point. Otherwise, the vertices should be removed.
91  GA_DereferenceStatus dereferencePoint(
92  GA_Offset point, bool dry_run=false) override;
93  GA_DereferenceStatus dereferencePoints(
94  const GA_RangeMemberQuery &pt_q, bool dry_run=false) override;
95 
96  //
97  // Hexahedron layout
98  //
99  // Z+ Y+
100  // \ |
101  // \|
102  // X+---0
103  //
104  // Point numbers: bit 0: X, bit 1: Y, bit 2: Z
105  // Face: Axis X:0, Y:2, Z:4, direction: 0/1
106  //
107  // 7---6 // 0 - right
108  // |\ |\ // 1 - left
109  // | 3---2 // 2 - bottom
110  // 5-|-4 | // 3 - top
111  // \| \| // 4 - front
112  // 1---0 // 5 - back
113  //
114  // Each face starts with the least vertex #.
115 
117  { return getFastVertexOffset(index); }
118  static GA_Size rawVertexCount(const GA_Detail *gdp = nullptr, GA_Offset = GA_INVALID_OFFSET) { return PT_PER_HEX; }
120  { return PT_PER_HEX; }
122  {
123  UT_ASSERT_P(index >= 0 && index < PT_PER_HEX);
124  return getVertexOffset(index);
125  }
126 
127  /// Return the topology of the hexahedron
128  static GA_Size rawFaceCount(const GA_Detail *gdp = nullptr, GA_Offset offset = GA_INVALID_OFFSET) { return FACE_PER_HEX; }
129  GA_Size getFaceCount() const override { return rawFaceCount(); }
130 
131  static int rawFaceIndices(const GA_Detail *gdp, GA_Offset offset, GA_Size faceno, UT_Array<int> &vtxlist)
132  {
133  vtxlist.clear();
134 
135  const int *f = fastFaceIndices(faceno);
136  vtxlist.append(f[0]);
137  vtxlist.append(f[1]);
138  vtxlist.append(f[2]);
139  vtxlist.append(f[3]);
140 
141  return vtxlist.entries();
142  }
143  int getFaceIndices(GA_Size faceno, UT_Array<int> &vtxlist) const override
144  { return rawFaceIndices(nullptr, GA_INVALID_OFFSET, faceno, vtxlist); }
145 
146  static int rawFaceIndexCount(const GA_Detail *gdp, GA_Offset offset, GA_Size faceno)
147  { return 4; }
148  int getFaceIndexCount(GA_Size faceno) const override
149  { return rawFaceIndexCount(nullptr, GA_INVALID_OFFSET, faceno); }
150 
152  static const int *fastFaceIndices(GA_Size faceno)
153  {
154  static const int hex_faceidx[FACE_PER_HEX][4] =
155  {
156  { 0, 2, 6, 4 },
157  { 1, 5, 7, 3 },
158  { 0, 4, 5, 1 },
159  { 2, 3, 7, 6 },
160  { 0, 1, 3, 2 },
161  { 4, 6, 7, 5 },
162  };
163 
164  return hex_faceidx[faceno];
165  }
166 
167  /// Return the barycentric coordinate of the face. Convertes from
168  /// the natural parameterization of the face:
169  /// s = vertex0 to vertex1
170  /// t = vertex0 to vertex3
171  /// (s, t) -> (u, v, w)
172  /// (0, 0) -> (u0, v0, w0)
173  /// (1, 1) -> (u1, v1, w1)
174  static UT_Vector3 remapFaceCoords(GA_Size faceno, float s, float t);
175 
176  /// Get the vertex offsets of the specified quad.
178  GA_Size quad, GA_Offset &v0, GA_Offset &v1, GA_Offset &v2, GA_Offset &v3) const
179  {
180  const int *indices = fastFaceIndices(quad);
181  v0 = fastVertexOffset(indices[0]);
182  v1 = fastVertexOffset(indices[1]);
183  v2 = fastVertexOffset(indices[2]);
184  v3 = fastVertexOffset(indices[3]);
185  }
186 
187  static GA_Size rawEdgeCount(const GA_Detail *gdp = nullptr, GA_Offset = GA_INVALID_OFFSET)
188  { return EDGE_PER_HEX; }
189  GA_Size getEdgeCount() const override
190  { return rawEdgeCount(); }
191  static void rawEdgeIndices(const GA_Detail *gdp, GA_Offset offset, GA_Size edgeno, int &e0, int &e1)
192  {
193  static const int edgeidx[EDGE_PER_HEX][2] =
194  {
195  { 0, 1 },
196  { 0, 2 },
197  { 0, 4 },
198  { 1, 3 },
199  { 1, 5 },
200  { 2, 3 },
201  { 2, 6 },
202  { 3, 7 },
203  { 4, 5 },
204  { 4, 6 },
205  { 5, 7 },
206  { 6, 7 },
207  };
208 
209  e0 = edgeidx[edgeno][0];
210  e1 = edgeidx[edgeno][1];
211  }
212  void getEdgeIndices(GA_Size edgeno, int &e0, int &e1) const override
213  { return rawEdgeIndices(nullptr, GA_INVALID_OFFSET, edgeno, e0, e1); }
214 
215  GA_Offset findSharedHex(GA_Size faceno) const;
217  bool isFaceShared(GA_Size faceno) const
218  { return GAisValid(findSharedHex(faceno)); }
219 
220  GA_Offset findSharedFace(GA_Size faceno) const override
221  { return findSharedHex(faceno); }
222 
223  // These methods find the index of the given vertex (vtx or the vertex
224  // that contains a pt). Return -1 if not found.
226  {
227  for (GA_Size i = 0; i < PT_PER_HEX; i++)
228  if (fastVertexOffset(i) == vtx) return i;
229  return -1;
230  }
231 
233  {
234  for (GA_Size i = 0; i < PT_PER_HEX; i++)
235  if (vertexPoint(i) == pt) return i;
236  return -1;
237  }
238 
239  void setVertexPoint(int i, GA_Offset pt)
240  {
241  if (i < PT_PER_HEX)
242  wireVertex(fastVertexOffset(i), pt);
243  }
244 
245  const GA_PrimitiveJSON *getJSON() const override;
246 
247  class Face
248  {
249  public:
250  Face(const GEO_PrimHexahedron &tet,int face)
251  : myHex(tet)
252  , myI(face)
253  , myF(GEO_PrimHexahedron::fastFaceIndices(myI))
254  {}
256  { return 4; }
257  inline GA_Size getVertexCount() const
258  { return 4; }
260  { return myHex.getFastVertexOffset(myF[i]); }
262  { return getFastVertexOffset(i); }
264  { return myHex.getPointOffset(myF[i]); }
265  inline UT_Vector3 getPos3(GA_Size i) const
266  { return myHex.getPos3(myF[i]); }
267  inline bool isClosed() const
268  { return true; }
269  private:
270  const GEO_PrimHexahedron &myHex;
271  int myI;
272  const int *const myF;
273  };
274 
275  /// NOTE: Do not use this under normal circumstances!
276  /// This is for if a tet has been added using
277  /// GA_Detail::appendPrimitive[Block] and vertices have
278  /// to be added one at a time, e.g. from VEX.
279  /// It will return GA_INVALID_OFFSET and won't add a vertex
280  /// if all PT_PER_HEX have already been assigned.
281  GA_Offset unsafeAppendVertex();
282 
283  void normal(NormalComp &output) const override;
284  void normal(NormalCompD &output) const override;
285 
286  // Conversion Methods
288  GA_PointGroup *usedpts = nullptr) override;
289  GEO_Primitive *convertNew(GEO_ConvertParms &parms) override;
290 
291  /// Builds a single hexahedron primitive, optionally creating new points
292  /// and wiring them to its vertices.
293  static GEO_PrimHexahedron *build(GEO_Detail *gdp, bool appendPts = true);
294 
295  static void rawComputeInteriorPointWeights(
296  const GA_Detail *gdp, GA_Offset offset,
297  UT_Array<GA_Offset> &vtxlist, UT_Array<float> &weightlist,
298  fpreal u, fpreal v, fpreal w);
300  UT_Array<GA_Offset> &vtxlist, UT_Array<float> &weightlist,
301  fpreal u, fpreal v, fpreal w) const override final
302  { rawComputeInteriorPointWeights(getParent(), getMapOffset(),
303  vtxlist, weightlist, u, v, w); }
304 
305  /// Trilinear Hex
306  ///
307  /// Cube deformed with tri-linear deformation
308  class TLHex
309  {
310  public:
311  TLHex(const UT_Vector3 pos[8])
312  {
313  myCoefficients[0] = pos[0];
314  myCoefficients[1] = pos[1] - pos[0];
315  myCoefficients[2] = pos[2] - pos[0];
316  myCoefficients[3] = pos[3] - pos[1] - pos[2] + pos[0];
317  myCoefficients[4] = pos[4] - pos[0];
318  myCoefficients[5] = pos[5] - pos[4] - pos[1] + pos[0];
319  myCoefficients[6] = pos[6] - pos[4] - pos[2] + pos[0];
320  myCoefficients[7] = pos[7] - pos[6] - pos[5] + pos[4] - pos[3] + pos[2] + pos[1] - pos[0];
321 
322  UT_BoundingBox bbox;
323  bbox.initBounds(pos[0]);
324  for(int i = 1; i < 8; ++i)
325  bbox.enlargeBounds(pos[i]);
326  myTol2 = 1e-6 * bbox.size().length2();
327  }
328 
329  // convert position relative to a unit lattice cell to worldspace
331  {
332  return myCoefficients[0] + unitToHexTranslated(u);
333  }
334 
335  // convert a position in worldspace to one relative to a unit lattice cell
336  bool hexToUnit(UT_Vector3 &u, const UT_Vector3 &p) const
337  {
338  UT_Vector3 pos = p - myCoefficients[0];
339 
340  constexpr static float GRID_LOWER_TOL = 1e-4;
341  constexpr static float GRID_UPPER_TOL = GRID_LOWER_TOL + 1;
342 
343  constexpr static int maxIterations = 100;
344 
345  u.assign(0.5, 0.5, 0.5);
346  for (int i = 0; i < maxIterations; ++i)
347  {
348  UT_Matrix3 J = getJacobian(u);
349  auto det = J.determinant();
350  if (det == 0)
351  return false;
352 
353  auto divDet = 1/det;
354 
355  auto J00 = J(0,0);
356  auto J01 = J(0,1);
357  auto J02 = J(0,2);
358  auto J10 = J(1,0);
359  auto J11 = J(1,1);
360  auto J12 = J(1,2);
361 
362  UT_Vector3 val = pos - unitToHexTranslated(u);
363  auto cx = val[0];
364  auto cy = val[1];
365  auto cz = val[2];
366 
367  UT_Vector3 delta;
368  J(0,0) = cx; J(0,1) = cy; J(0,2) = cz;
369  delta.x() = J.determinant() * divDet;
370 
371  J(0,0) = J00; J(0,1) = J01; J(0,2) = J02;
372  J(1,0) = cx; J(1,1) = cy; J(1,2) = cz;
373  delta.y() = J.determinant() * divDet;
374 
375  J(1,0) = J10; J(1,1) = J11; J(1,2) = J12;
376  J(2,0) = cx; J(2,1) = cy; J(2,2) = cz;
377  delta.z() = J.determinant() * divDet;
378 
379  u += delta;
380  if (delta.length2() <= myTol2)
381  {
382  for (int j = 0; j < 3; ++j)
383  {
384  auto &v = u(j);
385  if (!SYSisFinite(v) || v < GRID_LOWER_TOL || v >= GRID_UPPER_TOL)
386  return false;
387  }
388  return true;
389  }
390  }
391 
392  return false;
393  }
394 
395  // given a position relative to a unit lattice cell, return the Jacobian
396  // of the transformation applied to produce the deformed position
398  {
399  auto dfd0 = myCoefficients[1] +
400  myCoefficients[3] * u[1] +
401  myCoefficients[5] * u[2] +
402  myCoefficients[7] * u[1] * u[2];
403 
404  auto dfd1 = myCoefficients[2] +
405  myCoefficients[3] * u[0] +
406  myCoefficients[6] * u[2] +
407  myCoefficients[7] * u[0] * u[2];
408 
409  auto dfd2 = myCoefficients[4] +
410  myCoefficients[5] * u[0] +
411  myCoefficients[6] * u[1] +
412  myCoefficients[7] * u[0] * u[1];
413 
414  return UT_Matrix3(dfd0, dfd1, dfd2);
415  }
416 
417  private:
418  // convert position relative to a unit lattice cell to worldspace
419  // translated to put corner 0 at the origin
420  UT_Vector3 unitToHexTranslated(const UT_Vector3 &u) const
421  {
422  return myCoefficients[1] * u[0] +
423  myCoefficients[2] * u[1] +
424  myCoefficients[3] * u[0] * u[1] +
425  myCoefficients[4] * u[2] +
426  myCoefficients[5] * u[0] * u[2] +
427  myCoefficients[6] * u[1] * u[2] +
428  myCoefficients[7] * u[0] * u[1] * u[2];
429  }
430 
431  UT_Vector3 myCoefficients[8];
432  float myTol2;
433  };
434 
435 protected:
436  void allocateVertices();
437 
438  template <typename T>
439  UT_Vector3T<T> internalComputeNormal() const;
440  template <typename T>
441  fpreal internalCalcVolume(const UT_Vector3T<T> &refpt) const;
442  template <typename T>
443  fpreal internalCalcArea() const;
444  template <typename T>
445  fpreal internalCalcPerimeter() const;
446 
447  GA_DECLARE_INTRINSICS(override)
448 
449  // Check the validity of the data. Meant to be called especially at loading
450  // time. The method returns 1 if OK and 0 if trouble.
451  virtual bool validate() const;
452 
453  /// @warning vertexPoint() doesn't check the bounds. Use with caution.
454  GA_Offset vertexPoint(GA_Size i) const
455  { return getDetail().vertexPoint(fastVertexOffset(i)); }
456 
457  // Evaluates the position at domain point (u,v,w) in the interior of the
458  // geometry, rather than on the perimeter of the poly.
459  // (Note that u, v, w don't have to be converted to unit domain. We assume
460  // that the barycentric coords or bilinear interpolants are already
461  // correctly scaled).
462  // Edge 0-1 is the U, 0-2 the V, and 0-4 the W.
464  GA_Offset result_vtx, GA_AttributeRefMap &map,
465  fpreal u, fpreal v, fpreal w = 0) const override;
467  UT_Vector4 &pos, fpreal u, fpreal v, fpreal w = 0) const override;
468 
470  friend class GU_PrimitiveFactory;
471 private:
472 };
473 
475 
476 #undef PT_PER_HEX
477 #undef FACE_PER_HEX
478 #undef EDGE_PER_HEX
479 
480 #endif
481 
constexpr SYS_FORCE_INLINE T length2() const noexcept
Definition: UT_Vector3.h:356
fpreal calcPerimeter() const override
static SYS_FORCE_INLINE const int * fastFaceIndices(GA_Size faceno)
GLsizei GLenum const void * indices
Definition: glcorearb.h:406
SYS_FORCE_INLINE GA_Detail & getDetail() const
Definition: GA_Primitive.h:141
Used to pass options and map offset values during saving.
Definition: GA_SaveMap.h:48
void computeInteriorPointWeights(UT_Array< GA_Offset > &vtxlist, UT_Array< float > &weightlist, fpreal u, fpreal v, fpreal w) const overridefinal
const GLdouble * v
Definition: glcorearb.h:837
SYS_FORCE_INLINE GEO_PrimHexahedron(GA_Detail *gdp, GA_Offset offset, const GA_OffsetListRef &vertex_list)
bool SYSisFinite(fpreal64 f)
Definition: SYS_Math.h:201
T determinant() const
Definition: UT_Matrix3.h:578
fpreal calcVolume(const UT_Vector3 &) const override
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
GA_Offset getPointOffset(GA_Size i) const
GLdouble s
Definition: glad.h:3009
virtual GA_DereferenceStatus dereferencePoint(GA_Offset point, bool dry_run=false)=0
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
SYS_FORCE_INLINE GEO_Detail * getParent() const
void reverse() override=0
Reverse the order of vertices.
#define GA_DECLARE_INTRINSICS(OVERRIDE)
Definition: GA_Primitive.h:80
SYS_FORCE_INLINE GA_Size getFastVertexCount() const
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
#define FACE_PER_HEX
Abstract base class for a range membership query object.
GLfloat GLfloat GLfloat v2
Definition: glcorearb.h:818
GLfloat GLfloat GLfloat GLfloat v3
Definition: glcorearb.h:819
SYS_FORCE_INLINE GEO_PrimHexahedron(GA_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
NOTE: This constructor should only be called via GU_PrimitiveFactory.
virtual int64 getMemoryUsage() const
Definition: GA_Primitive.h:209
fpreal calcArea() const override
SYS_FORCE_INLINE bool GAisValid(GA_Size v)
Definition: GA_Types.h:655
GA_Size getVertexCount() const
void wireVertex(GA_Offset vertex, GA_Offset point)
SYS_FORCE_INLINE GA_Offset getFastVertexOffset(GA_Size index) const
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:236
GA_Size find(GA_Offset pt) const
TLHex(const UT_Vector3 pos[8])
#define GA_INVALID_OFFSET
Definition: GA_Types.h:687
virtual void normal(NormalComp &output) const =0
static int rawFaceIndices(const GA_Detail *gdp, GA_Offset offset, GA_Size faceno, UT_Array< int > &vtxlist)
virtual bool isDegenerate() const =0
Is the primitive degenerate.
GA_Size GA_Offset
Definition: GA_Types.h:646
GLfloat f
Definition: glcorearb.h:1926
bool hexToUnit(UT_Vector3 &u, const UT_Vector3 &p) const
UT_Vector3D computeNormalD() const override
GLintptr offset
Definition: glcorearb.h:665
UT_Matrix3T< float > UT_Matrix3
virtual int evaluateInteriorPointV4(UT_Vector4 &pos, fpreal u, fpreal v, fpreal w=0) const
GA_Size getEdgeCount() const override
The number of edges in this volume.
static GA_Size rawVertexCount(const GA_Detail *gdp=nullptr, GA_Offset=GA_INVALID_OFFSET)
static GA_Size rawFaceCount(const GA_Detail *gdp=nullptr, GA_Offset offset=GA_INVALID_OFFSET)
Return the topology of the hexahedron.
GA_Offset getVertexOffset(GA_Size i) const
int getFaceIndices(GA_Size faceno, UT_Array< int > &vtxlist) const override
Returns the indices to the vertices, not the vertex offsets!
virtual void countMemory(UT_MemoryCounter &counter) const
Face(const GEO_PrimHexahedron &tet, int face)
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:155
static GA_PrimitiveDefinition * theDefinition
GA_Offset getFastVertexOffset(GA_Size i) const
#define EDGE_PER_HEX
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
virtual const GA_PrimitiveJSON * getJSON() const =0
Provide a JSON interface to a primitive.
GA_Size getFaceCount() const override
The number of faces that make up this volume.
#define GEO_API
Definition: GEO_API.h:14
GA_Size getFastVertexCount() const
long long int64
Definition: SYS_Types.h:116
A handle to simplify manipulation of multiple attributes.
Options during loading.
Definition: GA_LoadMap.h:42
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
Definition: GA_Detail.h:529
int getFaceIndexCount(GA_Size faceno) const override
Returns the number of indices in specified face.
static GA_Size rawEdgeCount(const GA_Detail *gdp=nullptr, GA_Offset=GA_INVALID_OFFSET)
static void rawEdgeIndices(const GA_Detail *gdp, GA_Offset offset, GA_Size edgeno, int &e0, int &e1)
GA_Offset findSharedFace(GA_Size faceno) const override
void enlargeBounds(const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
UT_Matrix3 getJacobian(const UT_Vector3 &u) const
virtual GA_DereferenceStatus dereferencePoints(const GA_RangeMemberQuery &pt_q, bool dry_run=false)=0
UT_Vector3T< T > size() const
exint append()
Definition: UT_Array.h:142
GLdouble t
Definition: glad.h:2397
GLfloat v0
Definition: glcorearb.h:816
void getQuadVertexOffsets(GA_Size quad, GA_Offset &v0, GA_Offset &v1, GA_Offset &v2, GA_Offset &v3) const
Get the vertex offsets of the specified quad.
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
virtual bool evaluateInteriorPointRefMap(GA_Offset result_vtx, GA_AttributeRefMap &map, fpreal u, fpreal v, fpreal w=0) const
GLint j
Definition: glad.h:2733
void assign(T xx=0.0f, T yy=0.0f, T zz=0.0f)
Set the values of the vector components.
Definition: UT_Vector3.h:694
virtual int detachPoints(GA_PointGroup &grp)=0
fpreal64 fpreal
Definition: SYS_Types.h:277
UT_Vector3 unitToHex(const UT_Vector3 &u) const
GLuint index
Definition: glcorearb.h:786
SYS_FORCE_INLINE GA_Offset getMapOffset() const
Gets the offset of this primitive in the detail containing it.
Definition: GA_Primitive.h:146
GLfloat GLfloat v1
Definition: glcorearb.h:817
GLuint GLfloat * val
Definition: glcorearb.h:1608
SYS_FORCE_INLINE void initBounds()
SYS_FORCE_INLINE GA_Offset getVertexOffset(GA_Size primvertexnum) const
Definition: GA_Primitive.h:240
Container class for all geometry.
Definition: GA_Detail.h:96
virtual GEO_Primitive * convert(GEO_ConvertParms &parms, GA_PointGroup *usedpts=0)=0
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
static int rawFaceIndexCount(const GA_Detail *gdp, GA_Offset offset, GA_Size faceno)
GA_Size findVertex(GA_Offset vtx) const
UT_Vector3 computeNormal() const override
Return a normal vector for the primitive.
Definition of a geometric primitive.
void clear()
Resets list to an empty list.
Definition: UT_Array.h:729
virtual const GA_PrimitiveDefinition & getTypeDef() const =0
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
SYS_FORCE_INLINE GA_Offset fastVertexOffset(GA_Size index) const
void setVertexPoint(int i, GA_Offset pt)
SYS_FORCE_INLINE bool isFaceShared(GA_Size faceno) const
virtual GEO_Primitive * convertNew(GEO_ConvertParms &parms)=0
#define PT_PER_HEX
void getEdgeIndices(GA_Size edgeno, int &e0, int &e1) const override
SYS_FORCE_INLINE FromType size() const
Returns the number of used elements in the list (always <= capacity())
UT_Vector3 getPos3(GA_Size i) const
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663