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

Polygon.xsp « xsp « xs - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cabf62adc9afffe8b501f34f15fbe1b0847a009a (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
68
69
70
71
72
73
%module{Slic3r::XS};

%{
#include <myinit.h>
#include "BoundingBox.hpp"
#include "Polygon.hpp"
#include "BoundingBox.hpp"
%}

%name{Slic3r::Polygon} class Polygon {
    ~Polygon();
    Clone<Polygon> clone()
        %code{% RETVAL = 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 reverse();
    Lines lines();
    Polyline* split_at_vertex(Point* point)
        %code{% RETVAL = new Polyline(); THIS->split_at_vertex(*point, RETVAL); %};
    Polyline* split_at_index(int index)
        %code{% RETVAL = new Polyline(); THIS->split_at_index(index, RETVAL); %};
    Polyline* split_at_first_point()
        %code{% RETVAL = new Polyline(); THIS->split_at_first_point(RETVAL); %};
    Points equally_spaced_points(double distance)
        %code{% THIS->equally_spaced_points(distance, &RETVAL); %};
    double length();
    double area();
    bool is_counter_clockwise();
    bool is_clockwise();
    bool make_counter_clockwise();
    bool make_clockwise();
    bool is_valid();
    Clone<Point> first_point();
    bool contains_point(Point* point)
        %code{% RETVAL = THIS->contains_point(*point); %};
    Polygons simplify(double tolerance);
    Polygons triangulate_convex()
        %code{% THIS->triangulate_convex(&RETVAL); %};
    Clone<Point> centroid();
    BoundingBox* bounding_box()
        %code{%
            RETVAL = new BoundingBox();
            THIS->bounding_box(RETVAL);
        %};
%{

Polygon*
Polygon::new(...)
    CODE:
        RETVAL = new Polygon ();
        // 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
Polygon::rotate(angle, center_sv)
    double  angle;
    SV*     center_sv;
    CODE:
        Point center;
        center.from_SV_check(center_sv);
        THIS->rotate(angle, center);

%}
};