mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-16 20:32:43 -07:00
Ported point_line_distance() and removed same_point()
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "Point.hpp"
|
||||
#include "Line.hpp"
|
||||
#include <math.h>
|
||||
|
||||
namespace Slic3r {
|
||||
@@ -72,6 +73,17 @@ Point::distance_to(const Point* point) const
|
||||
return sqrt(dx*dx + dy*dy);
|
||||
}
|
||||
|
||||
double
|
||||
Point::distance_to(const Line* line) const
|
||||
{
|
||||
if (line->a.coincides_with(&line->b)) return this->distance_to(&line->a);
|
||||
|
||||
double n = (line->b.x - line->a.x) * (line->a.y - this->y)
|
||||
- (line->a.x - this->x) * (line->b.y - line->a.y);
|
||||
|
||||
return abs(n) / line->length();
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
SV*
|
||||
Point::to_SV_ref() {
|
||||
|
||||
Reference in New Issue
Block a user