Changeset 78:fab6cb47578c in rrlib_geometry


Ignore:
Timestamp:
22.08.2016 15:32:58 (3 years ago)
Author:
Tobias Föhst <tobias.foehst@…>
Branch:
14.08
Children:
79:cc3205e94205, 80:b720f2f65019
Phase:
public
Message:

Bugfix: limiting calculated intersection parameters to valid range in case of numeric issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • curves/tBezierCurve.hpp

    r76 r78  
    3434#include "rrlib/util/variadic_templates.h" 
    3535 
     36#include <iomanip> 
    3637//---------------------------------------------------------------------- 
    3738// Internal includes with "" 
     
    253254  { 
    254255    intersection_points.push_back(intersection_point); 
    255     const tParameter baseline_parameter((intersection_points.back() - this->control_points[0]).Length() / (this->control_points[Tdegree] - this->control_points[0]).Length()); 
     256    const auto baseline_parameter = math::LimitedValue<tParameter>((intersection_points.back() - this->control_points[0]).Length() / (this->control_points[Tdegree] - this->control_points[0]).Length(), 0, 1); 
    256257    assert(!std::isnan(baseline_parameter)); 
    257258    intersection_parameters.push_back(min_parameter + (max_parameter - min_parameter) * baseline_parameter); 
     
    291292  { 
    292293    intersection_points.push_back(intersection_point); 
    293     const tParameter baseline_parameter((intersection_points.back() - this->control_points[0]).Length() / (this->control_points[Tdegree] - this->control_points[0]).Length()); 
     294    const auto baseline_parameter = math::LimitedValue<tParameter>((intersection_points.back() - this->control_points[0]).Length() / (this->control_points[Tdegree] - this->control_points[0]).Length(), 0, 1); 
    294295    assert(!std::isnan(baseline_parameter)); 
    295296    intersection_parameters.push_back(min_parameter + (max_parameter - min_parameter) * baseline_parameter); 
Note: See TracChangeset for help on using the changeset viewer.