Changeset 38:569a61ee1214 in rrlib_geometry


Ignore:
Timestamp:
23.04.2012 17:00:17 (8 years ago)
Author:
Patrick Fleischmann <fleischmann@…>
Branch:
default
Phase:
public
Message:

Name of template parameters changed to convention

Location:
curves
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • curves/tBSplineCurve.h

    r37 r38  
    6969// Class declaration 
    7070//---------------------------------------------------------------------- 
    71 template < size_t Tdimension, typename TElement, unsigned int TDegree = 3 > 
    72 class tBSplineCurve : public tSplineCurve<Tdimension, TElement, TDegree> 
     71template < size_t Tdimension, typename TElement, unsigned int Tdegree = 3 > 
     72class tBSplineCurve : public tSplineCurve<Tdimension, TElement, Tdegree> 
    7373{ 
    74   typedef geometry::tSplineCurve<Tdimension, TElement, TDegree> tSplineCurve; 
     74  typedef geometry::tSplineCurve<Tdimension, TElement, Tdegree> tSplineCurve; 
    7575  typedef geometry::tShape<Tdimension, TElement> tShape; 
    7676 
  • curves/tBSplineCurve.hpp

    r37 r38  
    6262// tBSplineCurve constructor 
    6363//---------------------------------------------------------------------- 
    64 template<size_t TDimension, typename TElement, unsigned int TDegree> 
     64template<size_t Tdimension, typename TElement, unsigned int Tdegree> 
    6565template<typename TIterator, typename TKnotIterator> 
    66 tBSplineCurve<TDimension, TElement, TDegree>::tBSplineCurve(TIterator control_points_begin, TIterator control_points_end, TKnotIterator knots_begin, TKnotIterator knots_end) : 
     66tBSplineCurve<Tdimension, TElement, Tdegree>::tBSplineCurve(TIterator control_points_begin, TIterator control_points_end, TKnotIterator knots_begin, TKnotIterator knots_end) : 
    6767  tSplineCurve(control_points_begin, control_points_end) 
    6868{ 
    6969  // copy knots 
    7070  std::copy(knots_begin, knots_end, std::back_inserter(this->knots)); 
    71   assert(this->knots.size() == this->ControlPoints().size() + TDegree + 1); 
     71  assert(this->knots.size() == this->ControlPoints().size() + Tdegree + 1); 
    7272  this->CalculateBezierControlPoints(); 
    7373} 
    7474 
    75 template<size_t TDimension, typename TElement, unsigned int TDegree> 
     75template<size_t Tdimension, typename TElement, unsigned int Tdegree> 
    7676template<typename TIterator> 
    77 tBSplineCurve<TDimension, TElement, TDegree>::tBSplineCurve(TIterator begin, TIterator end) : 
     77tBSplineCurve<Tdimension, TElement, Tdegree>::tBSplineCurve(TIterator begin, TIterator end) : 
    7878  tSplineCurve(begin, end) 
    7979{ 
     
    8282} 
    8383 
    84 //template<size_t TDimension, typename TElement, unsigned int TDegree> 
    85 //void tBSplineCurve<TDimension, TElement, TDegree>::AppendControlPoint(const typename tShape::tPoint &point) 
     84//template<size_t Tdimension, typename TElement, unsigned int Tdegree> 
     85//void tBSplineCurve<Tdimension, TElement, Tdegree>::AppendControlPoint(const typename tShape::tPoint &point) 
    8686//{ 
    8787//  tSplineCurve::AppendControlPoint(point); 
     
    101101} 
    102102 
    103 template<size_t TDimension, typename TElement, unsigned int TDegree> 
    104 void tBSplineCurve<TDimension, TElement, TDegree>::CalculateKnotVector() 
     103template<size_t Tdimension, typename TElement, unsigned int Tdegree> 
     104void tBSplineCurve<Tdimension, TElement, Tdegree>::CalculateKnotVector() 
    105105{ 
    106106  this->knots.clear(); 
    107   assert(this->NumberOfControlPoints() > TDegree); 
     107  assert(this->NumberOfControlPoints() > Tdegree); 
    108108  // calculate knot vector 
    109   unsigned int length = this->NumberOfControlPoints() + TDegree + 1; 
     109  unsigned int length = this->NumberOfControlPoints() + Tdegree + 1; 
    110110  this->knots.reserve(length); 
    111111 
    112112  for (unsigned int i = 0; i < length; ++i) 
    113113  { 
    114     if (i < TDegree + 1) 
     114    if (i < Tdegree + 1) 
    115115    { 
    116116      this->knots.push_back(0); 
    117117    } 
    118     else if ((TDegree + 1) <= i && i <= this->NumberOfControlPoints()) 
     118    else if ((Tdegree + 1) <= i && i <= this->NumberOfControlPoints()) 
    119119    { 
    120120      // inner knot vector (uniform) 
    121       this->knots.push_back(1.0 / (this->NumberOfControlPoints() - TDegree) * (i - TDegree)); 
     121      this->knots.push_back(1.0 / (this->NumberOfControlPoints() - Tdegree) * (i - Tdegree)); 
    122122    } 
    123123    else if (i > this->NumberOfControlPoints()) 
     
    128128} 
    129129 
    130 template<size_t TDimension, typename TElement, unsigned int TDegree> 
    131 void tBSplineCurve<TDimension, TElement, TDegree>::CalculateBezierControlPoints() 
     130template<size_t Tdimension, typename TElement, unsigned int Tdegree> 
     131void tBSplineCurve<Tdimension, TElement, Tdegree>::CalculateBezierControlPoints() 
    132132{ 
    133133  this->bezier_control_points.clear(); 
    134134  std::vector<double> new_knots; 
    135   new_knots.reserve(this->knots.size() * TDegree); 
     135  new_knots.reserve(this->knots.size() * Tdegree); 
    136136  std::copy(this->knots.begin(), this->knots.end(), std::back_inserter(new_knots)); 
    137137  std::copy(this->ControlPoints().begin(), this->ControlPoints().end(), std::back_inserter(this->bezier_control_points)); 
     
    148148    else 
    149149    { 
    150       if (multiplicity < TDegree) 
     150      if (multiplicity < Tdegree) 
    151151      { 
    152         for (unsigned int s = multiplicity; s < TDegree; s++) 
     152        for (unsigned int s = multiplicity; s < Tdegree; s++) 
    153153        { 
    154154          this->bezier_control_points = InsertKnot((it - new_knots.begin()) - multiplicity, new_knots, knot, this->bezier_control_points); 
    155155          new_knots.insert(it, knot); 
    156156        } 
    157         it += TDegree - multiplicity; 
     157        it += Tdegree - multiplicity; 
    158158      } 
    159159      if (it < new_knots.end() - 1) 
     
    166166} 
    167167 
    168 template<size_t Tdimension, typename TElement, unsigned int TDegree> 
    169 std::vector<typename tBSplineCurve<Tdimension, TElement, TDegree>::tShape::tPoint> tBSplineCurve<Tdimension, TElement, TDegree>::InsertKnot(int at, const std::vector<double> &knots_before_insertion, double knot, const std::vector < 
     168template<size_t Tdimension, typename TElement, unsigned int Tdegree> 
     169std::vector<typename tBSplineCurve<Tdimension, TElement, Tdegree>::tShape::tPoint> tBSplineCurve<Tdimension, TElement, Tdegree>::InsertKnot(int at, const std::vector<double> &knots_before_insertion, double knot, const std::vector < 
    170170    typename tShape::tPoint > &control_points) const 
    171171{ 
     
    173173  new_control_points.reserve(control_points.size() + 1); 
    174174 
    175   // copy unaffected points (index < at-TDegree+1) 
    176   std::copy(control_points.begin(), control_points.begin() + at - TDegree + 1, std::back_inserter(new_control_points)); 
     175  // copy unaffected points (index < at-Tdegree+1) 
     176  std::copy(control_points.begin(), control_points.begin() + at - Tdegree + 1, std::back_inserter(new_control_points)); 
    177177 
    178178  // recalculate control points affected by knot insertion 
    179   for (int i = at - TDegree + 1; i <= at; i++) 
    180   { 
    181     double a = (knot - knots_before_insertion[i]) / (knots_before_insertion[i + TDegree] - knots_before_insertion[i]); 
     179  for (int i = at - Tdegree + 1; i <= at; i++) 
     180  { 
     181    double a = (knot - knots_before_insertion[i]) / (knots_before_insertion[i + Tdegree] - knots_before_insertion[i]); 
    182182    new_control_points.push_back((1 - a) * control_points[i - 1] + a * control_points[i]); 
    183183  } 
Note: See TracChangeset for help on using the changeset viewer.