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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
from _common_decl cimport *
from _cy_rectangle cimport Rect, cy_Rect, wrap_Rect
from _cy_primitives cimport Point, cy_Point, wrap_Point
cdef extern from "2geom/affine.h" namespace "Geom":
cdef cppclass Affine:
Affine(Affine &)
Affine()
Affine(Coord, Coord, Coord, Coord, Coord, Coord)
Coord operator[](unsigned int)
Affine & operator*(Affine &)
Affine & operator*(Translate &)
Affine & operator*(Scale &)
Affine & operator*(Rotate &)
Affine & operator*(HShear &)
Affine & operator*(VShear &)
Affine & operator*(Zoom &)
bint operator==(Affine &)
bint operator!=(Affine &)
Point xAxis()
Point yAxis()
Point translation()
Coord expansionX()
Coord expansionY()
Point expansion()
void setXAxis(Point &)
void setYAxis(Point &)
void setTranslation(Point &)
void setExpansionX(Coord)
void setExpansionY(Coord)
void setIdentity()
bint isIdentity(Coord)
bint isTranslation(Coord)
bint isScale(Coord)
bint isUniformScale(Coord)
bint isRotation(Coord)
bint isHShear(Coord)
bint isVShear(Coord)
bint isNonzeroTranslation(Coord)
bint isNonzeroScale(Coord)
bint isNonzeroUniformScale(Coord)
bint isNonzeroRotation(Coord)
bint isNonzeroHShear(Coord)
bint isNonzeroVShear(Coord)
bint isZoom(Coord)
bint preservesArea(Coord)
bint preservesAngles(Coord)
bint preservesDistances(Coord)
bint flips()
bint isSingular(Coord)
Affine withoutTranslation()
Affine inverse()
Coord det()
Coord descrim2()
Coord descrim()
bint are_near(Affine &, Affine &, Coord)
Affine a_identity "Geom::Affine::identity" ()
cdef extern from "2geom/transforms.h" namespace "Geom":
Affine reflection(Point &, Point &)
#TODO find out how cython __pow__ works
Affine pow(Affine &, int)
Translate pow(Translate &, int)
Scale pow(Scale &, int)
Rotate pow(Rotate &, int)
HShear pow(HShear &, int)
VShear pow(VShear &, int)
Zoom pow(Zoom &, int)
cdef class cy_Affine:
cdef Affine* thisptr
cdef cy_Affine wrap_Affine(Affine)
#helper functions
cdef Affine get_Affine(t)
cdef bint is_transform(t)
cdef extern from "2geom/transforms.h" namespace "Geom":
cdef cppclass Translate:
Translate(Translate &)
Translate()
Translate(Point &)
Translate(Coord, Coord)
Coord operator[](Dim2)
Coord operator[](unsigned int)
Translate & operator*(Translate &)
Affine & operator*(Affine &)
bint operator==(Translate &)
bint operator!=(Translate &)
Affine operator()
Point vector()
Translate inverse()
Translate t_identity "Geom::Translate::identity" ()
cdef class cy_Translate:
cdef Translate* thisptr
cdef extern from "2geom/transforms.h" namespace "Geom":
cdef cppclass Scale:
Scale(Scale &)
Scale()
Scale(Point &)
Scale(Coord, Coord)
Scale(Coord)
Coord operator[](Dim2)
Scale & operator*(Scale &)
Affine & operator*(Affine &)
bint operator==(Scale &)
bint operator!=(Scale &)
Affine operator()
Point vector()
Scale inverse()
Scale identity()
Scale s_identity "Geom::Scale::identity" ()
cdef class cy_Scale:
cdef Scale* thisptr
cdef extern from "2geom/transforms.h" namespace "Geom":
cdef cppclass Rotate:
Rotate(Rotate &)
Rotate()
Rotate(Coord)
Rotate(Point &)
Rotate(Coord, Coord)
Point vector()
Coord operator[](Dim2)
Coord operator[](unsigned int)
Rotate & operator*(Rotate &)
Affine & operator*(Affine &)
bint operator==(Rotate &)
bint operator!=(Rotate &)
Affine operator()
Rotate inverse()
Rotate r_identity "Geom::Rotate::identity" ()
cdef extern from "2geom/transforms.h" namespace "Geom::Rotate":
Rotate from_degrees(Coord)
cdef class cy_Rotate:
cdef Rotate* thisptr
cdef extern from "2geom/transforms.h" namespace "Geom":
cdef cppclass VShear:
VShear(VShear &)
VShear(Coord)
Coord factor()
void setFactor(Coord)
VShear &operator*(VShear)
Affine & operator*(Affine &)
bint operator==(VShear &)
bint operator!=(VShear &)
Affine operator()
VShear inverse()
VShear vs_identity "Geom::VShear::identity"()
cdef class cy_VShear:
cdef VShear* thisptr
cdef extern from "2geom/transforms.h" namespace "Geom":
cdef cppclass HShear:
HShear(HShear &)
HShear(Coord)
Coord factor()
void setFactor(Coord)
HShear &operator*(HShear)
Affine & operator*(Affine &)
bint operator==(HShear &)
bint operator!=(HShear &)
Affine operator()
HShear inverse()
HShear hs_identity "Geom::HShear::identity"()
cdef class cy_HShear:
cdef HShear* thisptr
cdef extern from "2geom/transforms.h" namespace "Geom":
cdef cppclass Zoom:
Zoom(Zoom &)
Zoom(Coord)
Zoom(Translate &)
Zoom(Coord, Translate &)
Zoom & operator*(Zoom &)
Affine & operator*(Affine &)
bint operator==(Zoom &)
bint operator!=(Zoom &)
Affine operator()
Coord scale()
void setScale(Coord)
Point translation()
void setTranslation(Point &)
Zoom inverse()
Zoom()
Zoom z_identity "Geom::Zoom::identity" ()
cdef extern from "2geom/transforms.h" namespace "Geom::Zoom":
Zoom map_rect(Rect &, Rect &)
cdef class cy_Zoom:
cdef Zoom* thisptr
cdef extern from "2geom/affine.h" namespace "Geom":
cdef cppclass Eigen:
Point *vectors
double *values
Eigen(Affine &)
Eigen(double[2][2])
|