HOpCreateNurbs3D.h
Go to the documentation of this file.
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
17 #ifndef _OpCreateNurbs3D_H
18 #define _OpCreateNurbs3D_H
19 
20 #ifdef H_PACK_8
21 #pragma pack(push)
22 #pragma pack(8)
23 #endif
24 
25 #include "HTools.h"
26 #include "HBaseOperator.h"
27 
28 
33 {
37 };
38 
39 
40 class HNurbsSurface;
41 
42 
44 
56 class MVO_API HOpCreateNurbs3D : public HBaseOperator
57 {
58 public:
66  HOpCreateNurbs3D (HBaseView* view, int DoRepeat=0, int DoCapture=1);
67  virtual ~HOpCreateNurbs3D();
68 
74  virtual HBaseOperator * Clone();
75 
79  virtual const char * GetName();
85  virtual int OnLButtonDown(HEventInfo &hevent);
86 
92  virtual int OnLButtonUp(HEventInfo &hevent);
93 
100  virtual int OnLButtonDownAndMove(HEventInfo &hevent);
101 
110  static HC_KEY InsertNurbs(HBaseView *pView, HNurbsSurface *pNurbsSurface, bool emit_message);
111 
112 
119  static void InsertNurbsFromMessage(const char *in_data, unsigned int data_length, HBaseView *m_pView);
120 
130  static void EmitModifyControlPointMessage(HBaseView *pView, HC_KEY key, int control_point, float x, float y, float z);
131 
138  static void ModifyControlPointFromMessage(const char *in_data, unsigned int data_length, HBaseView *pView);
139 
148  static void EmitFinishNurbsEditing(HBaseView *pView, HC_KEY key, bool emit_message);
149 
156  static void FinishNurbsEditingFromMessage(const char *in_data, unsigned int data_length, HBaseView *pView);
157 
158 
159 protected:
160 
161 private:
162  HPoint m_last_point;
163  int m_mnnum;
164  float m_gwidth;
165  int m_gran;
166  int m_degree;
167  HC_KEY m_NurbsKey;
168  HNurbsSurface *m_pNurbsSurface;
169 
170 
171 
172 };
173 
174 
176 
183 class MVO_API HNurbsSurface
184 {
185 public:
186 
189  {
190  m_nurbsKey = 0;
191  m_numUVertices = 0;
192  m_numVVertices = 0;
193  m_pVertices = 0;
194  m_pNurbs = 0;
195  m_degree = 0;
196  m_tesselationLevel = 0;
197  m_pNurbs = 0;
198  m_pVertices = 0;
199  m_vertexDistance = 0;
200  m_verticesKey = 0;
201  m_surfaceMeshKey = 0;
202 
203  }
204  ~HNurbsSurface()
205  {
206  H_SAFE_DELETE_ARRAY(m_pVertices);
207  H_SAFE_DELETE_ARRAY(m_pNurbs);
208  }
209 
214  void Init(HC_KEY key);
215 
228  HC_KEY Init( HPoint * center, HPoint * axis,
229  int num_u_vertices, int num_v_vertices,
230  int degree, int tesselation_level,
231  float distance, HSurfaceType stype);
232 
236  void Recalculate();
237 
241  HC_KEY GetKey();
242 
243 
247  void DisplayVertices();
248 
252  void HideVertices();
253 
257  void EnableSelectability();
258 
262  void DisableSelectability();
263 
271  void UpdateVertex(int vertexnum, float x, float y, float z);
272 
278  void ShowVertex(int vertexnum, HPoint &v);
279 
285  void CreateDefaultVertices(HPoint * center, HPoint * axis);
286 
288  HC_KEY GetSurfaceMeshKey() { return m_surfaceMeshKey; }
289 
290 private:
291 
292  HC_KEY m_nurbsKey;
293  HC_KEY m_verticesKey;
294  HC_KEY m_surfaceMeshKey;
295  int m_numUVertices;
296  int m_numVVertices;
297  int m_degree;
298  int m_tesselationLevel;
299  float m_vertexDistance;
300  HPoint *m_pVertices;
301  HPoint *m_pNurbs;
302  HSurfaceType m_surfaceType;
303 
304 
305  void UpdateVertices();
306  void UpdateParameters();
307  float nip(int i,int p, float u, float *uv);
308  void InsertNurbsMesh(HPoint *pNurbs);
309  void InsertChakinSubdivionSurface(HPoint *pNurbs);
310  void CalculateCornerPoint(HPoint &p1, HPoint &p2, HPoint &res, float factor);
311  void SubdivideSurface(HPoint *old_surface, HPoint *ssurf, int xlen, int ylen, int &new_xlen, int &new_ylen, bool xrefine);
312 
313  void GetVerticesFromHOOPS();
314  void GetParametersFromHOOPS();
315 
316 };
317 
318 
319 
320 #ifdef H_PACK_8
321 #pragma pack(pop)
322 #endif
323 
324 #endif
325 
326 
327 
328 
virtual int OnLButtonDownAndMove(HEventInfo &hevent)
virtual const char * GetName()
HNurbsSurface()
Definition: HOpCreateNurbs3D.h:188
virtual int OnLButtonUp(HEventInfo &hevent)
The HOpCreateNurbs3D class provides support for the interactive construction of various surface types...
Definition: HOpCreateNurbs3D.h:56
#define HC_KEY
operator uses HOOPS nurbs function (HC_Insert_Nurbs)
Definition: HOpCreateNurbs3D.h:34
operator uses internal routines
Definition: HOpCreateNurbs3D.h:35
virtual HBaseOperator * Clone()
HC_KEY GetSurfaceMeshKey()
Definition: HOpCreateNurbs3D.h:288
The HBaseOperator class serves as a base for classes which handle user input and operate on the scene...
Definition: HBaseOperator.h:60
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:332
The HEventInfo class stores and manages event information.
Definition: HEventInfo.h:207
virtual int OnLButtonDown(HEventInfo &hevent)
HSurfaceType
Definition: HOpCreateNurbs3D.h:32
The HNurbsSurface class encapsulates a NURBS surface or Chaking subdivision surface.
Definition: HOpCreateNurbs3D.h:183
operator creates surface based on chakin subdivision scheme
Definition: HOpCreateNurbs3D.h:36