Removed Point::scale(),translate(),coincides_with(),distance_to(),

distance_to_squared(),perp_distance_to(),negative(),vector_to(),
translate(), distance_to() etc,
replaced with the Eigen equivalents.
This commit is contained in:
bubnikv 2018-08-17 14:14:24 +02:00
parent 3b89717149
commit 1ba64da3fe
45 changed files with 526 additions and 792 deletions

View file

@ -58,11 +58,7 @@
Clone<Pointf3> origin() const
%code%{ RETVAL = THIS->get_origin(); %};
void translate(double x, double y, double z)
%code%{
Pointf3 o = THIS->get_origin();
o.translate(x, y, z);
THIS->set_origin(o);
%};
%code%{ THIS->set_origin(THIS->get_origin() + Pointf3(x, y, z)); %};
Clone<BoundingBoxf3> bounding_box() const
%code%{ RETVAL = THIS->bounding_box; %};
Clone<BoundingBoxf3> transformed_bounding_box() const;

View file

@ -29,7 +29,6 @@
bool parallel_to_line(Line* line)
%code{% RETVAL = THIS->parallel_to(*line); %};
Clone<Point> midpoint();
Clone<Point> point_at(double distance);
Clone<Point> intersection_infinite(Line* other)
%code{%
Point p;
@ -37,8 +36,8 @@
if (!res) CONFESS("Intersection failed");
RETVAL = p;
%};
Clone<Polyline> as_polyline()
%code{% RETVAL = Polyline(*THIS); %};
Polyline* as_polyline()
%code{% RETVAL = new Polyline(THIS->a, THIS->b); %};
Clone<Point> normal();
Clone<Point> vector();
double ccw(Point* point)

View file

@ -3,6 +3,7 @@
%{
#include <xsinit.h>
#include "libslic3r/Point.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Polyline.hpp"
%}
@ -12,8 +13,10 @@
~Point();
Clone<Point> clone()
%code{% RETVAL=THIS; %};
void scale(double factor);
void translate(double x, double y);
void scale(double factor)
%code{% *THIS *= factor; %};
void translate(double x, double y)
%code{% *THIS += Point(x, y); %};
SV* arrayref()
%code{% RETVAL = to_SV_pureperl(THIS); %};
SV* pp()
@ -30,23 +33,23 @@
Clone<Point> nearest_point(Points points)
%code{% Point p; THIS->nearest_point(points, &p); RETVAL = p; %};
double distance_to(Point* point)
%code{% RETVAL = THIS->distance_to(*point); %};
%code{% RETVAL = (*point - *THIS).cast<double>().norm(); %};
double distance_to_line(Line* line)
%code{% RETVAL = THIS->distance_to(*line); %};
%code{% RETVAL = line->distance_to(*THIS); %};
double perp_distance_to_line(Line* line)
%code{% RETVAL = THIS->perp_distance_to(*line); %};
%code{% RETVAL = line->perp_distance_to(*THIS); %};
double ccw(Point* p1, Point* p2)
%code{% RETVAL = THIS->ccw(*p1, *p2); %};
double ccw_angle(Point* p1, Point* p2)
%code{% RETVAL = THIS->ccw_angle(*p1, *p2); %};
Clone<Point> projection_onto_polygon(Polygon* polygon)
Point* projection_onto_polygon(Polygon* polygon)
%code{% RETVAL = new Point(THIS->projection_onto(*polygon)); %};
Clone<Point> projection_onto_polyline(Polyline* polyline)
Point* projection_onto_polyline(Polyline* polyline)
%code{% RETVAL = new Point(THIS->projection_onto(*polyline)); %};
Clone<Point> projection_onto_line(Line* line)
Point* projection_onto_line(Line* line)
%code{% RETVAL = new Point(THIS->projection_onto(*line)); %};
Clone<Point> negative()
%code{% RETVAL = new Point(THIS->negative()); %};
Point* negative()
%code{% RETVAL = new Point(- *THIS); %};
bool coincides_with_epsilon(Point* point)
%code{% RETVAL = (*THIS) == *point; %};
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%ld,%ld", THIS->x(), THIS->y()); RETVAL = buf; %};
@ -107,14 +110,16 @@ Point::coincides_with(point_sv)
%code{% THIS->x() = val; %};
void set_y(double val)
%code{% THIS->y() = val; %};
void translate(double x, double y);
void scale(double factor);
void translate(double x, double y)
%code{% *THIS += Pointf(x, y); %};
void scale(double factor)
%code{% *THIS *= 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); %};
Pointf* negative()
%code{% RETVAL = new Pointf(- *THIS); %};
Pointf* vector_to(Pointf* point)
%code{% RETVAL = new Pointf(*point - *THIS); %};
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf", THIS->x(), THIS->y()); RETVAL = buf; %};
};
@ -135,13 +140,15 @@ Point::coincides_with(point_sv)
%code{% THIS->y() = val; %};
void set_z(double val)
%code{% THIS->z() = val; %};
void translate(double x, double y, double z);
void scale(double factor);
void translate(double x, double y, double z)
%code{% *THIS += Pointf3(x, y, z); %};
void scale(double factor)
%code{% *THIS *= factor; %};
double distance_to(Pointf3* point)
%code{% RETVAL = THIS->distance_to(*point); %};
Clone<Pointf3> negative()
%code{% RETVAL = THIS->negative(); %};
Clone<Pointf3> vector_to(Pointf3* point)
%code{% RETVAL = THIS->vector_to(*point); %};
%code{% RETVAL = (*point - *THIS).norm(); %};
Pointf3* negative()
%code{% RETVAL = new Pointf3(- *THIS); %};
Pointf3* vector_to(Pointf3* point)
%code{% RETVAL = new Pointf3(*point - *THIS); %};
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf,%lf", THIS->x(), THIS->y(), THIS->z()); RETVAL = buf; %};
};

View file

@ -176,15 +176,6 @@ _constant()
void set_step_started(PrintStep step)
%code%{ THIS->state.set_started(step); %};
void clear_filament_stats()
%code%{
THIS->filament_stats.clear();
%};
void set_filament_stats(int extruder_id, float length)
%code%{
THIS->filament_stats.insert(std::pair<size_t,float>(extruder_id, 0));
THIS->filament_stats[extruder_id] += length;
%};
SV* filament_stats()
%code%{
HV* hv = newHV();

View file

@ -181,7 +181,7 @@ TriangleMesh::slice(z)
std::vector<double> z
CODE:
// convert doubles to floats
std::vector<float> z_f(z.begin(), z.end());
std::vector<float> z_f = cast<float>(z);
std::vector<ExPolygons> layers;
TriangleMeshSlicer mslicer(THIS);