Refactored Point / MultiPoint / Polyline / Polygon:
1) Removed virtual methods. There was not really need for them. 2) Some of the virtual methods were using conversion to Lines, which was unnecessary and expensive. 3) Removed some nearest element search methods from Point.
This commit is contained in:
parent
9dca8403fe
commit
f1c0c61895
19 changed files with 173 additions and 264 deletions
|
@ -405,8 +405,8 @@ static ClipperLib_Z::Paths clip_extrusion(const ClipperLib_Z::Path &subject, con
|
|||
Point prev(subject.front().x(), subject.front().y());
|
||||
for (auto it = std::next(subject.begin()); it != subject.end(); ++it) {
|
||||
Point curr(it->x(), it->y());
|
||||
Point projected_pt = pt.projection_onto(Line(prev, curr));
|
||||
if (double dist_sqr = (projected_pt - pt).cast<double>().squaredNorm(); dist_sqr < dist_sqr_min) {
|
||||
Point projected_pt;
|
||||
if (double dist_sqr = line_alg::distance_to_squared(Line(prev, curr), pt, &projected_pt); dist_sqr < dist_sqr_min) {
|
||||
dist_sqr_min = dist_sqr;
|
||||
projected_pt_min = projected_pt;
|
||||
it_min = std::prev(it);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue