MeshLink
Computational geometry access
GeometryKernel.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright (c) 2019-2020 Pointwise, Inc.
4  * All rights reserved.
5  *
6  * This sample Pointwise source code is not supported by Pointwise, Inc.
7  * It is provided freely for demonstration purposes only.
8  * SEE THE WARRANTY DISCLAIMER AT THE BOTTOM OF THIS FILE.
9  *
10  ***************************************************************************/
11 
12 #ifndef GEOMETRY_KERNEL_CLASS
13 #define GEOMETRY_KERNEL_CLASS
14 
15 #include "Types.h"
16 
17 #include <string>
18 #include <vector>
19 
20 class GeometryKernel;
21 class GeometryGroup;
22 
23 
24 /****************************************************************************
25  * KernelData class
26  ***************************************************************************/
36 class ML_STORAGE_CLASS KernelData {
37 public:
39  KernelData(GeometryKernel *kernel);
41  ~KernelData();
42 
44  KernelDataObj getData() { return data_; }
45 
46 protected:
50  KernelDataObj data_;
51 
52 private:
54  KernelData();
55 };
56 
57 /****************************************************************************
58 * ProjectionData class
59 ***************************************************************************/
69 class ML_STORAGE_CLASS ProjectionData : public KernelData {
70 public:
74  ~ProjectionData();
75 };
76 
77 
78 /****************************************************************************
79  * GeometryKernel class
80  ***************************************************************************/
91 class ML_STORAGE_CLASS GeometryKernel {
92 public:
93  friend class ProjectionData;
94 
100  virtual bool read(const char* filename);
101 
117  virtual bool projectPoint(const GeometryGroup *group,
118  const MLVector3D point,
119  ProjectionData &projectionData);
120 
125  virtual bool getProjectionXYZ(ProjectionData &projectionData, MLVector3D point);
126 
131  virtual bool getProjectionUV(ProjectionData &projectionData, MLVector2D UV);
132 
137  virtual bool getProjectionEntityName(ProjectionData &projectionData, std::string &name);
138 
143  virtual bool getProjectionDistance(ProjectionData &projectionData, MLREAL &distance);
144 
152  virtual bool getProjectionTolerance(ProjectionData &projectionData, MLREAL &tolerance);
153 
161  virtual bool evalXYZ(MLVector2D UV, const std::string &entityName, MLVector3D xyz);
162 
172  virtual bool evalRadiusOfCurvature(MLVector2D UV, const std::string &entityName,
173  MLREAL *minRadiusOfCurvature, MLREAL *maxRadiusOfCurvature );
174 
189  virtual bool evalCurvatureOnCurve(
190  MLVector2D UV,
191  const std::string &entityName,
192  MLVector3D XYZ,
193  MLVector3D Tangent,
194  MLVector3D PrincipalNormal,
195  MLVector3D Binormal,
196  MLREAL *Curvature,
197  bool *Linear
198  );
199 
209  virtual bool evalDerivativesOnCurve(
210  MLVector2D UV,
211  const std::string &entityName,
212  MLVector3D XYZ,
213  MLVector3D dXYZdU,
214  MLVector3D d2XYZdU2
215  );
216 
241  virtual bool evalCurvatureOnSurface(
242  MLVector2D UV,
243  const std::string &entityName,
244  MLVector3D XYZ,
245  MLVector3D dXYZdU,
246  MLVector3D dXYZdV,
247  MLVector3D d2XYZdU2,
248  MLVector3D d2XYZdUdV,
249  MLVector3D d2XYZdV2,
250  MLVector3D surfaceNormal,
251  MLVector3D principalV,
252  MLREAL *minCurvature,
253  MLREAL *maxCurvature,
254  MLREAL *avg,
255  MLREAL *gauss,
256  MLORIENT *orientation
257  );
258 
259 
260 
273  virtual bool evalSurfaceTolerance(
274  const std::string &entityName,
275  MLREAL &minTolerance,
276  MLREAL &maxTolerance);
277 
281  virtual MLTYPE entityType(const char* name);
282 
286  virtual bool entityExists(const char* name);
287 
289  virtual const char * getName() const;
290 
296  virtual void setModelSize(MLREAL size);
297 
299  virtual MLREAL getModelSize() const;
300 
303  {
304  modelsize_ = 1000.0;
305  }
306 
309  {
310  }
311 
312 private:
315 
317  virtual ProjectionDataObj getProjectionDataObject();
318 
320  virtual void deleteProjectionDataObject(ProjectionDataObj projectionData);
321 };
322 
323 #endif
324 
325 /****************************************************************************
326  *
327  * DISCLAIMER:
328  * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, POINTWISE DISCLAIMS
329  * ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED
330  * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
331  * PURPOSE, WITH REGARD TO THIS SCRIPT. TO THE MAXIMUM EXTENT PERMITTED
332  * BY APPLICABLE LAW, IN NO EVENT SHALL POINTWISE BE LIABLE TO ANY PARTY
333  * FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
334  * WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
335  * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE
336  * USE OF OR INABILITY TO USE THIS SCRIPT EVEN IF POINTWISE HAS BEEN
337  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE
338  * FAULT OR NEGLIGENCE OF POINTWISE.
339  *
340  ***************************************************************************/
MeshLinkObject ProjectionDataObj
Opaque pointer to a ProjectionData object.
Definition: Types.h:219
Base class for geometry kernel interface.
~GeometryKernel()
Destructor.
GeometryKernel * kernel_
The associated GeometryKernel.
int MLORIENT
Geometry orientation with respect to container entity.
Definition: Types.h:240
KernelDataObj data_
The opaque data pointer.
Opaque container for geometry kernel specific data.
MLREAL MLVector3D[3]
3D vector of MLREAL
Definition: Types.h:154
MLREAL modelsize_
model size
Opaque container for geometry kernel point projection specific data.
MLREAL MLVector2D[2]
2D vector of MLREAL
Definition: Types.h:156
double MLREAL
64-bit real
Definition: Types.h:115
int MLTYPE
Basic geometry type.
Definition: Types.h:252
KernelDataObj getData()
Return the encapsulated opaque pointer.
Storage for geometry association by entity reference.
Definition: GeometryGroup.h:38
GeometryKernel()
Default constructor sets model size to 1000.0.