Atoms Crowd  4.1.0
SampledCurve.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <AtomsUtils/Curve.h>
11 #include <AtomsUtils/KdTreePoint.h>
12 
13 namespace AtomsUtils
14 {
16  class ATOMSUTILS_EXPORT SampledCurve : public Curve
17  {
18  public:
19 
22 
24 
28  SampledCurve(const std::vector<AtomsMath::Vector3f> cvs, unsigned int degree, unsigned short numSamples = 50);
29 
31  virtual ~SampledCurve();
32 
33  virtual std::pair<float, AtomsMath::Vector3f> closestPoint(const AtomsMath::Vector3f& point, unsigned int maxStep = 6, unsigned int maxIterations = 10, float tollarence = 0.0001f) override;
34 
35  virtual std::pair<float, AtomsMath::Vector3f> closestTangent(const AtomsMath::Vector3f& point, unsigned int maxStep = 6, unsigned int maxIterations = 10, float tollarence = 0.0001f) override;
36 
37  void resample(unsigned short samples);
38 
39  inline unsigned short numSamples() const { return m_numSamples; }
40 
41  inline const std::vector<AtomsMath::Vector3f>& samples() const { return m_points; }
42 
43  inline const std::vector<AtomsMath::Vector3f>& tangents() const { return m_tangents; }
44 
45  private:
46 
47  KdTreePoint m_tree;
48 
49  std::vector<AtomsMath::Vector3f> m_points;
50 
51  std::vector<AtomsMath::Vector3f> m_tangents;
52 
53  unsigned short m_numSamples;
54  };
55 }
AtomsUtils
AtomsCore namespace.
Definition: Base64.h:13
AtomsUtils::SampledCurve
Nurbs curve.
Definition: SampledCurve.h:17
AtomsUtils::Curve
Nurbs curve.
Definition: Curve.h:18
AtomsUtils::SampledCurve::closestPoint
virtual std::pair< float, AtomsMath::Vector3f > closestPoint(const AtomsMath::Vector3f &point, unsigned int maxStep=6, unsigned int maxIterations=10, float tollarence=0.0001f) override
Get closest point.
AtomsUtils::SampledCurve::~SampledCurve
virtual ~SampledCurve()
Destructor.
AtomsUtils::SampledCurve::SampledCurve
SampledCurve()
Constructor.
AtomsUtils::SampledCurve::closestTangent
virtual std::pair< float, AtomsMath::Vector3f > closestTangent(const AtomsMath::Vector3f &point, unsigned int maxStep=6, unsigned int maxIterations=10, float tollarence=0.0001f) override
Get closest tangent.
AtomsUtils::SampledCurve::SampledCurve
SampledCurve(const std::vector< AtomsMath::Vector3f > cvs, unsigned int degree, unsigned short numSamples=50)
Constructor.