HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_PasteVertex.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: CV expressed in a diffuse coordinate system.
7  *
8  * COMMENTS:
9  */
10 
11 
12 #ifndef __GEO_PasteVertex_h__
13 #define __GEO_PasteVertex_h__
14 
15 #include "GEO_API.h"
16 #include <GA/GA_Types.h>
17 #include <UT/UT_Vector3.h>
18 #include <UT/UT_Matrix3.h>
19 #include <GP/GP_Xform.h>
20 
21 
22 class GEO_Detail;
23 class GEO_PasteSurf;
24 
25 
27 {
28 public:
29  // C-tor and destructor.
30  GEO_PasteVertex(void) {}
32 
33  // Update the world value based on the current frame or vice-versa,
34  // assuming everything else is unchanged:
35  void updateWorldImage (void);
36  void updateDisplacement(void);
37 
38  // Update the frame origin and transformation by evaluating the base
39  // surface at the given greville location. This method does not update
40  // the world image as well. We assume worldgrev(row,col) is valid and
41  // the base surface exists.
42  void updateFrame(const GP_PointMatrix &worldgrev,
43  int row, int col);
44 
45  // Update the frame origin and transformation by evaluating the base
46  // surface at the given greville location. This method does not update
47  // the world image as well. We assume worldgrev(row,col) is valid and
48  // the base surface exists.
49  // Different from updateFrame() because it computes the tangent vectors
50  // directly from the base surface, along its u and v flow lines.
51  void updateIsoFrame(const GP_PointMatrix &gworld,
52  int r, int c);
53 
54  // Set the internal data. Certain updates might be required thereafter.
55  // See the update methods in this class.
57  {
58  myDisplace = v;
59  }
60  void setFrame(const UT_Vector3 orig)
61  {
62  myFrameOrig = orig;
63  myFrameMatx.identity();
64  myFrameInvm.identity();
65  myInverseOK = 1;
66  }
67  void setFrame(const UT_Vector3 orig,const UT_Matrix3 &matx)
68  {
69  myFrameOrig = orig;
70  myFrameMatx = matx;
71  myInverseOK = 0;
72  }
73 
74  void translateOrigin(const UT_Vector3 delta)
75  {
76  myFrameOrig += delta;
77  }
78 
79  void elevateDisplacement(float delta)
80  {
81  myDisplace.z() += delta;
82  }
84  {
85  myDisplace.z() = -myDisplace.z();
86  }
87 
88  const UT_Vector3 &displacement(void) const { return myDisplace; }
89 
90  // Get and set the external information: base surface and geo point:
91  GEO_PasteSurf *baseSurface(void) const { return myBaseSurf; }
92  void baseSurface(GEO_PasteSurf *s) { myBaseSurf = s; }
93 
95  {
96  return myPointOffset;
97  }
98  void point(GA_Offset pt_offset, bool update = true)
99  {
100  myPointOffset = pt_offset;
101  if (update) updateDisplacement();
102  }
103 
104  // Equality operator tests pointer equality of point and base surf.
105  int operator==(const GEO_PasteVertex &vtx) const;
106 
107  // Assignment operator overrides point and base surf pointers.
108  GEO_PasteVertex &operator=(const GEO_PasteVertex &vtx);
109 
110 
111 private:
112  GEO_Detail &detail();
113 
114 private:
115  UT_Vector3 myDisplace; // the displacement from the greville
116 
117  UT_Vector3 myFrameOrig; // origin in pasted space
118  UT_Matrix3 myFrameMatx; // local frame on base surface
119  UT_Matrix3 myFrameInvm; // inverse matrix
120  char myInverseOK; // 1 if inverse matrix is valid
121 
122  GEO_PasteSurf *myBaseSurf; // base surface for the pasted CV
123  GA_Offset myPointOffset; // image in object (world) space
124 
125  // Take two domain points in world coordinates and return the second one
126  // in the space of the domain. Return 0 if OK, else -1.
127  int computeIncrement(const GP_Point &gcrt,
128  GP_Point &gnext,
129  GP_Point &gsave) const;
130 };
131 
132 #endif
133 
void setFrame(const UT_Vector3 orig)
void baseSurface(GEO_PasteSurf *s)
void setFrame(const UT_Vector3 orig, const UT_Matrix3 &matx)
const GLdouble * v
Definition: glcorearb.h:836
GEO_PasteSurf * baseSurface(void) const
void translateOrigin(const UT_Vector3 delta)
GA_Size GA_Offset
Definition: GA_Types.h:617
const UT_Vector3 & displacement(void) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void elevateDisplacement(float delta)
#define GEO_API
Definition: GEO_API.h:10
void point(GA_Offset pt_offset, bool update=true)
GA_Offset getPointOffset() const
png_bytepp row
Definition: png.h:1836
void setDisplacement(const UT_Vector3 &v)
GLboolean r
Definition: glcorearb.h:1221