EBGeometry 1.0
Loading...
Searching...
No Matches
EBGeometry_Transform.hpp
Go to the documentation of this file.
1/* EBGeometry
2 * Copyright © 2022 Robert Marskar
3 * Please refer to Copyright.txt and LICENSE in the EBGeometry root directory.
4 */
5
12#ifndef EBGeometry_Transform
13#define EBGeometry_Transform
14
15// Our includes
17#include "EBGeometry_Vec.hpp"
19
24template <class T>
25std::shared_ptr<ImplicitFunction<T>>
26Complement(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction) noexcept;
27
33template <class T>
34std::shared_ptr<ImplicitFunction<T>>
35Translate(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const Vec3T<T>& a_shift) noexcept;
36
43template <class T>
44std::shared_ptr<ImplicitFunction<T>>
45Rotate(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const T a_angle, const size_t a_axis) noexcept;
46
52template <class T>
53std::shared_ptr<ImplicitFunction<T>>
54Scale(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const T a_scale) noexcept;
55
61template <class T>
62std::shared_ptr<ImplicitFunction<T>>
63Offset(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const T a_offset) noexcept;
64
70template <class T>
71std::shared_ptr<ImplicitFunction<T>>
72Annular(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const T a_delta) noexcept;
73
79template <class T>
80std::shared_ptr<ImplicitFunction<T>>
81Blur(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const T a_blurDistance) noexcept;
82
89template <class T>
90std::shared_ptr<ImplicitFunction<T>>
92 const T a_dist,
93 const size_t a_mollifierSamples = 2) noexcept;
94
103
112
118{
119public:
123 ComplementIF() = delete;
124
129 ComplementIF(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction) noexcept;
130
134 virtual ~ComplementIF();
135
139 virtual T
140 value(const Vec3T<T>& a_point) const noexcept override;
141
142protected:
146 std::shared_ptr<ImplicitFunction<T>> m_implicitFunction;
147};
148
152template <class T>
154{
155public:
159 TranslateIF() = delete;
160
166 TranslateIF(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const Vec3T<T>& a_shift) noexcept;
167
171 virtual ~TranslateIF();
172
176 virtual T
177 value(const Vec3T<T>& a_point) const noexcept override;
178
179protected:
183 std::shared_ptr<ImplicitFunction<T>> m_implicitFunction;
184
189};
190
194template <class T>
195class RotateIF : public ImplicitFunction<T>
196{
197public:
201 RotateIF() = delete;
202
210 const T a_angle,
211 const size_t a_axis) noexcept;
212
216 virtual ~RotateIF();
217
221 virtual T
222 value(const Vec3T<T>& a_point) const noexcept override;
223
224protected:
228 std::shared_ptr<ImplicitFunction<T>> m_implicitFunction;
229
233 size_t m_axis;
234
239
244
249};
250
254template <class T>
255class OffsetIF : public ImplicitFunction<T>
256{
257public:
261 OffsetIF() = delete;
262
268 OffsetIF(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const T a_offset) noexcept;
269
273 virtual ~OffsetIF();
274
278 virtual T
279 value(const Vec3T<T>& a_point) const noexcept override;
280
281protected:
285 std::shared_ptr<ImplicitFunction<T>> m_implicitFunction;
286
291};
292
296template <class T>
297class ScaleIF : public ImplicitFunction<T>
298{
299public:
303 ScaleIF() = delete;
304
310 ScaleIF(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const T a_scale) noexcept;
311
316
321 virtual T
323
329
334};
335
341{
342public:
346 AnnularIF() = delete;
347
354
358 virtual ~AnnularIF();
359
364 virtual T
365 value(const Vec3T<T>& a_point) const noexcept override;
366
367protected:
371 std::shared_ptr<const ImplicitFunction<T>> m_implicitFunction;
372
377};
378
385template <class T>
386class BlurIF : public ImplicitFunction<T>
387{
388public:
392 BlurIF() = delete;
393
401 const T a_blurDistance,
402 const T a_alpha = 0.5) noexcept;
403
408
413 virtual T
415
420 std::shared_ptr<ImplicitFunction<T>> m_implicitFunction;
421
425 T m_blurDistance;
426
430 T m_alpha;
431};
432
438{
439public:
443 MollifyIF() = delete;
444
453 const std::shared_ptr<ImplicitFunction<T>>& a_mollifier,
454 const T a_maxValue,
455 const size_t a_numPoints) noexcept;
456
461
466 virtual T
468
473 std::shared_ptr<ImplicitFunction<T>> m_implicitFunction;
474
478 std::shared_ptr<ImplicitFunction<T>> m_mollifier;
479
483 std::vector<std::pair<Vec3T<T>, T>> m_sampledMollifier;
484};
485
491{
492public:
496 ElongateIF() = delete;
497
503 ElongateIF(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const Vec3T<T>& a_elongation) noexcept;
504
509
514 virtual T
516
521 std::shared_ptr<const ImplicitFunction<T>> m_implicitFunction;
522
526 Vec3T<T> m_elongation;
527};
528
534{
535public:
539 ReflectIF() = delete;
540
546 ReflectIF(const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunction, const size_t& a_reflectPlane) noexcept;
547
552
557 virtual T
559
564 std::shared_ptr<const ImplicitFunction<T>> m_implicitFunction;
565
569 Vec3T<T> m_reflectParams;
570};
571
572#include "EBGeometry_NamespaceFooter.hpp"
573
574#include "EBGeometry_TransformImplem.hpp"
575
576#endif
Abstract base class for representing an implicit function.
std::shared_ptr< ImplicitFunction< T > > Reflect(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const size_t &a_reflectPlane) noexcept
Convenience function for reflecting an implicit function.
std::shared_ptr< ImplicitFunction< T > > Mollify(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_dist, const size_t a_mollifierSamples=2) noexcept
Convenience function for mollification with an input sphere.
std::shared_ptr< ImplicitFunction< T > > Elongate(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const Vec3T< T > &a_elongation) noexcept
Convenience function for elongating (stretching) an implicit function.
std::shared_ptr< ImplicitFunction< T > > Blur(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_blurDistance) noexcept
Convenience function for blurring an implicit function.
std::shared_ptr< ImplicitFunction< T > > Complement(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction) noexcept
Convenience function for taking the complement of an implicit function.
std::shared_ptr< ImplicitFunction< T > > Offset(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_offset) noexcept
Convenience function for offsetting an implicit function.
std::shared_ptr< ImplicitFunction< T > > Translate(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const Vec3T< T > &a_shift) noexcept
Convenience function for translating an implicit function.
std::shared_ptr< ImplicitFunction< T > > Scale(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_scale) noexcept
Convenience function for scaling an implicit function.
std::shared_ptr< ImplicitFunction< T > > Rotate(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_angle, const size_t a_axis) noexcept
Convenience function for rotating an implicit function.
std::shared_ptr< ImplicitFunction< T > > Annular(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_delta) noexcept
Convenience function for creating a shell out of an implicit function.
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Annular implicit function function. Creates a shell out of the implicit function.
Definition EBGeometry_Transform.hpp:341
virtual T value(const Vec3T< T > &a_point) const noexcept override
Value function.
std::shared_ptr< const ImplicitFunction< T > > m_implicitFunction
Original implicit function.
Definition EBGeometry_Transform.hpp:371
AnnularIF(const std::shared_ptr< ImplicitFunction< T > > a_implicitFunction, const T a_delta)
Full constructor.
T m_delta
Shell thickness.
Definition EBGeometry_Transform.hpp:376
AnnularIF()=delete
Disallowed weak construction.
virtual ~AnnularIF()
Destructor.
Blurred/interpolated implicit function - can be used for smoothing.
Definition EBGeometry_Transform.hpp:387
BlurIF()=delete
Disallowed weak constructino.
BlurIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_blurDistance, const T a_alpha=0.5) noexcept
Full constructor.
Complemented implicit function.
Definition EBGeometry_Transform.hpp:118
std::shared_ptr< ImplicitFunction< T > > m_implicitFunction
Implicit function.
Definition EBGeometry_Transform.hpp:146
ComplementIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction) noexcept
Full constructor.
virtual ~ComplementIF()
Destructor (does nothing)
virtual T value(const Vec3T< T > &a_point) const noexcept override
Value function.
ComplementIF()=delete
No weak construction for this one.
Implicit function which is an elongation of another implicit function along some axis.
Definition EBGeometry_Transform.hpp:491
virtual ~ElongateIF() noexcept
Destructor.
ElongateIF()=delete
Disallowed weak construction.
ElongateIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const Vec3T< T > &a_elongation) noexcept
Full constructor.
Abstract representation of an implicit function function (not necessarily signed distance).
Definition EBGeometry_ImplicitFunction.hpp:27
Mollified implicit function.
Definition EBGeometry_Transform.hpp:438
virtual ~MollifyIF() noexcept
Destructor.
MollifyIF()=delete
Disallowed weak construction.
MollifyIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const std::shared_ptr< ImplicitFunction< T > > &a_mollifier, const T a_maxValue, const size_t a_numPoints) noexcept
Full constructor.
Offset implicit function. Offsets the implicit function using the input value.
Definition EBGeometry_Transform.hpp:256
OffsetIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_offset) noexcept
Rounded SDF. Rounds the input SDF.
std::shared_ptr< ImplicitFunction< T > > m_implicitFunction
Underlying implicit function.
Definition EBGeometry_Transform.hpp:285
virtual ~OffsetIF()
Destructor.
T m_offset
Offset value.
Definition EBGeometry_Transform.hpp:290
OffsetIF()=delete
Disallowed weak construction.
virtual T value(const Vec3T< T > &a_point) const noexcept override
Implementation of value function with offset.
Implicit function which is a reflection of another implicit function.
Definition EBGeometry_Transform.hpp:534
virtual ~ReflectIF() noexcept
Destructor.
ReflectIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const size_t &a_reflectPlane) noexcept
Full constructor. Reflects around the input plane (0=yz-plane, 1=xz-plane, 2=xy-plane).
ReflectIF()=delete
Disallowed weak construction.
Rotated implicit function. Rotates an implicit function about an axis.
Definition EBGeometry_Transform.hpp:196
virtual ~RotateIF()
Destructor.
T m_sinAngle
Parameter in rotation matrix. Stored for efficiency.
Definition EBGeometry_Transform.hpp:248
std::shared_ptr< ImplicitFunction< T > > m_implicitFunction
Underlying implicit function.
Definition EBGeometry_Transform.hpp:228
RotateIF()=delete
No weak construction.
T m_angle
Angle to rotate.
Definition EBGeometry_Transform.hpp:238
RotateIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_angle, const size_t a_axis) noexcept
Rounded SDF. Rounds the input SDF.
T m_cosAngle
Parameter in rotation matrix. Stored for efficiency.
Definition EBGeometry_Transform.hpp:243
size_t m_axis
Axis to rotate about.
Definition EBGeometry_Transform.hpp:233
virtual T value(const Vec3T< T > &a_point) const noexcept override
Implementation of value function with rotation.
Scaled implicit function.
Definition EBGeometry_Transform.hpp:298
T m_scale
Scaling factor.
Definition EBGeometry_Transform.hpp:333
virtual T value(const Vec3T< T > &a_point) const noexcept override
Value function.
ScaleIF()=delete
Disallowed weak construction.
std::shared_ptr< ImplicitFunction< T > > m_implicitFunction
Original implicit function.
Definition EBGeometry_Transform.hpp:328
virtual ~ScaleIF() noexcept
Destructor.
ScaleIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_scale) noexcept
Scaled implicit function.
Translated implicit function.
Definition EBGeometry_Transform.hpp:154
Vec3T< T > m_shift
Input point translate.
Definition EBGeometry_Transform.hpp:188
virtual ~TranslateIF()
Destructor (does nothing)
virtual T value(const Vec3T< T > &a_point) const noexcept override
Value function.
TranslateIF()=delete
No weak construction for this one.
std::shared_ptr< ImplicitFunction< T > > m_implicitFunction
Underlying implicit function.
Definition EBGeometry_Transform.hpp:183
TranslateIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const Vec3T< T > &a_shift) noexcept
Full constructor.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:218