Introduction

Getting Started

Programming Guides

API Reference

Additional Resources

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 
108  static HC_KEY InsertNurbs(HBaseView *pView, HNurbsSurface *pNurbsSurface, bool emit_message);
109 
110 
117  static void InsertNurbsFromMessage(const char *in_data, unsigned int data_length, HBaseView *m_pView);
118 
128  static void EmitModifyControlPointMessage(HBaseView *pView, HC_KEY key, int control_point, float x, float y, float z);
129 
136  static void ModifyControlPointFromMessage(const char *in_data, unsigned int data_length, HBaseView *pView);
137 
144  static void EmitFinishNurbsEditing(HBaseView *pView, HC_KEY key, bool emit_message);
145 
152  static void FinishNurbsEditingFromMessage(const char *in_data, unsigned int data_length, HBaseView *pView);
153 
154 
155 protected:
156 
157 private:
158  HPoint m_last_point;
159  int m_mnnum;
160  float m_gwidth;
161  int m_gran;
162  int m_degree;
163  HC_KEY m_NurbsKey;
164  HNurbsSurface *m_pNurbsSurface;
165 
166 
167 
168 };
169 
170 
172 
179 class MVO_API HNurbsSurface
180 {
181 public:
182 
185  {
186  m_nurbsKey = 0;
187  m_numUVertices = 0;
188  m_numVVertices = 0;
189  m_pVertices = 0;
190  m_pNurbs = 0;
191  m_degree = 0;
192  m_tesselationLevel = 0;
193  m_pNurbs = 0;
194  m_pVertices = 0;
195  m_vertexDistance = 0;
196  m_verticesKey = 0;
197  m_surfaceMeshKey = 0;
198 
199  }
200  ~HNurbsSurface()
201  {
202  H_SAFE_DELETE_ARRAY(m_pVertices);
203  H_SAFE_DELETE_ARRAY(m_pNurbs);
204  }
205 
210  void Init(HC_KEY key);
211 
224  HC_KEY Init( HPoint * center, HPoint * axis,
225  int num_u_vertices, int num_v_vertices,
226  int degree, int tesselation_level,
227  float distance, HSurfaceType stype);
228 
232  void Recalculate();
233 
237  HC_KEY GetKey();
238 
239 
243  void DisplayVertices();
244 
248  void HideVertices();
249 
253  void EnableSelectability();
254 
258  void DisableSelectability();
259 
267  void UpdateVertex(int vertexnum, float x, float y, float z);
268 
274  void ShowVertex(int vertexnum, HPoint &v);
275 
281  void CreateDefaultVertices(HPoint * center, HPoint * axis);
282 
284  HC_KEY GetSurfaceMeshKey() { return m_surfaceMeshKey; }
285 
286 private:
287 
288  HC_KEY m_nurbsKey;
289  HC_KEY m_verticesKey;
290  HC_KEY m_surfaceMeshKey;
291  int m_numUVertices;
292  int m_numVVertices;
293  int m_degree;
294  int m_tesselationLevel;
295  float m_vertexDistance;
296  HPoint *m_pVertices;
297  HPoint *m_pNurbs;
298  HSurfaceType m_surfaceType;
299 
300 
301  void UpdateVertices();
302  void UpdateParameters();
303  float nip(int i,int p, float u, float *uv);
304  void InsertNurbsMesh(HPoint *pNurbs);
305  void InsertChakinSubdivionSurface(HPoint *pNurbs);
306  void CalculateCornerPoint(HPoint &p1, HPoint &p2, HPoint &res, float factor);
307  void SubdivideSurface(HPoint *old_surface, HPoint *ssurf, int xlen, int ylen, int &new_xlen, int &new_ylen, bool xrefine);
308 
309  void GetVerticesFromHOOPS();
310  void GetParametersFromHOOPS();
311 
312 };
313 
314 
315 
316 #ifdef H_PACK_8
317 #pragma pack(pop)
318 #endif
319 
320 #endif
321 
322 
323 
324 
virtual int OnLButtonDownAndMove(HEventInfo &hevent)
virtual const char * GetName()
HNurbsSurface()
Definition: HOpCreateNurbs3D.h:184
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:284
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:179
operator creates surface based on chakin subdivision scheme
Definition: HOpCreateNurbs3D.h:36