Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HOpCreateNurbs3D.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2000 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 // $Id: ed136440f0acf5b3f0b99ec09e542b8023ce7fe6 $
13 //
14 
22 #ifndef _OpCreateNurbs3D_H
23 #define _OpCreateNurbs3D_H
24 
25 #ifdef H_PACK_8
26 #pragma pack(push)
27 #pragma pack(8)
28 #endif
29 
30 #include "HTools.h"
31 #include "HBaseOperator.h"
32 
33 
38 {
42 };
43 
44 
45 class HNurbsSurface;
46 
47 
49 
61 class MVO_API HOpCreateNurbs3D : public HBaseOperator
62 {
63 public:
71  HOpCreateNurbs3D (HBaseView* view, int DoRepeat=0, int DoCapture=1);
72  virtual ~HOpCreateNurbs3D();
73 
79  virtual HBaseOperator * Clone();
80 
84  virtual const char * GetName();
90  virtual int OnLButtonDown(HEventInfo &hevent);
91 
97  virtual int OnLButtonUp(HEventInfo &hevent);
98 
105  virtual int OnLButtonDownAndMove(HEventInfo &hevent);
106 
115  static HC_KEY InsertNurbs(HBaseView *pView, HNurbsSurface *pNurbsSurface, bool emit_message);
116 
117 
124  static void InsertNurbsFromMessage(const char *in_data, unsigned int data_length, HBaseView *m_pView);
125 
135  static void EmitModifyControlPointMessage(HBaseView *pView, HC_KEY key, int control_point, float x, float y, float z);
136 
143  static void ModifyControlPointFromMessage(const char *in_data, unsigned int data_length, HBaseView *pView);
144 
153  static void EmitFinishNurbsEditing(HBaseView *pView, HC_KEY key, bool emit_message);
154 
161  static void FinishNurbsEditingFromMessage(const char *in_data, unsigned int data_length, HBaseView *pView);
162 
163 
164 protected:
165 
166 private:
167  HPoint m_last_point;
168  int m_mnnum;
169  float m_gwidth;
170  int m_gran;
171  int m_degree;
172  HC_KEY m_NurbsKey;
173  HNurbsSurface *m_pNurbsSurface;
174 
175 
176 
177 };
178 
179 
181 
188 class MVO_API HNurbsSurface
189 {
190 public:
191 
194  {
195  m_nurbsKey = 0;
196  m_numUVertices = 0;
197  m_numVVertices = 0;
198  m_pVertices = 0;
199  m_pNurbs = 0;
200  m_degree = 0;
201  m_tesselationLevel = 0;
202  m_pNurbs = 0;
203  m_pVertices = 0;
204  m_vertexDistance = 0;
205  m_verticesKey = 0;
206  m_surfaceMeshKey = 0;
207 
208  }
209  ~HNurbsSurface()
210  {
211  H_SAFE_DELETE_ARRAY(m_pVertices);
212  H_SAFE_DELETE_ARRAY(m_pNurbs);
213  }
214 
219  void Init(HC_KEY key);
220 
233  HC_KEY Init( HPoint * center, HPoint * axis,
234  int num_u_vertices, int num_v_vertices,
235  int degree, int tesselation_level,
236  float distance, HSurfaceType stype);
237 
241  void Recalculate();
242 
246  HC_KEY GetKey();
247 
248 
252  void DisplayVertices();
253 
257  void HideVertices();
258 
262  void EnableSelectability();
263 
267  void DisableSelectability();
268 
276  void UpdateVertex(int vertexnum, float x, float y, float z);
277 
283  void ShowVertex(int vertexnum, HPoint &v);
284 
290  void CreateDefaultVertices(HPoint * center, HPoint * axis);
291 
293  HC_KEY GetSurfaceMeshKey() { return m_surfaceMeshKey; }
294 
295 private:
296 
297  HC_KEY m_nurbsKey;
298  HC_KEY m_verticesKey;
299  HC_KEY m_surfaceMeshKey;
300  int m_numUVertices;
301  int m_numVVertices;
302  int m_degree;
303  int m_tesselationLevel;
304  float m_vertexDistance;
305  HPoint *m_pVertices;
306  HPoint *m_pNurbs;
307  HSurfaceType m_surfaceType;
308 
309 
310  void UpdateVertices();
311  void UpdateParameters();
312  float nip(int i,int p, float u, float *uv);
313  void InsertNurbsMesh(HPoint *pNurbs);
314  void InsertChakinSubdivionSurface(HPoint *pNurbs);
315  void CalculateCornerPoint(HPoint &p1, HPoint &p2, HPoint &res, float factor);
316  void SubdivideSurface(HPoint *old_surface, HPoint *ssurf, int xlen, int ylen, int &new_xlen, int &new_ylen, bool xrefine);
317 
318  void GetVerticesFromHOOPS();
319  void GetParametersFromHOOPS();
320 
321 };
322 
323 
324 
325 #ifdef H_PACK_8
326 #pragma pack(pop)
327 #endif
328 
329 #endif
330 
331 
332 
333 
virtual int OnLButtonDownAndMove(HEventInfo &hevent)
virtual const char * GetName()
HNurbsSurface()
Definition: HOpCreateNurbs3D.h:193
virtual int OnLButtonUp(HEventInfo &hevent)
The HOpCreateNurbs3D class provides support for the interactive construction of various surface types...
Definition: HOpCreateNurbs3D.h:61
#define HC_KEY
operator uses HOOPS nurbs function (HC_Insert_Nurbs)
Definition: HOpCreateNurbs3D.h:39
operator uses internal routines
Definition: HOpCreateNurbs3D.h:40
virtual HBaseOperator * Clone()
HC_KEY GetSurfaceMeshKey()
Definition: HOpCreateNurbs3D.h:293
The HBaseOperator class serves as a base for classes which handle user input and operate on the scene...
Definition: HBaseOperator.h:65
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:126
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:337
The HEventInfo class stores and manages event information.
Definition: HEventInfo.h:214
virtual int OnLButtonDown(HEventInfo &hevent)
HSurfaceType
Definition: HOpCreateNurbs3D.h:37
The HNurbsSurface class encapsulates a NURBS surface or Chaking subdivision surface.
Definition: HOpCreateNurbs3D.h:188
operator creates surface based on chakin subdivision scheme
Definition: HOpCreateNurbs3D.h:41