Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ExPolygon.xsp « xsp « xs - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 75777fa56e0108f92486ac40fe1d0bed57860159 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
%module{Slic3r::XS};

%{
#include <myinit.h>
#include "libslic3r/ExPolygon.hpp"
%}

%name{Slic3r::ExPolygon} class ExPolygon {
    ~ExPolygon();
    Clone<ExPolygon> clone()
        %code{% RETVAL = THIS; %};
    SV* arrayref()
        %code{% RETVAL = THIS->to_AV(); %};
    SV* pp()
        %code{% RETVAL = THIS->to_SV_pureperl(); %};
    Ref<Polygon> contour()
        %code{% RETVAL = &(THIS->contour); %};
    Polygons* holes()
        %code{% RETVAL = &(THIS->holes); %};
    void scale(double factor);
    void translate(double x, double y);
    double area();
    bool is_valid();
    bool contains_line(Line* line)
        %code{% RETVAL = THIS->contains(*line); %};
    bool contains_polyline(Polyline* polyline)
        %code{% RETVAL = THIS->contains(*polyline); %};
    bool contains_point(Point* point)
        %code{% RETVAL = THIS->contains(*point); %};
    ExPolygons simplify(double tolerance);
    Polygons simplify_p(double tolerance);
    Polylines medial_axis(double max_width, double min_width)
        %code{% THIS->medial_axis(max_width, min_width, &RETVAL); %};
    Polygons get_trapezoids(double angle)
        %code{% THIS->get_trapezoids(&RETVAL, angle); %};
    Polygons get_trapezoids2(double angle)
        %code{% THIS->get_trapezoids2(&RETVAL, angle); %};
    Polygons triangulate()
        %code{% THIS->triangulate(&RETVAL); %};
    Polygons triangulate_pp()
        %code{% THIS->triangulate_pp(&RETVAL); %};
%{

ExPolygon*
ExPolygon::new(...)
    CODE:
        RETVAL = new ExPolygon ();
        // ST(0) is class name, ST(1) is contour and others are holes
        RETVAL->contour.from_SV_check(ST(1));
        RETVAL->holes.resize(items-2);
        for (unsigned int i = 2; i < items; i++) {
            RETVAL->holes[i-2].from_SV_check(ST(i));
        }
    OUTPUT:
        RETVAL

void
ExPolygon::rotate(angle, center_sv)
    double  angle;
    SV*     center_sv;
    CODE:
        Point center;
        center.from_SV_check(center_sv);
        THIS->rotate(angle, center);

%}
};