FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
solvespace/cython/python_solvespace/slvs.pxd at python · mdecourse/solvespace · GitHub
mdecourse
solvespace
Repository navigation
Code
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
solvespace
/
cython
/
python_solvespace
/
slvs.pxd
Copy path
More file actions
More file actions
Latest commit
History
History
History
309 lines (282 loc) · 9.6 KB
Breadcrumbs
solvespace
/
cython
/
python_solvespace
/
slvs.pxd
Copy path
File metadata and controls
309 lines (282 loc) · 9.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
#
-*- coding: utf-8 -*-
#
cython: language_level=3
"""
Wrapper header of Solvespace.
author: Yuan Chang
copyright: Copyright (C) 2016-2019
license: GPLv3+
email: pyslvs@gmail.com
"""
from
libc.stdint cimport uint32_t
from
libcpp.vector cimport vector
from
libcpp.map cimport
map
as
cmap
cdef extern
from
"
slvs.h
"
nogil:
ctypedef uint32_t Slvs_hParam
ctypedef uint32_t Slvs_hEntity
ctypedef uint32_t Slvs_hConstraint
ctypedef uint32_t Slvs_hGroup
#
Virtual work plane entity
Slvs_hEntity SLVS_FREE_IN_3D
ctypedef
struct
Slvs_Param:
Slvs_hParam h
Slvs_hGroup group
double
val
#
Entity type
int
SLVS_E_POINT_IN_3D
int
SLVS_E_POINT_IN_2D
int
SLVS_E_NORMAL_IN_2D
int
SLVS_E_NORMAL_IN_3D
int
SLVS_E_DISTANCE
int
SLVS_E_WORKPLANE
int
SLVS_E_LINE_SEGMENT
int
SLVS_E_CUBIC
int
SLVS_E_CIRCLE
int
SLVS_E_ARC_OF_CIRCLE
ctypedef
struct
Slvs_Entity:
Slvs_hEntity h
Slvs_hGroup group
int
type
Slvs_hEntity wrkpl
Slvs_hEntity point[
4
]
Slvs_hEntity normal
Slvs_hEntity distance
Slvs_hParam param[
4
]
int
SLVS_C_POINTS_COINCIDENT
int
SLVS_C_PT_PT_DISTANCE
int
SLVS_C_PT_PLANE_DISTANCE
int
SLVS_C_PT_LINE_DISTANCE
int
SLVS_C_PT_FACE_DISTANCE
int
SLVS_C_PT_IN_PLANE
int
SLVS_C_PT_ON_LINE
int
SLVS_C_PT_ON_FACE
int
SLVS_C_EQUAL_LENGTH_LINES
int
SLVS_C_LENGTH_RATIO
int
SLVS_C_EQ_LEN_PT_LINE_D
int
SLVS_C_EQ_PT_LN_DISTANCES
int
SLVS_C_EQUAL_ANGLE
int
SLVS_C_EQUAL_LINE_ARC_LEN
int
SLVS_C_SYMMETRIC
int
SLVS_C_SYMMETRIC_HORIZ
int
SLVS_C_SYMMETRIC_VERT
int
SLVS_C_SYMMETRIC_LINE
int
SLVS_C_AT_MIDPOINT
int
SLVS_C_HORIZONTAL
int
SLVS_C_VERTICAL
int
SLVS_C_DIAMETER
int
SLVS_C_PT_ON_CIRCLE
int
SLVS_C_SAME_ORIENTATION
int
SLVS_C_ANGLE
int
SLVS_C_PARALLEL
int
SLVS_C_PERPENDICULAR
int
SLVS_C_ARC_LINE_TANGENT
int
SLVS_C_CUBIC_LINE_TANGENT
int
SLVS_C_EQUAL_RADIUS
int
SLVS_C_PROJ_PT_DISTANCE
int
SLVS_C_WHERE_DRAGGED
int
SLVS_C_CURVE_CURVE_TANGENT
int
SLVS_C_LENGTH_DIFFERENCE
ctypedef
struct
Slvs_Constraint:
Slvs_hConstraint h
Slvs_hGroup group
int
type
Slvs_hEntity wrkpl
double
valA
Slvs_hEntity ptA
Slvs_hEntity ptB
Slvs_hEntity entityA
Slvs_hEntity entityB
Slvs_hEntity entityC
Slvs_hEntity entityD
int
other
int
other2
ctypedef
struct
Slvs_System:
Slvs_Param
*
param
int
params
Slvs_Entity
*
entity
int
entities
Slvs_Constraint
*
constraint
int
constraints
Slvs_hParam dragged[
4
]
int
calculateFaileds
Slvs_hConstraint
*
failed
int
faileds
int
dof
int
result
void
Slvs_Solve(Slvs_System
*
sys, Slvs_hGroup hg)
void
Slvs_QuaternionU(
double
qw,
double
qx,
double
qy,
double
qz,
double
*
x,
double
*
y,
double
*
z
)
void
Slvs_QuaternionV(
double
qw,
double
qx,
double
qy,
double
qz,
double
*
x,
double
*
y,
double
*
z
)
void
Slvs_QuaternionN(
double
qw,
double
qx,
double
qy,
double
qz,
double
*
x,
double
*
y,
double
*
z
)
void
Slvs_MakeQuaternion(
double
ux,
double
uy,
double
uz,
double
vx,
double
vy,
double
vz,
double
*
qw,
double
*
qx,
double
*
qy,
double
*
qz
)
Slvs_Param Slvs_MakeParam(Slvs_hParam h, Slvs_hGroup group,
double
val)
Slvs_Entity Slvs_MakePoint2d(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl,
Slvs_hParam u, Slvs_hParam v
)
Slvs_Entity Slvs_MakePoint3d(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hParam x, Slvs_hParam y, Slvs_hParam z
)
Slvs_Entity Slvs_MakeNormal3d(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hParam qw, Slvs_hParam qx,
Slvs_hParam qy, Slvs_hParam qz
)
Slvs_Entity Slvs_MakeNormal2d(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl
)
Slvs_Entity Slvs_MakeDistance(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl, Slvs_hParam d
)
Slvs_Entity Slvs_MakeLineSegment(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl,
Slvs_hEntity ptA, Slvs_hEntity ptB
)
Slvs_Entity Slvs_MakeCubic(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl,
Slvs_hEntity pt0, Slvs_hEntity pt1,
Slvs_hEntity pt2, Slvs_hEntity pt3
)
Slvs_Entity Slvs_MakeArcOfCircle(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl,
Slvs_hEntity normal,
Slvs_hEntity center,
Slvs_hEntity start, Slvs_hEntity end
)
Slvs_Entity Slvs_MakeCircle(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity wrkpl,
Slvs_hEntity center,
Slvs_hEntity normal, Slvs_hEntity radius
)
Slvs_Entity Slvs_MakeWorkplane(
Slvs_hEntity h, Slvs_hGroup group,
Slvs_hEntity origin, Slvs_hEntity normal
)
Slvs_Constraint Slvs_MakeConstraint(
Slvs_hConstraint h,
Slvs_hGroup group,
int
type
,
Slvs_hEntity wrkpl,
double
valA,
Slvs_hEntity ptA,
Slvs_hEntity ptB,
Slvs_hEntity entityA,
Slvs_hEntity entityB
)
cpdef
tuple
quaternion_u(
double
qw,
double
qx,
double
qy,
double
qz)
cpdef
tuple
quaternion_v(
double
qw,
double
qx,
double
qy,
double
qz)
cpdef
tuple
quaternion_n(
double
qw,
double
qx,
double
qy,
double
qz)
cpdef
tuple
make_quaternion(
double
ux,
double
uy,
double
uz,
double
vx,
double
vy,
double
vz)
cdef
class
Params:
cdef vector[Slvs_hParam] param_list
@
staticmethod
cdef Params create(Slvs_hParam
*
p, size_t count)
cdef
class
Entity:
cdef
int
t
cdef Slvs_hEntity h, wp
cdef Slvs_hGroup g
cdef readonly Params params
@
staticmethod
cdef Entity create(Slvs_Entity
*
e, size_t p_size)
cpdef bint is_3d(
self
)
cpdef bint is_none(
self
)
cpdef bint is_point_2d(
self
)
cpdef bint is_point_3d(
self
)
cpdef bint is_point(
self
)
cpdef bint is_normal_2d(
self
)
cpdef bint is_normal_3d(
self
)
cpdef bint is_normal(
self
)
cpdef bint is_distance(
self
)
cpdef bint is_work_plane(
self
)
cpdef bint is_line_2d(
self
)
cpdef bint is_line_3d(
self
)
cpdef bint is_line(
self
)
cpdef bint is_cubic(
self
)
cpdef bint is_circle(
self
)
cpdef bint is_arc(
self
)
cdef
class
SolverSystem:
cdef Slvs_hGroup g
cdef Slvs_System sys
cdef cmap[Slvs_hParam, Slvs_Param] param_list
cdef vector[Slvs_Entity] entity_list
cdef vector[Slvs_Constraint] cons_list
cdef vector[Slvs_hConstraint] failed_list
cdef
void
copy_to_sys(
self
) nogil
cdef
void
copy_from_sys(
self
) nogil
cpdef
void
clear(
self
)
cdef
void
failed_collecting(
self
) nogil
cdef
void
free(
self
)
cpdef
void
set_group(
self
, size_t g)
cpdef
int
group(
self
)
cpdef
void
set_params(
self
, Params p,
object
params)
cpdef
tuple
params(
self
, Params p)
cpdef
int
dof(
self
)
cpdef
object
constraints(
self
)
cpdef
list
failures(
self
)
cpdef
int
solve(
self
)
cpdef Entity create_2d_base(
self
)
cdef Slvs_hParam new_param(
self
,
double
val) nogil
cdef Slvs_hEntity eh(
self
) nogil
cpdef Entity add_point_2d(
self
,
double
u,
double
v, Entity wp)
cpdef Entity add_point_3d(
self
,
double
x,
double
y,
double
z)
cpdef Entity add_normal_2d(
self
, Entity wp)
cpdef Entity add_normal_3d(
self
,
double
qw,
double
qx,
double
qy,
double
qz)
cpdef Entity add_distance(
self
,
double
d, Entity wp)
cpdef Entity add_line_2d(
self
, Entity p1, Entity p2, Entity wp)
cpdef Entity add_line_3d(
self
, Entity p1, Entity p2)
cpdef Entity add_cubic(
self
, Entity p1, Entity p2, Entity p3, Entity p4, Entity wp)
cpdef Entity add_arc(
self
, Entity nm, Entity ct, Entity start, Entity end, Entity wp)
cpdef Entity add_circle(
self
, Entity nm, Entity ct, Entity radius, Entity wp)
cpdef Entity add_work_plane(
self
, Entity origin, Entity nm)
cpdef
void
add_constraint(
self
,
int
c_type,
Entity wp,
double
v,
Entity p1,
Entity p2,
Entity e1,
Entity e2,
Entity
e3
=
*
,
Entity
e4
=
*
,
int
other
=
*
,
int
other2
=
*
)
cpdef
void
coincident(
self
, Entity e1, Entity e2, Entity
wp
=
*
)
cpdef
void
distance(
self
, Entity e1, Entity e2,
double
value, Entity
wp
=
*
)
cpdef
void
equal(
self
, Entity e1, Entity e2, Entity
wp
=
*
)
cpdef
void
equal_included_angle(
self
, Entity e1, Entity e2, Entity e3, Entity e4, Entity wp)
cpdef
void
equal_point_to_line(
self
, Entity e1, Entity e2, Entity e3, Entity e4, Entity wp)
cpdef
void
ratio(
self
, Entity e1, Entity e2,
double
value, Entity wp)
cpdef
void
symmetric(
self
, Entity e1, Entity e2, Entity
e3
=
*
, Entity
wp
=
*
)
cpdef
void
symmetric_h(
self
, Entity e1, Entity e2, Entity wp)
cpdef
void
symmetric_v(
self
, Entity e1, Entity e2, Entity wp)
cpdef
void
midpoint(
self
, Entity e1, Entity e2, Entity
wp
=
*
)
cpdef
void
horizontal(
self
, Entity e1, Entity wp)
cpdef
void
vertical(
self
, Entity e1, Entity wp)
cpdef
void
diameter(
self
, Entity e1,
double
value, Entity wp)
cpdef
void
same_orientation(
self
, Entity e1, Entity e2)
cpdef
void
angle(
self
, Entity e1, Entity e2,
double
value, Entity wp, bint
inverse
=
*
)
cpdef
void
perpendicular(
self
, Entity e1, Entity e2, Entity wp, bint
inverse
=
*
)
cpdef
void
parallel(
self
, Entity e1, Entity e2, Entity
wp
=
*
)
cpdef
void
tangent(
self
, Entity e1, Entity e2, Entity
wp
=
*
)
cpdef
void
distance_proj(
self
, Entity e1, Entity e2,
double
value)
cpdef
void
dragged(
self
, Entity e1, Entity
wp
=
*
)
Back
|
FazBrowse Home
|
New Git URL