Eradicated the Pointf class, replaced with Eigen Vector3d

This commit is contained in:
bubnikv 2018-08-21 21:05:24 +02:00
parent cae0806112
commit 0b5b02e002
51 changed files with 267 additions and 293 deletions

View file

@ -56,15 +56,15 @@ new_from_points(CLASS, points)
Clone<BoundingBoxf> clone()
%code{% RETVAL = THIS; %};
void merge(BoundingBoxf* bb) %code{% THIS->merge(*bb); %};
void merge_point(Pointf* point) %code{% THIS->merge(*point); %};
void merge_point(Vec2d* point) %code{% THIS->merge(*point); %};
void scale(double factor);
void translate(double x, double y);
Clone<Pointf> size();
Clone<Pointf> center();
Clone<Vec2d> size();
Clone<Vec2d> center();
double radius();
bool empty() %code{% RETVAL = empty(*THIS); %};
Clone<Pointf> min_point() %code{% RETVAL = THIS->min; %};
Clone<Pointf> max_point() %code{% RETVAL = THIS->max; %};
Clone<Vec2d> min_point() %code{% RETVAL = THIS->min; %};
Clone<Vec2d> max_point() %code{% RETVAL = THIS->max; %};
double x_min() %code{% RETVAL = THIS->min(0); %};
double x_max() %code{% RETVAL = THIS->max(0); %};
double y_min() %code{% RETVAL = THIS->min(1); %};

View file

@ -35,9 +35,9 @@
}
%};
Ref<Pointf> origin()
Ref<Vec2d> origin()
%code{% RETVAL = &(THIS->origin()); %};
void set_origin(Pointf* pointf)
void set_origin(Vec2d* pointf)
%code{% THIS->set_origin(*pointf); %};
Ref<Point> last_pos()
%code{% RETVAL = &(THIS->last_pos()); %};

View file

@ -8,7 +8,7 @@
%package{Slic3r::Geometry};
Pointfs arrange(size_t total_parts, Pointf* part, coordf_t dist, BoundingBoxf* bb = NULL)
Pointfs arrange(size_t total_parts, Vec2d* part, coordf_t dist, BoundingBoxf* bb = NULL)
%code{%
Pointfs points;
if (! Slic3r::Geometry::arrange(total_parts, *part, dist, bb, points))

View file

@ -81,7 +81,7 @@
bool add_default_instances();
Clone<BoundingBoxf3> bounding_box();
void center_instances_around_point(Pointf* point)
void center_instances_around_point(Vec2d* point)
%code%{ THIS->center_instances_around_point(*point); %};
void translate(double x, double y, double z);
Clone<TriangleMesh> mesh();
@ -357,14 +357,14 @@ ModelMaterial::attributes()
%code%{ RETVAL = THIS->rotation; %};
double scaling_factor()
%code%{ RETVAL = THIS->scaling_factor; %};
Ref<Pointf> offset()
Ref<Vec2d> offset()
%code%{ RETVAL = &THIS->offset; %};
void set_rotation(double val)
%code%{ THIS->rotation = val; THIS->get_object()->invalidate_bounding_box(); %};
void set_scaling_factor(double val)
%code%{ THIS->scaling_factor = val; THIS->get_object()->invalidate_bounding_box(); %};
void set_offset(Pointf *offset)
void set_offset(Vec2d *offset)
%code%{ THIS->offset = *offset; %};
void transform_mesh(TriangleMesh* mesh, bool dont_translate = false) const;

View file

@ -91,10 +91,10 @@ Point::coincides_with(point_sv)
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%ld,%ld,%ld", (*THIS)(0), (*THIS)(1), (*THIS)(2)); RETVAL = buf; %};
};
%name{Slic3r::Pointf} class Pointf {
Pointf(double _x = 0, double _y = 0);
~Pointf();
Clone<Pointf> clone()
%name{Slic3r::Pointf} class Vec2d {
Vec2d(double _x = 0, double _y = 0);
~Vec2d();
Clone<Vec2d> clone()
%code{% RETVAL = THIS; %};
SV* arrayref()
%code{% RETVAL = to_SV_pureperl(THIS); %};
@ -109,15 +109,15 @@ Point::coincides_with(point_sv)
void set_y(double val)
%code{% (*THIS)(1) = val; %};
void translate(double x, double y)
%code{% *THIS += Pointf(x, y); %};
%code{% *THIS += Vec2d(x, y); %};
void scale(double factor)
%code{% *THIS *= factor; %};
void rotate(double angle, Pointf* center)
void rotate(double angle, Vec2d* center)
%code{% *THIS = Eigen::Translation2d(*center) * Eigen::Rotation2Dd(angle) * Eigen::Translation2d(- *center) * Eigen::Vector2d((*THIS)(0), (*THIS)(1)); %};
Pointf* negative()
%code{% RETVAL = new Pointf(- *THIS); %};
Pointf* vector_to(Pointf* point)
%code{% RETVAL = new Pointf(*point - *THIS); %};
Vec2d* negative()
%code{% RETVAL = new Vec2d(- *THIS); %};
Vec2d* vector_to(Vec2d* point)
%code{% RETVAL = new Vec2d(*point - *THIS); %};
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf", (*THIS)(0), (*THIS)(1)); RETVAL = buf; %};
};

View file

@ -72,7 +72,7 @@ _constant()
void set_shifted_copies(Points value)
%code%{ THIS->_shifted_copies = value; %};
bool add_copy(Pointf* point)
bool add_copy(Vec2d* point)
%code%{ RETVAL = THIS->add_copy(*point); %};
bool delete_last_copy();
bool delete_all_copies();

View file

@ -66,9 +66,9 @@ Point3* O_OBJECT_SLIC3R
Ref<Point3> O_OBJECT_SLIC3R_T
Clone<Point3> O_OBJECT_SLIC3R_T
Pointf* O_OBJECT_SLIC3R
Ref<Pointf> O_OBJECT_SLIC3R_T
Clone<Pointf> O_OBJECT_SLIC3R_T
Vec2d* O_OBJECT_SLIC3R
Ref<Vec2d> O_OBJECT_SLIC3R_T
Clone<Vec2d> O_OBJECT_SLIC3R_T
Vec3d* O_OBJECT_SLIC3R
Ref<Vec3d> O_OBJECT_SLIC3R_T

View file

@ -22,9 +22,9 @@
%typemap{Point3*};
%typemap{Ref<Point3>}{simple};
%typemap{Clone<Point3>}{simple};
%typemap{Pointf*};
%typemap{Ref<Pointf>}{simple};
%typemap{Clone<Pointf>}{simple};
%typemap{Vec2d*};
%typemap{Ref<Vec2d>}{simple};
%typemap{Clone<Vec2d>}{simple};
%typemap{Vec3d*};
%typemap{Ref<Vec3d>}{simple};
%typemap{Clone<Vec3d>}{simple};