123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- %module{Slic3r::XS};
- %{
- #include <xsinit.h>
- #include "libslic3r/Point.hpp"
- #include "libslic3r/Polygon.hpp"
- #include "libslic3r/Polyline.hpp"
- %}
- %name{Slic3r::Point} class Point {
- Point(long _x = 0, long _y = 0);
- ~Point();
- Clone<Point> clone()
- %code{% RETVAL=THIS; %};
- void scale(double factor);
- void translate(double x, double y);
- SV* arrayref()
- %code{% RETVAL = to_SV_pureperl(THIS); %};
- SV* pp()
- %code{% RETVAL = to_SV_pureperl(THIS); %};
- long x()
- %code{% RETVAL = THIS->x; %};
- long y()
- %code{% RETVAL = THIS->y; %};
- void set_x(long val)
- %code{% THIS->x = val; %};
- void set_y(long val)
- %code{% THIS->y = val; %};
- int nearest_point_index(Points points);
- 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); %};
- double distance_to_line(Line* line)
- %code{% RETVAL = THIS->distance_to(*line); %};
- double perp_distance_to_line(Line* line)
- %code{% RETVAL = THIS->perp_distance_to(*line); %};
- 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)
- %code{% RETVAL = new Point(THIS->projection_onto(*polygon)); %};
- Clone<Point> projection_onto_polyline(Polyline* polyline)
- %code{% RETVAL = new Point(THIS->projection_onto(*polyline)); %};
- Clone<Point> projection_onto_line(Line* line)
- %code{% RETVAL = new Point(THIS->projection_onto(*line)); %};
- Clone<Point> negative()
- %code{% RETVAL = new Point(THIS->negative()); %};
- bool coincides_with_epsilon(Point* point)
- %code{% RETVAL = THIS->coincides_with_epsilon(*point); %};
- %{
- void
- Point::rotate(angle, center_sv)
- double angle;
- SV* center_sv;
- CODE:
- Point center;
- from_SV_check(center_sv, ¢er);
- THIS->rotate(angle, center);
- bool
- Point::coincides_with(point_sv)
- SV* point_sv;
- CODE:
- Point point;
- from_SV_check(point_sv, &point);
- RETVAL = THIS->coincides_with(point);
- OUTPUT:
- RETVAL
- %}
- };
- %name{Slic3r::Point3} class Point3 {
- Point3(long _x = 0, long _y = 0, long _z = 0);
- ~Point3();
- Clone<Point3> clone()
- %code{% RETVAL = THIS; %};
- long x()
- %code{% RETVAL = THIS->x; %};
- long y()
- %code{% RETVAL = THIS->y; %};
- long z()
- %code{% RETVAL = THIS->z; %};
- };
- %name{Slic3r::Pointf} class Pointf {
- Pointf(double _x = 0, double _y = 0);
- ~Pointf();
- Clone<Pointf> clone()
- %code{% RETVAL = THIS; %};
- SV* arrayref()
- %code{% RETVAL = to_SV_pureperl(THIS); %};
- SV* pp()
- %code{% RETVAL = to_SV_pureperl(THIS); %};
- double x()
- %code{% RETVAL = THIS->x; %};
- double y()
- %code{% RETVAL = THIS->y; %};
- void set_x(double val)
- %code{% THIS->x = val; %};
- void set_y(double val)
- %code{% THIS->y = val; %};
- void translate(double x, double y);
- 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 {
- Pointf3(double _x = 0, double _y = 0, double _z = 0);
- ~Pointf3();
- Clone<Pointf3> clone()
- %code{% RETVAL = THIS; %};
- double x()
- %code{% RETVAL = THIS->x; %};
- double y()
- %code{% RETVAL = THIS->y; %};
- double z()
- %code{% RETVAL = THIS->z; %};
- void set_x(double val)
- %code{% THIS->x = val; %};
- void set_y(double val)
- %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);
- 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); %};
- };
|