123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- %module{Slic3r::XS};
- %{
- #include <myinit.h>
- #include "Polyline.hpp"
- %}
- %name{Slic3r::Polyline} class Polyline {
- ~Polyline();
- Polyline* clone()
- %code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = new Polyline(*THIS); %};
- SV* arrayref()
- %code{% RETVAL = THIS->to_AV(); %};
- SV* pp()
- %code{% RETVAL = THIS->to_SV_pureperl(); %};
- void scale(double factor);
- void translate(double x, double y);
- void pop_back()
- %code{% THIS->points.pop_back(); %};
- void reverse();
- Lines lines();
- Point* first_point()
- %code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->first_point(); %};
- Point* last_point()
- %code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->last_point(); %};
- Points equally_spaced_points(double distance);
- double length();
- bool is_valid();
- void clip_end(double distance);
- void clip_start(double distance);
- %{
- Polyline*
- Polyline::new(...)
- CODE:
- RETVAL = new Polyline ();
- // ST(0) is class name, ST(1) is first point
- RETVAL->points.resize(items-1);
- for (unsigned int i = 1; i < items; i++) {
- RETVAL->points[i-1].from_SV_check( ST(i) );
- }
- OUTPUT:
- RETVAL
- void
- Polyline::append(...)
- CODE:
- for (unsigned int i = 1; i < items; i++) {
- Point p;
- p.from_SV_check( ST(i) );
- THIS->points.push_back(p);
- }
- void
- Polyline::append_polyline(polyline)
- Polyline* polyline;
- CODE:
- for (Points::const_iterator it = polyline->points.begin(); it != polyline->points.end(); ++it) {
- THIS->points.push_back((*it));
- }
- void
- Polyline::rotate(angle, center_sv)
- double angle;
- SV* center_sv;
- CODE:
- Point center;
- center.from_SV_check(center_sv);
- THIS->rotate(angle, ¢er);
- %}
- };
|