Changeset 49:d6bed8c3902e in rrlib_geometry


Ignore:
Timestamp:
29.05.2013 13:43:23 (6 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Message:

Made method to calculate the number of segments virtual in tSplineCurve and fixed the calculation for tBSplineCurve

Location:
curves
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • curves/tBSplineCurve.h

    r48 r49  
    9494  tBSplineCurve(TIterator begin, TIterator end); 
    9595 
     96  virtual const unsigned int NumberOfSegments() const; 
     97 
    9698  const std::vector<double> &Knots() const 
    9799  { 
  • curves/tBSplineCurve.hpp

    r48 r49  
    8989  this->CalculateBezierControlPoints(); 
    9090} 
     91 
     92//---------------------------------------------------------------------- 
     93// tBSplineCurve NumberOfSegments 
     94//---------------------------------------------------------------------- 
     95template <size_t Tdimension, typename TElement, unsigned int Tdegree> 
     96const unsigned int tBSplineCurve<Tdimension, TElement, Tdegree>::NumberOfSegments() const 
     97{ 
     98  unsigned int number_of_segments = 0; 
     99  double current_knot = this->knots[0]; 
     100  for (size_t i = 1; i < this->knots.size(); ++i) 
     101  { 
     102    if (current_knot != this->knots[i]) 
     103    { 
     104      number_of_segments++; 
     105      current_knot = this->knots[i]; 
     106    } 
     107  } 
     108  return number_of_segments; 
     109}; 
    91110 
    92111//template<size_t Tdimension, typename TElement, unsigned int Tdegree> 
  • curves/tSplineCurve.h

    r48 r49  
    114114  } 
    115115 
    116   inline const unsigned int NumberOfSegments() const 
    117   { 
    118     return this->control_points.size() - Tdegree; 
    119   }; 
     116  virtual const unsigned int NumberOfSegments() const; 
    120117 
    121118  inline const std::vector<typename tShape::tPoint> &ControlPoints() const 
  • curves/tSplineCurve.hpp

    r48 r49  
    9696 
    9797//---------------------------------------------------------------------- 
     98// tSplineCurve NumberOfSegments 
     99//---------------------------------------------------------------------- 
     100template <size_t Tdimension, typename TElement, unsigned int Tdegree> 
     101const unsigned int tSplineCurve<Tdimension, TElement, Tdegree>::NumberOfSegments() const 
     102{ 
     103  return this->control_points.size() - Tdegree; 
     104}; 
     105 
     106//---------------------------------------------------------------------- 
    98107// tSplineCurve SetControlPoint 
    99108//---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.