Skip to content

Commit

Permalink
Only limit the Bezier curve closest point at the end of the whole cur…
Browse files Browse the repository at this point in the history
…ve, while keeping the interior able to go beyond the normal to the line.
  • Loading branch information
MFraters committed Dec 5, 2023
1 parent 78f1200 commit 58535a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/world_builder/objects/bezier_curve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ namespace WorldBuilder
const double min_squared_distance_temp = (est_min_cp_end_0*est_min_cp_end_0)+(est_min_cp_end_1*est_min_cp_end_1);
if (min_squared_distance_temp < min_squared_distance)
{
if (est >= -1e-8 && est-1. <= 1e-8)
if (est >= -1e-8 && cp_i+est > 0 && est-1. <= 1e-8 && cp_i+est-1. < 0)
{
min_squared_distance = min_squared_distance_temp;
const Point<2> point_on_curve = Point<2>(a_0*est*est*est+b_0*est*est+c_0*est+d_0,a_1*est*est*est+b_1*est*est+c_1*est+d_1,cp.get_coordinate_system());
Expand Down Expand Up @@ -490,7 +490,7 @@ namespace WorldBuilder

if (min_squared_distance_cartesian_temp < min_squared_distance)
{
if (est >= -1e-8 && est-1. <= 1e-8)
if (est >= -1e-8 && cp_i+est > 0 && est-1. <= 1e-8 && cp_i+est-1. < 0)
{
min_squared_distance = min_squared_distance_cartesian_temp;
const Point<2> point_on_curve = a*est*est*est+b*est*est+c*est+d;
Expand Down

0 comments on commit 58535a8

Please sign in to comment.