~ubuntu-branches/ubuntu/utopic/slic3r/utopic

« back to all changes in this revision

Viewing changes to xs/xsp/ExPolygon.xsp

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2014-06-17 01:27:26 UTC
  • Revision ID: package-import@ubuntu.com-20140617012726-2wrs4zdo251nr4vg
Tags: upstream-1.1.4+dfsg
ImportĀ upstreamĀ versionĀ 1.1.4+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%module{Slic3r::XS};
 
2
 
 
3
%{
 
4
#include <myinit.h>
 
5
#include "ExPolygon.hpp"
 
6
%}
 
7
 
 
8
%name{Slic3r::ExPolygon} class ExPolygon {
 
9
    ~ExPolygon();
 
10
    Clone<ExPolygon> clone()
 
11
        %code{% RETVAL = THIS; %};
 
12
    SV* arrayref()
 
13
        %code{% RETVAL = THIS->to_AV(); %};
 
14
    SV* pp()
 
15
        %code{% RETVAL = THIS->to_SV_pureperl(); %};
 
16
    Ref<Polygon> contour()
 
17
        %code{% RETVAL = &(THIS->contour); %};
 
18
    Polygons* holes()
 
19
        %code{% RETVAL = &(THIS->holes); %};
 
20
    void scale(double factor);
 
21
    void translate(double x, double y);
 
22
    double area();
 
23
    bool is_valid();
 
24
    bool contains_line(Line* line)
 
25
        %code{% RETVAL = THIS->contains_line(*line); %};
 
26
    bool contains_point(Point* point)
 
27
        %code{% RETVAL = THIS->contains_point(*point); %};
 
28
    ExPolygons simplify(double tolerance);
 
29
    Polygons simplify_p(double tolerance);
 
30
    Polylines medial_axis(double max_width, double min_width)
 
31
        %code{% THIS->medial_axis(max_width, min_width, &RETVAL); %};
 
32
    Polygons get_trapezoids(double angle)
 
33
        %code{% THIS->get_trapezoids(&RETVAL, angle); %};
 
34
    Polygons get_trapezoids2(double angle)
 
35
        %code{% THIS->get_trapezoids2(&RETVAL, angle); %};
 
36
    Polygons triangulate()
 
37
        %code{% THIS->triangulate(&RETVAL); %};
 
38
    Polygons triangulate_pp()
 
39
        %code{% THIS->triangulate_pp(&RETVAL); %};
 
40
%{
 
41
 
 
42
ExPolygon*
 
43
ExPolygon::new(...)
 
44
    CODE:
 
45
        RETVAL = new ExPolygon ();
 
46
        // ST(0) is class name, ST(1) is contour and others are holes
 
47
        RETVAL->contour.from_SV_check(ST(1));
 
48
        RETVAL->holes.resize(items-2);
 
49
        for (unsigned int i = 2; i < items; i++) {
 
50
            RETVAL->holes[i-2].from_SV_check(ST(i));
 
51
        }
 
52
    OUTPUT:
 
53
        RETVAL
 
54
 
 
55
void
 
56
ExPolygon::rotate(angle, center_sv)
 
57
    double  angle;
 
58
    SV*     center_sv;
 
59
    CODE:
 
60
        Point center;
 
61
        center.from_SV_check(center_sv);
 
62
        THIS->rotate(angle, center);
 
63
 
 
64
%}
 
65
};