mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 04:37:52 -06:00
Fixed conflicts after merging with branch eigenize
This commit is contained in:
commit
66ce638439
211 changed files with 4309 additions and 4920 deletions
|
@ -18,81 +18,80 @@ typedef std::vector<ThickLine> ThickLines;
|
|||
class Line
|
||||
{
|
||||
public:
|
||||
Point a;
|
||||
Point b;
|
||||
Line() {};
|
||||
explicit Line(Point _a, Point _b): a(_a), b(_b) {};
|
||||
std::string wkt() const;
|
||||
operator Lines() const;
|
||||
operator Polyline() const;
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void rotate(double angle, const Point ¢er);
|
||||
void reverse();
|
||||
double length() const;
|
||||
Point midpoint() const;
|
||||
void point_at(double distance, Point* point) const;
|
||||
Point point_at(double distance) const;
|
||||
bool intersection_infinite(const Line &other, Point* point) const;
|
||||
bool coincides_with(const Line &line) const;
|
||||
Line() {}
|
||||
Line(const Point& _a, const Point& _b) : a(_a), b(_b) {}
|
||||
explicit operator Lines() const { Lines lines; lines.emplace_back(*this); return lines; }
|
||||
void scale(double factor) { this->a *= factor; this->b *= factor; }
|
||||
void translate(double x, double y) { Vector v(x, y); this->a += v; this->b += v; }
|
||||
void rotate(double angle, const Point ¢er) { this->a.rotate(angle, center); this->b.rotate(angle, center); }
|
||||
void reverse() { std::swap(this->a, this->b); }
|
||||
double length() const { return (b - a).cast<double>().norm(); }
|
||||
Point midpoint() const { return (this->a + this->b) / 2; }
|
||||
bool intersection_infinite(const Line &other, Point* point) const;
|
||||
bool operator==(const Line &rhs) const { return this->a == rhs.a && this->b == rhs.b; }
|
||||
double distance_to(const Point &point) const;
|
||||
bool parallel_to(double angle) const;
|
||||
bool parallel_to(const Line &line) const;
|
||||
double atan2_() const;
|
||||
double perp_distance_to(const Point &point) const;
|
||||
bool parallel_to(double angle) const;
|
||||
bool parallel_to(const Line &line) const { return this->parallel_to(line.direction()); }
|
||||
double atan2_() const { return atan2(this->b(1) - this->a(1), this->b(0) - this->a(0)); }
|
||||
double orientation() const;
|
||||
double direction() const;
|
||||
Vector vector() const;
|
||||
Vector normal() const;
|
||||
void extend_end(double distance);
|
||||
void extend_start(double distance);
|
||||
bool intersection(const Line& line, Point* intersection) const;
|
||||
double ccw(const Point& point) const;
|
||||
Vector vector() const { return this->b - this->a; }
|
||||
Vector normal() const { return Vector((this->b(1) - this->a(1)), -(this->b(0) - this->a(0))); }
|
||||
bool intersection(const Line& line, Point* intersection) const;
|
||||
double ccw(const Point& point) const { return point.ccw(*this); }
|
||||
|
||||
Point a;
|
||||
Point b;
|
||||
};
|
||||
|
||||
class ThickLine : public Line
|
||||
{
|
||||
public:
|
||||
coordf_t a_width, b_width;
|
||||
|
||||
ThickLine() : a_width(0), b_width(0) {};
|
||||
ThickLine(Point _a, Point _b) : Line(_a, _b), a_width(0), b_width(0) {};
|
||||
public:
|
||||
ThickLine() : a_width(0), b_width(0) {}
|
||||
ThickLine(const Point& a, const Point& b) : Line(a, b), a_width(0), b_width(0) {}
|
||||
ThickLine(const Point& a, const Point& b, double wa, double wb) : Line(a, b), a_width(wa), b_width(wb) {}
|
||||
|
||||
double a_width, b_width;
|
||||
};
|
||||
|
||||
class Line3
|
||||
{
|
||||
public:
|
||||
Point3 a;
|
||||
Point3 b;
|
||||
Line3() : a(Vec3crd::Zero()), b(Vec3crd::Zero()) {}
|
||||
Line3(const Vec3crd& _a, const Vec3crd& _b) : a(_a), b(_b) {}
|
||||
|
||||
Line3() {}
|
||||
Line3(const Point3& _a, const Point3& _b) : a(_a), b(_b) {}
|
||||
double length() const { return (this->a - this->b).cast<double>().norm(); }
|
||||
Vec3crd vector() const { return this->b - this->a; }
|
||||
|
||||
double length() const;
|
||||
Vector3 vector() const;
|
||||
Vec3crd a;
|
||||
Vec3crd b;
|
||||
};
|
||||
|
||||
class Linef
|
||||
{
|
||||
public:
|
||||
Pointf a;
|
||||
Pointf b;
|
||||
Linef() {};
|
||||
explicit Linef(Pointf _a, Pointf _b): a(_a), b(_b) {};
|
||||
public:
|
||||
Linef() : a(Vec2d::Zero()), b(Vec2d::Zero()) {}
|
||||
Linef(const Vec2d& _a, const Vec2d& _b) : a(_a), b(_b) {}
|
||||
|
||||
Vec2d a;
|
||||
Vec2d b;
|
||||
};
|
||||
|
||||
class Linef3
|
||||
{
|
||||
public:
|
||||
Pointf3 a;
|
||||
Pointf3 b;
|
||||
Linef3() {};
|
||||
explicit Linef3(Pointf3 _a, Pointf3 _b): a(_a), b(_b) {};
|
||||
Pointf3 intersect_plane(double z) const;
|
||||
void scale(double factor);
|
||||
public:
|
||||
Linef3() : a(Vec3d::Zero()), b(Vec3d::Zero()) {}
|
||||
Linef3(const Vec3d& _a, const Vec3d& _b) : a(_a), b(_b) {}
|
||||
|
||||
double length() const { return this->a.distance_to(this->b); }
|
||||
Vectorf3 vector() const { return Vectorf3(this->b.x - this->a.x, this->b.y - this->a.y, this->b.z - this->a.z); }
|
||||
Vectorf3 unit_vector() const { return (length() == 0.0) ? Vectorf3(0.0, 0.0, 0.0) : normalize(vector()); }
|
||||
Vec3d intersect_plane(double z) const;
|
||||
void scale(double factor) { this->a *= factor; this->b *= factor; }
|
||||
Vec3d vector() const { return this->b - this->a; }
|
||||
Vec3d unit_vector() const { return (length() == 0.0) ? Vec3d::Zero() : vector().normalized(); }
|
||||
double length() const { return vector().norm(); }
|
||||
|
||||
Vec3d a;
|
||||
Vec3d b;
|
||||
};
|
||||
|
||||
} // namespace Slic3r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue