mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-02 12:41:18 -07:00
Refactoring of PreviewCanvas
This commit is contained in:
parent
74b3be3c06
commit
9cd0a63331
4 changed files with 185 additions and 151 deletions
|
|
@ -299,6 +299,18 @@ Pointf::rotate(double angle, const Pointf ¢er)
|
|||
this->y = center.y + cos(angle) * (cur_y - center.y) + sin(angle) * (cur_x - center.x);
|
||||
}
|
||||
|
||||
Pointf
|
||||
Pointf::negative() const
|
||||
{
|
||||
return Pointf(-this->x, -this->y);
|
||||
}
|
||||
|
||||
Vectorf
|
||||
Pointf::vector_to(const Pointf &point) const
|
||||
{
|
||||
return Vectorf(point.x - this->x, point.y - this->y);
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
|
||||
REGISTER_CLASS(Pointf, "Pointf");
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class Point;
|
|||
class Pointf;
|
||||
class Pointf3;
|
||||
typedef Point Vector;
|
||||
typedef Pointf Vectorf;
|
||||
typedef Pointf3 Vectorf3;
|
||||
typedef std::vector<Point> Points;
|
||||
typedef std::vector<Point*> PointPtrs;
|
||||
|
|
@ -81,6 +82,8 @@ class Pointf
|
|||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void rotate(double angle, const Pointf ¢er);
|
||||
Pointf negative() const;
|
||||
Vectorf vector_to(const Pointf &point) const;
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
bool from_SV(SV* point_sv);
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@ Point::coincides_with(point_sv)
|
|||
void scale(double factor);
|
||||
void rotate(double angle, Pointf* center)
|
||||
%code{% THIS->rotate(angle, *center); %};
|
||||
Clone<Pointf> negative()
|
||||
%code{% RETVAL = THIS->negative(); %};
|
||||
Clone<Pointf> vector_to(Pointf* point)
|
||||
%code{% RETVAL = THIS->vector_to(*point); %};
|
||||
};
|
||||
|
||||
%name{Slic3r::Pointf3} class Pointf3 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue