Newton Dynamics  4.00
ndIsoSurface.h
1 /* Copyright (c) <2003-2022> <Julio Jerez, Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 *
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 *
19 * 3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #ifndef __ND_ISO_SURFACE_H__
23 #define __ND_ISO_SURFACE_H__
24 
25 #include "ndCoreStdafx.h"
26 #include "ndTypes.h"
27 #include "ndArray.h"
28 #include "ndTree.h"
29 
31 {
32  public:
34  {
35  public:
37  {
38  }
39 
40  virtual ~ndCalculateIsoValue()
41  {
42  }
43 
44  virtual ndFloat32 CalculateIsoValue(const ndVector& point) const = 0;
45  };
46 
47  class ndImplementation;
48 
49  D_CORE_API ndIsoSurface();
50  D_CORE_API ~ndIsoSurface();
51 
52  ndVector GetOrigin() const;
53  const ndArray<ndVector>& GetPoints() const;
54 
55  D_CORE_API void GenerateMesh(const ndArray<ndVector>& pointCloud, ndFloat32 gridSize, ndCalculateIsoValue* const computeIsoValue = nullptr);
56  D_CORE_API ndInt32 GenerateListIndexList(ndInt32 * const indexList, ndInt32 strideInFloat32, ndReal* const posit, ndReal* const normals) const;
57 
58  private:
59  ndVector m_origin;
60  ndArray<ndVector> m_points;
61  ndImplementation* m_implementation;
62  ndFloat32 m_gridSize;
63  ndInt32 m_volumeSizeX;
64  ndInt32 m_volumeSizeY;
65  ndInt32 m_volumeSizeZ;
66  bool m_isLowRes;
67 };
68 
69 inline const ndArray<ndVector>& ndIsoSurface::GetPoints() const
70 {
71  return m_points;
72 }
73 
74 inline ndVector ndIsoSurface::GetOrigin() const
75 {
76  return m_origin;
77 }
78 
79 #endif
80 
ndClassAlloc
Base class for providing memory allocation for all other engine classes.
Definition: ndClassAlloc.h:30
ndArray< ndVector >
ndIsoSurface
Definition: ndIsoSurface.h:31
ndIsoSurface::ndImplementation
Definition: ndIsoSurface.cpp:34
ndIsoSurface::ndCalculateIsoValue
Definition: ndIsoSurface.h:34
ndVector
Definition: ndVectorArmNeon.h:41