Atoms Crowd  7.0.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 }
Nurbs curve.
Definition: Curve.h:18
Nurbs curve.
Definition: SampledCurve.h:17
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.
virtual ~SampledCurve()
Destructor.
SampledCurve(const std::vector< AtomsMath::Vector3f > cvs, unsigned int degree, unsigned short numSamples=50)
Constructor.
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.
SampledCurve()
Constructor.
AtomsCore namespace.
Definition: Base64.h:13