Skip to content

Commit

Permalink
revert tests to main
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldouglas92 committed Jan 22, 2025
1 parent bbb9675 commit a9ea923
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions source/world_builder/objects/bezier_curve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ namespace WorldBuilder
const Point<2> P3P2 = points[p_i+1]-points[p_i];

// Check if the points are colinear, as this is a special case of the bezier curve.
if (points[p_i-1][0] * (points[p_i][1] - points[p_i+1][1]) +
points[p_i][0] * (points[p_i+1][1] - points[p_i-1][1]) +
points[p_i+1][0] * (points[p_i-1][1] - points[p_i][1]) < 1e-9)
if ( std::abs(points[p_i-1][0] * (points[p_i][1] - points[p_i+1][1]) +
points[p_i][0] * (points[p_i+1][1] - points[p_i-1][1]) +
points[p_i+1][0] * (points[p_i-1][1] - points[p_i][1])) < 1e-9)
colinear_points = true;

// Calculate the angles of the two lines determined above
Expand Down Expand Up @@ -219,8 +219,11 @@ namespace WorldBuilder
}
}

control_points[p_i][1][0] = cos(angles[p_i+1])*length*fraction_of_length+p2[0];
control_points[p_i][1][1] = sin(angles[p_i+1])*length*fraction_of_length+p2[1];
if (!colinear_points)
{
control_points[p_i][1][0] = cos(angles[p_i+1])*length*fraction_of_length+p2[0];
control_points[p_i][1][1] = sin(angles[p_i+1])*length*fraction_of_length+p2[1];
}

if (p_i+1 < n_points-1)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# x y z d g T vx vy vz c0 c1 tag
-20000 90000 990000 10000 20 6.34463 7.34463 8.34463 0 1 0
-20000 90000 990000 10000 20 6.44612 7.44612 8.44612 0 1 0
-20000 580000 990000 10000 20 4 5 6 0 1 0
-20000 910000 990000 10000 20 4 5 6 0 1 0
70000 -30000 990000 10000 10 1 2 3 1 0 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# x y z d g T vx vy vz c0 c1 tag
-20000 90000 990000 10000 20 6.34463 7.34463 8.34463 0 1 0
-20000 90000 990000 10000 20 6.44612 7.44612 8.44612 0 1 0
-20000 580000 990000 10000 20 4 5 6 0 1 0
-20000 910000 990000 10000 20 4 5 6 0 1 0
70000 -30000 990000 10000 10 1 2 3 1 0 0
Expand Down

0 comments on commit a9ea923

Please sign in to comment.