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

« back to all changes in this revision

Viewing changes to xs/xsp/Point.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 "Point.hpp"
 
6
%}
 
7
 
 
8
%name{Slic3r::Point} class Point {
 
9
    Point(long _x = 0, long _y = 0);
 
10
    ~Point();
 
11
    Clone<Point> clone()
 
12
        %code{% RETVAL=THIS; %}; 
 
13
    void scale(double factor);
 
14
    void translate(double x, double y);
 
15
    SV* arrayref()
 
16
        %code{% RETVAL = THIS->to_SV_pureperl(); %};
 
17
    SV* pp()
 
18
        %code{% RETVAL = THIS->to_SV_pureperl(); %};
 
19
    long x()
 
20
        %code{% RETVAL = THIS->x; %};
 
21
    long y()
 
22
        %code{% RETVAL = THIS->y; %};
 
23
    int nearest_point_index(Points points);
 
24
    Point* nearest_point(Points points)
 
25
        %code{% RETVAL = new Point(); THIS->nearest_point(points, RETVAL); %};
 
26
    double distance_to(Point* point)
 
27
        %code{% RETVAL = THIS->distance_to(*point); %};
 
28
    double distance_to_line(Line* line)
 
29
        %code{% RETVAL = THIS->distance_to(*line); %};
 
30
    double ccw(Point* p1, Point* p2)
 
31
        %code{% RETVAL = THIS->ccw(*p1, *p2); %};
 
32
    Clone<Point> projection_onto_polygon(Polygon* polygon)
 
33
        %code{% RETVAL = new Point(THIS->projection_onto(*polygon)); %};
 
34
    Clone<Point> projection_onto_polyline(Polyline* polyline)
 
35
        %code{% RETVAL = new Point(THIS->projection_onto(*polyline)); %};
 
36
    Clone<Point> projection_onto_line(Line* line)
 
37
        %code{% RETVAL = new Point(THIS->projection_onto(*line)); %};
 
38
    Clone<Point> negative()
 
39
        %code{% RETVAL = new Point(THIS->negative()); %};
 
40
 
 
41
%{
 
42
 
 
43
void
 
44
Point::rotate(angle, center_sv)
 
45
    double  angle;
 
46
    SV*     center_sv;
 
47
    CODE:
 
48
        Point center;
 
49
        center.from_SV_check(center_sv);
 
50
        THIS->rotate(angle, center);
 
51
 
 
52
bool
 
53
Point::coincides_with(point_sv)
 
54
    SV*     point_sv;
 
55
    CODE:
 
56
        Point point;
 
57
        point.from_SV_check(point_sv);
 
58
        RETVAL = THIS->coincides_with(point);
 
59
    OUTPUT:
 
60
        RETVAL
 
61
 
 
62
%}
 
63
 
 
64
};
 
65
 
 
66
%name{Slic3r::Pointf} class Pointf {
 
67
    Pointf(double _x = 0, double _y = 0);
 
68
    ~Pointf();
 
69
    Clone<Pointf> clone()
 
70
        %code{% RETVAL = THIS; %};
 
71
    double x()
 
72
        %code{% RETVAL = THIS->x; %};
 
73
    double y()
 
74
        %code{% RETVAL = THIS->y; %};
 
75
    void translate(double x, double y);
 
76
};
 
77
 
 
78
%name{Slic3r::Pointf3} class Pointf3 {
 
79
    Pointf3(double _x = 0, double _y = 0, double _z = 0);
 
80
    ~Pointf3();
 
81
    Clone<Pointf3> clone()
 
82
        %code{% RETVAL = THIS; %};
 
83
    double x()
 
84
        %code{% RETVAL = THIS->x; %};
 
85
    double y()
 
86
        %code{% RETVAL = THIS->y; %};
 
87
    double z()
 
88
        %code{% RETVAL = THIS->z; %};
 
89
};