Changeset 28:0cbc8bf8ea86 in rrlib_geometry


Ignore:
Timestamp:
26.03.2012 11:58:02 (8 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Message:

Adjusted weights in tUniformBSplineCurve to make better curves with default tension=0.0

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • curves/tUniformBSplineCurve.hpp

    r25 r28  
    9090  typename tShape::tPoint bezier_control_points[4]; 
    9191 
    92   bezier_control_points[0] = (1.0 - this->tension) / 4.0 * (this->ControlPoints()[i] + this->ControlPoints()[i + 2]) + (1.0 + this->tension) / 2.0 * this->ControlPoints()[i + 1]; 
    93   bezier_control_points[1] = (1.0 + this->tension) / 2.0 * this->ControlPoints()[i + 1] + (1.0 - this->tension) / 2.0 * this->ControlPoints()[i + 2]; 
    94   bezier_control_points[2] = (1.0 - this->tension) / 2.0 * this->ControlPoints()[i + 1] + (1.0 + this->tension) / 2.0 * this->ControlPoints()[i + 2]; 
    95   bezier_control_points[3] = (1.0 - this->tension) / 4.0 * (this->ControlPoints()[i + 1] + this->ControlPoints()[i + 3]) + (1.0 + this->tension) / 2.0 * this->ControlPoints()[i + 2]; 
     92  bezier_control_points[0] = (1.0 - this->tension) / 6.0 * (this->ControlPoints()[i] + this->ControlPoints()[i + 2]) + (2.0 + this->tension) / 3.0 * this->ControlPoints()[i + 1]; 
     93  bezier_control_points[1] = (2.0 + this->tension) / 3.0 * this->ControlPoints()[i + 1] + (1.0 - this->tension) / 3.0 * this->ControlPoints()[i + 2]; 
     94  bezier_control_points[2] = (1.0 - this->tension) / 3.0 * this->ControlPoints()[i + 1] + (2.0 + this->tension) / 3.0 * this->ControlPoints()[i + 2]; 
     95  bezier_control_points[3] = (1.0 - this->tension) / 6.0 * (this->ControlPoints()[i + 1] + this->ControlPoints()[i + 3]) + (2.0 + this->tension) / 3.0 * this->ControlPoints()[i + 2]; 
    9696 
    9797  return typename tSplineCurve::tBezierCurve(bezier_control_points, bezier_control_points + 4); 
  • test/test_geometries.cpp

    r24 r28  
    6969typedef rrlib::geometry::tBezierCurve<2, tElement, 3> tBezierCurve; 
    7070typedef rrlib::geometry::tSplineCurve<2, tElement, 3> tSplineCurve; 
    71 //typedef rrlib::geometry::tUniformBSplineCurve<2, tElement> tConcreteSplineCurve; 
    72 typedef rrlib::geometry::tCardinalSplineCurve<2, tElement> tConcreteSplineCurve; 
     71typedef rrlib::geometry::tUniformBSplineCurve<2, tElement> tConcreteSplineCurve; 
     72//typedef rrlib::geometry::tCardinalSplineCurve<2, tElement> tConcreteSplineCurve; 
    7373 
    7474//---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.