QUAOAR STUDIO // Mobius API
poly_AdaptiveDistanceField.h
1 //-----------------------------------------------------------------------------
2 // Created on: 12 December 2019
3 //-----------------------------------------------------------------------------
4 // Copyright (c) 2019-present, Sergey Slyadnev
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 // * Neither the name of Sergey Slyadnev nor the
16 // names of all contributors may be used to endorse or promote products
17 // derived from this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 // DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
23 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //-----------------------------------------------------------------------------
30 
31 #ifndef poly_AdaptiveDistanceField_HeaderFile
32 #define poly_AdaptiveDistanceField_HeaderFile
33 
34 // Poly includes
35 #include <mobius/poly_BaseDistanceField.h>
36 #include <mobius/poly_SVO.h>
37 
38 // Core includes
39 #include <mobius/core_IProgressNotifier.h>
40 #include <mobius/core_IPlotter.h>
41 
42 namespace mobius {
43 
49 {
50 public:
51 
58  mobiusPoly_EXPORT
59  poly_AdaptiveDistanceField(const double precision,
60  const bool isUniform,
61  const bool bndMode = false,
62  core_ProgressEntry progress = nullptr,
63  core_PlotterEntry plotter = nullptr);
64 
72  mobiusPoly_EXPORT
74  const double precision,
75  const bool isUniform,
76  const bool bndMode = false,
77  core_ProgressEntry progress = nullptr,
78  core_PlotterEntry plotter = nullptr);
79 
82  mobiusPoly_EXPORT virtual
84 
85 public:
86 
103  mobiusPoly_EXPORT bool
104  Build(const double minCellSize,
105  const double maxCellSize,
106 
107  const t_ptr<poly_RealFunc>& func) override;
108 
109 public:
110 
116  mobiusPoly_EXPORT virtual double
117  Eval(const double x, const double y, const double z) const;
118 
119 public:
120 
122  poly_SVO* GetRoot() override
123  {
124  return m_pRoot;
125  }
126 
131  void SetRoot(poly_SVO* pRoot)
132  {
133  m_pRoot = pRoot;
134  }
135 
140  void SetBoundaryEvaluationMode(const bool on)
141  {
142  m_bBndMode = on;
143  }
144 
147  t_ptr<poly_AdaptiveDistanceField> ShallowCopy() const
148  {
149  t_ptr<poly_AdaptiveDistanceField>
151  //
152  res->SetRoot(m_pRoot);
153  return res;
154  }
155 
156 protected:
157 
159  double m_fPrecision;
160  bool m_bUniform;
161  bool m_bBndMode;
164 
165 };
166 
167 }
168 
169 #endif
mobius
Defines an exception class C1 that inherits an exception class C2.
Definition: bspl_Decompose.h:41
mobius::poly_AdaptiveDistanceField::m_bBndMode
bool m_bBndMode
Boundary evaluation mode.
Definition: poly_AdaptiveDistanceField.h:161
mobius::poly_AdaptiveDistanceField::m_fPrecision
double m_fPrecision
Distance field approximation precision.
Definition: poly_AdaptiveDistanceField.h:159
mobius::poly_AdaptiveDistanceField::poly_AdaptiveDistanceField
mobiusPoly_EXPORT poly_AdaptiveDistanceField(const double precision, const bool isUniform, const bool bndMode=false, core_ProgressEntry progress=nullptr, core_PlotterEntry plotter=nullptr)
mobius::core_PlotterEntry
Definition: core_IPlotter.h:252
mobius::poly_AdaptiveDistanceField
Definition: poly_AdaptiveDistanceField.h:48
mobius::core_ProgressEntry
Definition: core_IProgressNotifier.h:193
mobius::poly_AdaptiveDistanceField::m_progress
core_ProgressEntry m_progress
Progress notifier.
Definition: poly_AdaptiveDistanceField.h:162
mobius::poly_AdaptiveDistanceField::SetRoot
void SetRoot(poly_SVO *pRoot)
Definition: poly_AdaptiveDistanceField.h:131
mobius::poly_AdaptiveDistanceField::m_pRoot
poly_SVO * m_pRoot
Root voxel.
Definition: poly_AdaptiveDistanceField.h:158
mobius::poly_AdaptiveDistanceField::m_plotter
core_PlotterEntry m_plotter
Imperative plotter.
Definition: poly_AdaptiveDistanceField.h:163
mobius::poly_AdaptiveDistanceField::SetBoundaryEvaluationMode
void SetBoundaryEvaluationMode(const bool on)
Definition: poly_AdaptiveDistanceField.h:140
mobius::poly_SVO
Definition: poly_SVO.h:49
mobius::poly_AdaptiveDistanceField::~poly_AdaptiveDistanceField
virtual mobiusPoly_EXPORT ~poly_AdaptiveDistanceField()
mobius::poly_AdaptiveDistanceField::Build
mobiusPoly_EXPORT bool Build(const double minCellSize, const double maxCellSize, const t_ptr< poly_RealFunc > &func) override
mobius::poly_AdaptiveDistanceField::Eval
virtual mobiusPoly_EXPORT double Eval(const double x, const double y, const double z) const
mobius::poly_AdaptiveDistanceField::ShallowCopy
t_ptr< poly_AdaptiveDistanceField > ShallowCopy() const
Definition: poly_AdaptiveDistanceField.h:147
mobius::poly_BaseDistanceField
Definition: poly_BaseDistanceField.h:47
mobius::poly_AdaptiveDistanceField::GetRoot
poly_SVO * GetRoot() override
Definition: poly_AdaptiveDistanceField.h:122
mobius::poly_AdaptiveDistanceField::m_bUniform
bool m_bUniform
Indicates whether uniform mode is enabled.
Definition: poly_AdaptiveDistanceField.h:160