1 from .vefm_271
import mesh
, vertex
, edge
, face
2 from math
import pi
, acos
, sin
, cos
, atan
, tan
, fabs
, sqrt
5 def check_contains(cl
, name
, print_value
=False):
13 print(name
, " contains ==>", el
, " value = ", tmp
)
15 print(name
, " contains ==>", el
)
16 print("\ncheck_contains finished\n\n")
23 self
.PKHG_parameters
= None
27 self
.skeleton
= [] # List of verts in the full skeleton edges.
28 self
.vertskeleton
= [] # config needs this member
29 self
.edgeskeleton
= [] # config needs this member
30 self
.sphericalverts
= []
39 self
.eccentricity
= None
56 self
.panelpoints
= None
57 self
.paneledges
= None
58 self
.reversepanel
= None
59 self
.edgelength
= None
63 def setparameters(self
, params
):
64 parameters
= self
.PKHG_parameters
= params
65 self
.frequency
= parameters
[0] # How many subdivisions - up to 20.
66 self
.eccentricity
= parameters
[1] # Elliptical if >1.0.
67 self
.squish
= parameters
[2] # Flattened if < 1.0.
68 self
.radius
= parameters
[3] # Exactly what it says.
69 self
.square
= parameters
[4] # Controls amount of superellipse in X/Y plane.
70 self
.squarez
= parameters
[5] # Controls amount of superellipse in Z dimension.
71 self
.cart
= parameters
[6] # Cuts out sphericalisation step.
72 self
.shape
= parameters
[7] # Full sphere, dome, flatbase.
73 self
.baselevel
= parameters
[8] # Where the base is cut on a flatbase dome.
74 self
.faceshape
= parameters
[9] # Triangular, hexagonal, tri-hex.
75 self
.dualflag
= parameters
[10]
76 self
.rotxy
= parameters
[11]
77 self
.rotz
= parameters
[12]
78 self
.klass
= parameters
[13]
79 self
.sform
= parameters
[14]
80 self
.super = 0 # Toggles superellipse.
81 if self
.square
!= 2.0 or self
.squarez
!= 2.0:
83 self
.odd
= 0 # Is the frequency odd. It matters for dome building.
84 if self
.frequency
% 2 != 0:
87 def makegeodesic(self
):
88 self
.vertedgefacedata() # PKHG only a pass 13okt11
89 self
.config() # Generate all the configuration information.
92 if self
.faceshape
== 1:
93 self
.hexify() # Hexagonal faces
94 elif self
.faceshape
== 2:
95 self
.starify() # Hex and Triangle faces
99 self
.sphericalize() # Convert x,y,z positions into spherical u,v.
100 self
.sphere2cartesian() # Convert spherical uv back into cartesian x,y,z for final shape.
101 for i
in range(len(self
.verts
)):
102 self
.verts
[i
].index
= i
103 for edg
in self
.edges
:
106 def vertedgefacedata(self
):
110 for i
in range(len(self
.vertskeleton
)):
111 self
.vertskeleton
[i
].index
= i
112 for edges
in self
.edgeskeleton
:
113 s
= skeletonrow(self
.frequency
, edges
, 0, self
) # self a geodesic
114 self
.skeleton
.append(s
)
115 for i
in range(len(self
.verts
)):
116 self
.verts
[i
].index
= i
117 for i
in range(len(self
.panelpoints
)):
118 a
= self
.vertsdone
[self
.panelpoints
[i
][0]][1]
119 b
= self
.vertsdone
[self
.panelpoints
[i
][1]][1]
120 c
= self
.vertsdone
[self
.panelpoints
[i
][2]][1]
121 panpoints
= [self
.verts
[a
],
124 panedges
= [self
.skeleton
[self
.paneledges
[i
][0]],
125 self
.skeleton
[self
.paneledges
[i
][1]],
126 self
.skeleton
[self
.paneledges
[i
][2]]]
128 for flag
in self
.reversepanel
:
131 p
= panel(panpoints
, panedges
, reverseflag
, self
)
133 def sphericalize(self
):
136 for vert
in(self
.verts
):
142 u
= self
.usphericalise(x
, y
, z
)
143 v
= self
.vsphericalise(x
, y
, z
)
144 self
.sphericalverts
.append([u
, v
])
146 def sphere2cartesian(self
):
147 for i
in range(len(self
.verts
)):
150 x
= self
.verts
[i
].vector
.x
* self
.radius
* self
.eccentricity
151 y
= self
.verts
[i
].vector
.y
* self
.radius
152 z
= self
.verts
[i
].vector
.z
* self
.radius
* self
.squish
154 u
= self
.sphericalverts
[i
][0]
155 v
= self
.sphericalverts
[i
][1]
156 if self
.squish
!= 1.0 or self
.eccentricity
> 1.0:
157 scalez
= 1 / self
.squish
158 v
= self
.ellipsecomp(scalez
, v
)
159 u
= self
.ellipsecomp(self
.eccentricity
, u
)
161 r1
= self
.superell(self
.square
, u
, self
.rotxy
)
162 r2
= self
.superell(self
.squarez
, v
, self
.rotz
)
168 r1
= r1
* self
.superform(self
.sform
[0], self
.sform
[1],
169 self
.sform
[2], self
.sform
[3],
170 self
.sform
[14] + u
, self
.sform
[4],
171 self
.sform
[5], self
.sform
[16] * v
)
173 r2
= r2
* self
.superform(self
.sform
[6], self
.sform
[7],
174 self
.sform
[8], self
.sform
[9],
175 self
.sform
[15] + v
, self
.sform
[10],
176 self
.sform
[11], self
.sform
[17] * v
)
177 x
, y
, z
= self
.cartesian(u
, v
, r1
, r2
)
179 self
.verts
[i
] = vertex((x
, y
, z
))
181 def usphericalise(self
, x
, y
, z
):
195 if x
< 0.0 and y
< 0.0:
196 theta
= theta
+ self
.a180
197 elif x
< 0.0 and y
> 0.0:
198 theta
= theta
+ self
.a180
202 def vsphericalise(self
, x
, y
, z
):
206 rho
= sqrt(x
** 2 + y
** 2 + z
** 2)
211 def ellipsecomp(self
, efactor
, theta
):
212 if theta
== self
.a90
:
214 elif theta
== self
.a270
:
217 result
= atan(tan(theta
) / efactor
**0.5)
220 y
= self
.a180
+ result
221 if fabs(x
- theta
) <= fabs(y
- theta
):
226 x
= self
.a180
+ result
229 if fabs(x
- theta
) <= fabs(y
- theta
):
235 def cutbasecomp(self
):
238 def cartesian(self
, u
, v
, r1
, r2
):
239 x
= r1
* cos(u
) * r2
* sin(v
) * self
.radius
* self
.eccentricity
240 y
= r1
* sin(u
) * r2
* sin(v
) * self
.radius
241 z
= r2
* cos(v
) * self
.radius
* self
.squish
246 def __init__(self
, count
, anchor
, leftindex
, rightindex
, stepvector
, endflag
, parentgeo
):
249 # Make a row of evenly spaced points.
250 for i
in range(count
+ 1):
252 self
.points
.append(leftindex
)
253 elif i
== count
and not endflag
:
254 self
.points
.append(rightindex
)
255 else: # PKHG Vectors added!
256 newpoint
= anchor
+ (stepvector
* i
)
257 vertcount
= len(parentgeo
.verts
)
258 self
.points
.append(vertcount
)
259 newpoint
.index
= vertcount
260 parentgeo
.verts
.append(newpoint
)
261 for i
in range(count
):
262 a
= parentgeo
.verts
[self
.points
[i
]]
263 b
= parentgeo
.verts
[self
.points
[i
+ 1]]
265 self
.edges
.append(len(parentgeo
.edges
))
266 parentgeo
.edges
.append(line
)
270 def __init__(self
, count
, skeletonedge
, shortflag
, parentgeo
):
273 self
.vect
= skeletonedge
.vect
274 self
.step
= skeletonedge
.vect
/ float(count
)
275 # Make a row of evenly spaced points.
276 for i
in range(count
+ 1):
277 vert1
= skeletonedge
.a
278 vert2
= skeletonedge
.b
280 if parentgeo
.vertsdone
[vert1
.index
][0]:
281 self
.points
.append(parentgeo
.vertsdone
[vert1
.index
][1])
283 newpoint
= vertex(vert1
.vector
)
284 vertcount
= len(parentgeo
.verts
)
285 self
.points
.append(vertcount
)
286 newpoint
.index
= vertcount
287 parentgeo
.vertsdone
[vert1
.index
] = [1, vertcount
]
288 parentgeo
.verts
.append(newpoint
)
291 if parentgeo
.vertsdone
[vert2
.index
][0]:
292 self
.points
.append(parentgeo
.vertsdone
[vert2
.index
][1])
294 newpoint
= vertex(vert2
.vector
)
295 vertcount
= len(parentgeo
.verts
)
296 self
.points
.append(vertcount
)
297 newpoint
.index
= vertcount
298 parentgeo
.vertsdone
[vert2
.index
] = [1, vertcount
]
299 parentgeo
.verts
.append(newpoint
)
301 newpoint
= vertex(vert1
.vector
+ (self
.step
* i
)) # must be a vertex!
302 vertcount
= len(parentgeo
.verts
)
303 self
.points
.append(vertcount
)
304 newpoint
.index
= vertcount
305 parentgeo
.verts
.append(newpoint
)
306 for i
in range(count
):
307 a
= parentgeo
.verts
[self
.points
[i
]]
308 b
= parentgeo
.verts
[self
.points
[i
+ 1]]
310 self
.edges
.append(len(parentgeo
.edges
))
311 parentgeo
.edges
.append(line
)
315 def __init__(self
, upper
, lower
, reverseflag
, parentgeo
, finish
):
316 for i
in range(finish
):
317 a
, b
, c
= upper
.points
[i
], lower
.points
[i
+ 1], lower
.points
[i
]
319 upface
= face([parentgeo
.verts
[a
], parentgeo
.verts
[c
], parentgeo
.verts
[b
]])
321 upface
= face([parentgeo
.verts
[a
], parentgeo
.verts
[b
], parentgeo
.verts
[c
]])
322 parentgeo
.faces
.append(upface
)
326 d
= upper
.points
[i
+ 1]
328 downface
= face([parentgeo
.verts
[b
], parentgeo
.verts
[d
], parentgeo
.verts
[a
]])
330 downface
= face([parentgeo
.verts
[b
], parentgeo
.verts
[a
], parentgeo
.verts
[d
]])
331 line
= edge(parentgeo
.verts
[a
], parentgeo
.verts
[b
])
332 line2
= edge(parentgeo
.verts
[d
], parentgeo
.verts
[b
])
333 parentgeo
.faces
.append(downface
)
334 parentgeo
.edges
.append(line
)
335 parentgeo
.edges
.append(line2
)
339 def __init__(self
, points
, edges
, reverseflag
, parentgeo
):
340 self
.cardinal
= points
[0]
341 self
.leftv
= points
[1]
342 self
.rightv
= points
[2]
343 self
.leftedge
= edges
[0]
344 self
.rightedge
= edges
[1]
345 self
.baseedge
= edges
[2]
347 self
.orient(parentgeo
, edges
)
348 self
.createrows(parentgeo
)
349 self
.createfaces(parentgeo
, reverseflag
)
351 def orient(self
, parentgeo
, edges
):
352 if self
.leftedge
.points
[0] != self
.cardinal
.index
:
353 self
.leftedge
.points
.reverse()
354 self
.leftedge
.vect
.negative()
356 if self
.rightedge
.points
[0] != self
.cardinal
.index
:
357 self
.rightedge
.points
.reverse()
358 self
.rightedge
.vect
.negative()
360 if self
.baseedge
.points
[0] != self
.leftv
.index
:
362 self
.baseedge
.points
.reverse()
363 self
.baseedge
.vect
.negative()
365 def createrows(self
, parentgeo
):
366 for i
in range(len(self
.leftedge
.points
)):
367 if i
== parentgeo
.frequency
:
368 newrow
= self
.baseedge
370 newrow
= edgerow(i
, parentgeo
.verts
[self
.leftedge
.points
[i
]], self
.leftedge
.points
[i
],
371 self
.rightedge
.points
[i
], self
.baseedge
.step
, 0, parentgeo
)
372 self
.rows
.append(newrow
)
374 def createfaces(self
, parentgeo
, reverseflag
):
375 for i
in range(len(self
.leftedge
.points
) - 1):
376 facefill(self
.rows
[i
], self
.rows
[i
+ 1], reverseflag
, parentgeo
, len(self
.rows
[i
].points
))
379 # for point on top? YES!
380 class tetrahedron(geodesic
, mesh
):
381 def __init__(self
, parameter
):
382 geodesic
.__init
__(mesh
)
383 geodesic
.setparameters(self
, parameter
)
384 self
.set_vert_edge_skeleons()
386 def set_vert_edge_skeleons(self
):
387 self
.vertskeleton
= [vertex((0.0, 0.0, 1.73205080757)),
388 vertex((0.0, -1.63299316185, -0.577350269185)),
389 vertex((1.41421356237, 0.816496580927, -0.57735026919)),
390 vertex((-1.41421356237, 0.816496580927, -0.57735026919))]
392 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
393 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
394 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
395 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
396 edge(self
.vertskeleton
[2], self
.vertskeleton
[3]),
397 edge(self
.vertskeleton
[1], self
.vertskeleton
[3])]
399 self
.panelpoints
= [[0, 1, 2], [0, 2, 3], [0, 1, 3], [1, 2, 3]]
400 self
.paneledges
= [[0, 1, 3], [1, 2, 4], [0, 2, 5], [3, 5, 4]]
401 self
.reversepanel
= [2, 3]
403 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
406 # for edge on top? YES
407 class tetraedge(geodesic
):
408 def __init__(self
, parameter
):
409 geodesic
.__init
__(mesh
)
410 geodesic
.setparameters(self
, parameter
)
411 self
.set_vert_edge_skeleons()
413 def set_vert_edge_skeleons(self
):
414 self
.vertskeleton
= [vertex((0.0, -1.41421356237, 1.0)),
415 vertex((0.0, 1.41421356237, 1.0)),
416 vertex((1.41421356237, 0.0, -1.0)),
417 vertex((-1.41421356237, 0.0, -1.0))]
419 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
420 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
421 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
422 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
423 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
424 edge(self
.vertskeleton
[2], self
.vertskeleton
[3])]
426 for i
in range(len(self
.vertskeleton
)):
427 self
.vertskeleton
[i
].index
= i
429 self
.panelpoints
= [[0, 1, 2], [1, 2, 3], [0, 1, 3], [0, 2, 3]]
430 self
.paneledges
= [[0, 1, 4], [4, 3, 5], [0, 2, 3], [1, 2, 5]]
431 self
.reversepanel
= [0, 3]
433 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
436 # for face on top? YES
437 class tetraface(geodesic
):
438 def __init__(self
, parameter
):
439 geodesic
.__init
__(mesh
)
440 geodesic
.setparameters(self
, parameter
)
441 self
.set_vert_edge_skeleons()
443 def set_vert_edge_skeleons(self
):
444 self
.vertskeleton
= [vertex((-1.41421356237, -0.816496580927, 0.57735026919)),
445 vertex((1.41421356237, -0.816496580927, 0.57735026919)),
446 vertex((0.0, 1.63299316185, 0.577350269185)),
447 vertex((0.0, 0.0, -1.73205080757))]
449 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
450 edge(self
.vertskeleton
[2], self
.vertskeleton
[1]),
451 edge(self
.vertskeleton
[2], self
.vertskeleton
[0]),
452 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
453 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
454 edge(self
.vertskeleton
[2], self
.vertskeleton
[3])
456 self
.panelpoints
= [[2, 0, 1], [0, 1, 3], [2, 1, 3], [2, 0, 3]]
458 self
.paneledges
= [[2, 1, 0], [0, 3, 4], [1, 5, 4], [2, 5, 3]]
459 self
.reversepanel
= [1, 3]
461 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
464 class octahedron(geodesic
):
465 def __init__(self
, parameter
):
466 geodesic
.__init
__(mesh
)
467 geodesic
.setparameters(self
, parameter
)
468 self
.set_vert_edge_skeleons()
470 def set_vert_edge_skeleons(self
):
471 self
.vertskeleton
= [vertex((0.0, 0.0, 1.0)),
472 vertex((0.0, 1.0, 0.0)),
473 vertex((-1.0, 0.0, 0.0)),
474 vertex((0.0, -1.0, 0.0)),
475 vertex((1.0, 0.0, 0.0)),
476 vertex((0.0, 0.0, -1.0))]
478 for i
in range(len(self
.vertskeleton
)):
479 self
.vertskeleton
[i
].index
= i
480 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
481 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
482 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
483 edge(self
.vertskeleton
[0], self
.vertskeleton
[4]),
484 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
485 edge(self
.vertskeleton
[2], self
.vertskeleton
[3]),
486 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
487 edge(self
.vertskeleton
[4], self
.vertskeleton
[1]),
488 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
489 edge(self
.vertskeleton
[2], self
.vertskeleton
[5]),
490 edge(self
.vertskeleton
[3], self
.vertskeleton
[5]),
491 edge(self
.vertskeleton
[4], self
.vertskeleton
[5])]
493 self
.panelpoints
= [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [1, 2, 5],
494 [2, 3, 5], [3, 4, 5], [4, 1, 5]]
495 self
.paneledges
= [[0, 1, 4], [1, 2, 5], [2, 3, 6], [3, 0, 7], [4, 8, 9],
496 [5, 9, 10], [6, 10, 11], [7, 11, 8]]
497 self
.reversepanel
= [4, 5, 6, 7]
499 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
502 class octaedge(geodesic
):
503 def __init__(self
, parameter
):
504 geodesic
.__init
__(mesh
)
505 geodesic
.setparameters(self
, parameter
)
506 self
.set_vert_edge_skeleons()
508 def set_vert_edge_skeleons(self
):
509 self
.vertskeleton
= [vertex((0.0, -0.707106781187, 0.707106781187)),
510 vertex((0.0, 0.707106781187, 0.707106781187)),
511 vertex((1.0, 0.0, 0.0)),
512 vertex((-1.0, 0.0, 0.0)),
513 vertex((0.0, -0.707106781187, -0.707106781187)),
514 vertex((0.0, 0.707106781187, -0.707106781187))]
516 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
517 edge(self
.vertskeleton
[0], self
.vertskeleton
[4]),
518 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
519 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
520 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
521 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
522 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
523 edge(self
.vertskeleton
[2], self
.vertskeleton
[4]),
524 edge(self
.vertskeleton
[2], self
.vertskeleton
[5]),
525 edge(self
.vertskeleton
[3], self
.vertskeleton
[5]),
526 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
527 edge(self
.vertskeleton
[4], self
.vertskeleton
[5])]
529 self
.panelpoints
= [[0, 1, 2], [0, 1, 3], [0, 2, 4], [1, 2, 5], [1, 3, 5],
530 [0, 3, 4], [2, 4, 5], [3, 4, 5]]
531 self
.paneledges
= [[0, 2, 3], [0, 6, 5], [2, 1, 7], [3, 4, 8], [5, 4, 9],
532 [6, 1, 10], [7, 8, 11], [10, 9, 11]]
534 self
.reversepanel
= [0, 2, 4, 7]
536 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
539 class octaface(geodesic
):
540 def __init__(self
, parameter
):
541 geodesic
.__init
__(mesh
)
542 geodesic
.setparameters(self
, parameter
)
543 self
.set_vert_edge_skeleons()
545 def set_vert_edge_skeleons(self
):
546 self
.vertskeleton
= [vertex((0.408248458663, -0.707106781187, 0.577350150255)),
547 vertex((0.408248458663, 0.707106781187, 0.577350150255)),
548 vertex((-0.816496412728, 0.0, 0.577350507059)),
549 vertex((-0.408248458663, -0.707106781187, -0.577350150255)),
550 vertex((0.816496412728, 0.0, -0.577350507059)),
551 vertex((-0.408248458663, 0.707106781187, -0.577350150255))]
553 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
554 edge(self
.vertskeleton
[2], self
.vertskeleton
[1]),
555 edge(self
.vertskeleton
[2], self
.vertskeleton
[0]),
556 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
557 edge(self
.vertskeleton
[0], self
.vertskeleton
[4]),
558 edge(self
.vertskeleton
[1], self
.vertskeleton
[4]),
559 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
560 edge(self
.vertskeleton
[2], self
.vertskeleton
[5]),
561 edge(self
.vertskeleton
[2], self
.vertskeleton
[3]),
562 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
563 edge(self
.vertskeleton
[4], self
.vertskeleton
[5]),
564 edge(self
.vertskeleton
[3], self
.vertskeleton
[5])]
566 self
.panelpoints
= [[2, 0, 1], [0, 3, 4], [0, 1, 4], [1, 4, 5],
567 [2, 1, 5], [2, 3, 5], [2, 0, 3], [3, 4, 5]]
569 self
.paneledges
= [[2, 1, 0], [3, 4, 9], [0, 4, 5], [5, 6, 10],
570 [1, 7, 6], [8, 7, 11], [2, 8, 3], [9, 11, 10]]
572 self
.reversepanel
= [2, 5, 6, 7]
574 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
577 class icosahedron(geodesic
):
578 def __init__(self
, parameter
):
579 geodesic
.__init
__(mesh
)
580 geodesic
.setparameters(self
, parameter
)
581 self
.set_vert_edge_skeleons()
583 def set_vert_edge_skeleons(self
):
584 self
.vertskeleton
= [vertex((0.0, 0.0, 0.587785252292)),
585 vertex((0.0, -0.525731096637, 0.262865587024)),
586 vertex((0.5, -0.162459832634, 0.262865565628)),
587 vertex((0.309016994375, 0.425325419658, 0.262865531009)),
588 vertex((-0.309016994375, 0.425325419658, 0.262865531009)),
589 vertex((-0.5, -0.162459832634, 0.262865565628)),
590 vertex((0.309016994375, -0.425325419658, -0.262865531009)),
591 vertex((0.5, 0.162459832634, -0.262865565628)),
592 vertex((0.0, 0.525731096637, -0.262865587024)),
593 vertex((-0.5, 0.162459832634, -0.262865565628)),
594 vertex((-0.309016994375, -0.425325419658, -0.262865531009)),
595 vertex((0.0, 0.0, -0.587785252292))]
597 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
598 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
599 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
600 edge(self
.vertskeleton
[0], self
.vertskeleton
[4]),
601 edge(self
.vertskeleton
[0], self
.vertskeleton
[5]),
602 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
603 edge(self
.vertskeleton
[2], self
.vertskeleton
[3]),
604 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
605 edge(self
.vertskeleton
[4], self
.vertskeleton
[5]),
606 edge(self
.vertskeleton
[5], self
.vertskeleton
[1]),
607 edge(self
.vertskeleton
[1], self
.vertskeleton
[6]),
608 edge(self
.vertskeleton
[2], self
.vertskeleton
[6]),
609 edge(self
.vertskeleton
[2], self
.vertskeleton
[7]),
610 edge(self
.vertskeleton
[3], self
.vertskeleton
[7]),
611 edge(self
.vertskeleton
[3], self
.vertskeleton
[8]),
612 edge(self
.vertskeleton
[4], self
.vertskeleton
[8]),
613 edge(self
.vertskeleton
[4], self
.vertskeleton
[9]),
614 edge(self
.vertskeleton
[5], self
.vertskeleton
[9]),
615 edge(self
.vertskeleton
[5], self
.vertskeleton
[10]),
616 edge(self
.vertskeleton
[1], self
.vertskeleton
[10]),
617 edge(self
.vertskeleton
[6], self
.vertskeleton
[7]),
618 edge(self
.vertskeleton
[7], self
.vertskeleton
[8]),
619 edge(self
.vertskeleton
[8], self
.vertskeleton
[9]),
620 edge(self
.vertskeleton
[9], self
.vertskeleton
[10]),
621 edge(self
.vertskeleton
[10], self
.vertskeleton
[6]),
622 edge(self
.vertskeleton
[6], self
.vertskeleton
[11]),
623 edge(self
.vertskeleton
[7], self
.vertskeleton
[11]),
624 edge(self
.vertskeleton
[8], self
.vertskeleton
[11]),
625 edge(self
.vertskeleton
[9], self
.vertskeleton
[11]),
626 edge(self
.vertskeleton
[10], self
.vertskeleton
[11])]
628 self
.panelpoints
= [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1], [1, 2, 6],
629 [2, 6, 7], [2, 3, 7], [3, 7, 8], [3, 4, 8], [4, 8, 9], [4, 5, 9],
630 [5, 9, 10], [5, 1, 10], [1, 10, 6], [6, 7, 11], [7, 8, 11],
631 [8, 9, 11], [9, 10, 11], [10, 6, 11]]
633 self
.paneledges
= [[0, 1, 5], [1, 2, 6], [2, 3, 7], [3, 4, 8], [4, 0, 9], [5, 10, 11],
634 [11, 12, 20], [6, 12, 13], [13, 14, 21], [7, 14, 15], [15, 16, 22],
635 [8, 16, 17], [17, 18, 23], [9, 18, 19], [19, 10, 24], [20, 25, 26],
636 [21, 26, 27], [22, 27, 28], [23, 28, 29], [24, 29, 25]]
638 self
.reversepanel
= [5, 7, 9, 11, 13, 15, 16, 17, 18, 19]
640 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
643 class icoedge(geodesic
):
644 def __init__(self
, parameter
):
645 geodesic
.__init
__(mesh
)
646 geodesic
.setparameters(self
, parameter
)
647 self
.set_vert_edge_skeleons()
649 def set_vert_edge_skeleons(self
):
650 self
.vertskeleton
= [vertex((0, 0.309016994375, 0.5)),
651 vertex((0, -0.309016994375, 0.5)),
652 vertex((-0.5, 0, 0.309016994375)),
653 vertex((0.5, 0, 0.309016994375)),
654 vertex((-0.309016994375, -0.5, 0)),
655 vertex((0.309016994375, -0.5, 0)),
656 vertex((0.309016994375, 0.5, 0)),
657 vertex((-0.309016994375, 0.5, 0)),
658 vertex((-0.5, 0, -0.309016994375)),
659 vertex((0.5, 0, -0.309016994375)),
660 vertex((0, 0.309016994375, -0.5)),
661 vertex((0, -0.309016994375, -0.5))]
663 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
664 edge(self
.vertskeleton
[0], self
.vertskeleton
[7]),
665 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
666 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
667 edge(self
.vertskeleton
[1], self
.vertskeleton
[4]),
668 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
669 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
670 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
671 edge(self
.vertskeleton
[0], self
.vertskeleton
[6]),
672 edge(self
.vertskeleton
[2], self
.vertskeleton
[7]),
673 edge(self
.vertskeleton
[2], self
.vertskeleton
[8]),
674 edge(self
.vertskeleton
[2], self
.vertskeleton
[4]),
675 edge(self
.vertskeleton
[4], self
.vertskeleton
[5]),
676 edge(self
.vertskeleton
[3], self
.vertskeleton
[5]),
677 edge(self
.vertskeleton
[3], self
.vertskeleton
[9]),
678 edge(self
.vertskeleton
[3], self
.vertskeleton
[6]),
679 edge(self
.vertskeleton
[6], self
.vertskeleton
[7]),
680 edge(self
.vertskeleton
[7], self
.vertskeleton
[10]),
681 edge(self
.vertskeleton
[7], self
.vertskeleton
[8]),
682 edge(self
.vertskeleton
[4], self
.vertskeleton
[8]),
683 edge(self
.vertskeleton
[4], self
.vertskeleton
[11]),
684 edge(self
.vertskeleton
[5], self
.vertskeleton
[11]),
685 edge(self
.vertskeleton
[5], self
.vertskeleton
[9]),
686 edge(self
.vertskeleton
[6], self
.vertskeleton
[9]),
687 edge(self
.vertskeleton
[6], self
.vertskeleton
[10]),
688 edge(self
.vertskeleton
[8], self
.vertskeleton
[10]),
689 edge(self
.vertskeleton
[8], self
.vertskeleton
[11]),
690 edge(self
.vertskeleton
[9], self
.vertskeleton
[11]),
691 edge(self
.vertskeleton
[9], self
.vertskeleton
[10]),
692 edge(self
.vertskeleton
[10], self
.vertskeleton
[11])]
694 self
.panelpoints
= [[0, 1, 2], [0, 1, 3], [0, 2, 7], [1, 2, 4], [1, 4, 5],
695 [1, 3, 5], [0, 3, 6], [0, 6, 7], [2, 7, 8], [2, 4, 8],
696 [3, 5, 9], [3, 6, 9], [7, 8, 10], [4, 8, 11], [4, 5, 11],
697 [5, 9, 11], [6, 9, 10], [6, 7, 10], [8, 10, 11], [9, 10, 11]]
699 self
.paneledges
= [[0, 2, 3], [0, 7, 6], [2, 1, 9], [3, 4, 11], [4, 5, 12], [6, 5, 13],
700 [7, 8, 15], [8, 1, 16], [9, 10, 18], [11, 10, 19], [13, 14, 22],
701 [15, 14, 23], [18, 17, 25], [19, 20, 26], [12, 20, 21], [22, 21, 27],
702 [23, 24, 28], [16, 24, 17], [25, 26, 29], [28, 27, 29]]
704 self
.reversepanel
= [0, 2, 5, 9, 11, 12, 14, 15, 17, 19]
706 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
709 class icoface(geodesic
):
710 def __init__(self
, parameter
):
711 geodesic
.__init
__(mesh
)
712 geodesic
.setparameters(self
, parameter
)
713 self
.set_vert_edge_skeleons()
715 def set_vert_edge_skeleons(self
):
716 self
.vertskeleton
= [vertex((-0.17841104489, 0.309016994375, 0.46708617948)),
717 vertex((-0.17841104489, -0.309016994375, 0.46708617948)),
718 vertex((0.35682208977, 0.0, 0.467086179484)),
719 vertex((-0.57735026919, 0.0, 0.110264089705)),
720 vertex((-0.288675134594, -0.5, -0.11026408971)),
721 vertex((0.288675134594, -0.5, 0.11026408971)),
722 vertex((0.57735026919, 0.0, -0.110264089705)),
723 vertex((0.288675134594, 0.5, 0.11026408971)),
724 vertex((-0.288675134594, 0.5, -0.11026408971)),
725 vertex((-0.35682208977, 0.0, -0.467086179484)),
726 vertex((0.17841104489, -0.309016994375, -0.46708617948)),
727 vertex((0.17841104489, 0.309016994375, -0.46708617948))]
729 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
730 edge(self
.vertskeleton
[2], self
.vertskeleton
[1]),
731 edge(self
.vertskeleton
[2], self
.vertskeleton
[0]),
732 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
733 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
734 edge(self
.vertskeleton
[1], self
.vertskeleton
[4]),
735 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
736 edge(self
.vertskeleton
[2], self
.vertskeleton
[5]),
737 edge(self
.vertskeleton
[2], self
.vertskeleton
[6]),
738 edge(self
.vertskeleton
[2], self
.vertskeleton
[7]),
739 edge(self
.vertskeleton
[0], self
.vertskeleton
[7]),
740 edge(self
.vertskeleton
[0], self
.vertskeleton
[8]),
741 edge(self
.vertskeleton
[3], self
.vertskeleton
[9]),
742 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
743 edge(self
.vertskeleton
[5], self
.vertskeleton
[4]),
744 edge(self
.vertskeleton
[5], self
.vertskeleton
[10]),
745 edge(self
.vertskeleton
[5], self
.vertskeleton
[6]),
746 edge(self
.vertskeleton
[7], self
.vertskeleton
[6]),
747 edge(self
.vertskeleton
[7], self
.vertskeleton
[11]),
748 edge(self
.vertskeleton
[7], self
.vertskeleton
[8]),
749 edge(self
.vertskeleton
[3], self
.vertskeleton
[8]),
750 edge(self
.vertskeleton
[4], self
.vertskeleton
[9]),
751 edge(self
.vertskeleton
[4], self
.vertskeleton
[10]),
752 edge(self
.vertskeleton
[6], self
.vertskeleton
[10]),
753 edge(self
.vertskeleton
[6], self
.vertskeleton
[11]),
754 edge(self
.vertskeleton
[8], self
.vertskeleton
[11]),
755 edge(self
.vertskeleton
[8], self
.vertskeleton
[9]),
756 edge(self
.vertskeleton
[9], self
.vertskeleton
[10]),
757 edge(self
.vertskeleton
[11], self
.vertskeleton
[10]),
758 edge(self
.vertskeleton
[11], self
.vertskeleton
[9])]
760 self
.panelpoints
= [[2, 0, 1], [0, 1, 3], [2, 1, 5], [2, 0, 7], [1, 3, 4], [1, 5, 4],
761 [2, 5, 6], [2, 7, 6], [0, 7, 8], [0, 3, 8], [3, 4, 9], [5, 4, 10],
762 [5, 6, 10], [7, 6, 11], [7, 8, 11], [3, 8, 9], [4, 9, 10],
763 [6, 11, 10], [8, 11, 9], [11, 9, 10]]
765 self
.paneledges
= [[2, 1, 0], [0, 3, 4], [1, 7, 6], [2, 9, 10], [4, 5, 13], [6, 5, 14],
766 [7, 8, 16], [9, 8, 17], [10, 11, 19], [3, 11, 20], [13, 12, 21],
767 [14, 15, 22], [16, 15, 23], [17, 18, 24], [19, 18, 25], [20, 12, 26],
768 [21, 22, 27], [24, 23, 28], [25, 26, 29], [29, 28, 27]]
770 self
.reversepanel
= [1, 3, 5, 7, 9, 10, 12, 14, 17, 19]
772 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
775 # PKHG TODO this does not work yet ...
776 def creategeo(geo
, polytype
, orientation
, parameters
):
778 if polytype
== 'Tetrahedron':
779 if orientation
== 'PointUp':
780 my_tetrahedron
= tetrahedron(geodesic
)
781 my_tetrahedron
.set_vert_edge_skeleons()
782 my_tetrahedron
.config()
783 check_contains(my_tetrahedron
, "my_tetra", True)
785 elif orientation
== 'EdgeUp':
786 geo
= tetraedge(parameters
)
787 else: # orientation == 2:
788 geo
= tetraface(parameters
)
789 elif polytype
== 'Octahedron':
790 if orientation
== 'PointUp':
791 geo
= octahedron(parameters
)
792 elif orientation
== 'EdgeUp':
793 geo
= octaedge(parameters
)
794 else: # if orientation == 2:
795 geo
= octaface(parameters
)
796 elif polytype
== 'Icosahedron':
797 if orientation
== 'PointUp':
798 geo
= icosahedron(parameters
)
799 elif orientation
== 'EdgeUp':
800 geo
= icoedge(parameters
)
801 else: # if orientation == 2:
802 geo
= icoface(parameters
)