Skip to content

Commit bfb4ec2

Browse files
address initial comments
1 parent d8cf693 commit bfb4ec2

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

source/world_builder/utilities.cc

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,6 @@ namespace WorldBuilder
407407
const Point<2> check_point_surface_2d(natural_coordinate.get_surface_coordinates(),
408408
natural_coordinate_system);
409409

410-
411-
412-
413-
414-
415-
416410
// The section which is checked.
417411
size_t section = 0;
418412

@@ -437,11 +431,11 @@ namespace WorldBuilder
437431
Objects::ClosestPointOnCurve closest_point_on_curve = bezier_curve.closest_point_on_curve_segment(check_point_surface_2d);
438432
Point<2> closest_point_on_line_2d = closest_point_on_curve.point;
439433

440-
// Hard-coded obliquity vector for testing purposes, this will be replaced later by an input parameter.
441-
// const Point<2> obliquity_vector(1.0, 0.0, natural_coordinate_system);
442-
443434
// If the obliquity_vector is not a NAN, this means that the user has specified an obliquity vector.
444-
// This will require a potential modification of the `closest_point_on_line_2d` variable.
435+
// This will require a potential modification of the `closest_point_on_line_2d` variable. We will take
436+
// the check point and use it with the obliquity vector to parameterize a line and see where this line
437+
// intersects the Bezier curve. If it does intersect the Bezier curve, then this intersection point will
438+
// become the new `closest_point_on_line_2d`, otherwise it will be set to NaN.
445439
if (!std::isnan(obliquity_vector[0]))
446440
{
447441
// Check if the bezier_curve has found a point on the curve that is closest to the checkpoint (without considering the obliquity vector).
@@ -471,7 +465,7 @@ namespace WorldBuilder
471465
}
472466

473467
const Point<2> AB_normal_ob = closest_point_on_curve.normal*closest_point_on_line_2d.distance(reference_point);//*AB.norm();
474-
const Point<2> local_reference_point_ob = AB_normal_ob*1.+closest_point_on_line_2d;
468+
const Point<2> local_reference_point_ob = AB_normal_ob + closest_point_on_line_2d;
475469
const bool reference_normal_on_side_of_line_ob = (closest_point_on_line_2d-local_reference_point_ob).norm_square() < (check_point_surface_2d_temp_ob-local_reference_point_ob).norm_square();
476470
const bool reference_point_on_side_of_line_ob = (point_list[point_list.size()-1][0] - point_list[0][0])*(reference_point[1] - point_list[0][1]) - (reference_point[0] - point_list[0][0])*(point_list[point_list.size()-1][1] - point_list[0][1]) < 0.;
477471

@@ -502,7 +496,7 @@ namespace WorldBuilder
502496
iterable_check_point_surface_2d[1] + line_factor * old_dist * obliquity_vector[1],
503497
natural_coordinate_system);
504498

505-
// Check where the closest point on the bezier curve is to the new check point (after moving along the
499+
// Check where the closest point on the Bezier curve is relative to the new check point (after moving along the
506500
// obliquity vector).
507501
iterable_closest_point_on_curve = bezier_curve.closest_point_on_curve_segment(parameterized_line);
508502
iterable_check_point_surface_2d = parameterized_line;
@@ -802,7 +796,7 @@ namespace WorldBuilder
802796

803797
// check whether the check point and the reference point are on the same side, if not, change the side.
804798
const Point<2> AB_normal = closest_point_on_curve.normal*closest_point_on_line_2d.distance(reference_point);//*AB.norm();
805-
const Point<2> local_reference_point = AB_normal*1.+closest_point_on_line_2d;
799+
const Point<2> local_reference_point = AB_normal + closest_point_on_line_2d;
806800
const bool reference_normal_on_side_of_line = (closest_point_on_line_2d-local_reference_point).norm_square() < (check_point_surface_2d_temp-local_reference_point).norm_square();
807801
const bool reference_point_on_side_of_line = (point_list[point_list.size()-1][0] - point_list[0][0])*(reference_point[1] - point_list[0][1]) - (reference_point[0] - point_list[0][0])*(point_list[point_list.size()-1][1] - point_list[0][1]) < 0.;
808802
const double reference_on_side_of_line = reference_normal_on_side_of_line == reference_point_on_side_of_line ? 1 : -1;

0 commit comments

Comments
 (0)