1 # SPDX-FileCopyrightText: 2016-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 from .vefm_271
import mesh
, vertex
, edge
, face
6 from math
import pi
, acos
, sin
, cos
, atan
, tan
, fabs
, sqrt
9 def check_contains(cl
, name
, print_value
=False):
12 if el
.startswith("_"):
17 print(name
, " contains ==>", el
, " value = ", tmp
)
19 print(name
, " contains ==>", el
)
20 print("\ncheck_contains finished\n\n")
27 self
.PKHG_parameters
= None
31 self
.skeleton
= [] # List of verts in the full skeleton edges.
32 self
.vertskeleton
= [] # config needs this member
33 self
.edgeskeleton
= [] # config needs this member
34 self
.sphericalverts
= []
43 self
.eccentricity
= None
60 self
.panelpoints
= None
61 self
.paneledges
= None
62 self
.reversepanel
= None
63 self
.edgelength
= None
67 def setparameters(self
, params
):
68 parameters
= self
.PKHG_parameters
= params
69 self
.frequency
= parameters
[0] # How many subdivisions - up to 20.
70 self
.eccentricity
= parameters
[1] # Elliptical if >1.0.
71 self
.squish
= parameters
[2] # Flattened if < 1.0.
72 self
.radius
= parameters
[3] # Exactly what it says.
73 self
.square
= parameters
[4] # Controls amount of superellipse in X/Y plane.
74 self
.squarez
= parameters
[5] # Controls amount of superellipse in Z dimension.
75 self
.cart
= parameters
[6] # Cuts out sphericalisation step.
76 self
.shape
= parameters
[7] # Full sphere, dome, flatbase.
77 self
.baselevel
= parameters
[8] # Where the base is cut on a flatbase dome.
78 self
.faceshape
= parameters
[9] # Triangular, hexagonal, tri-hex.
79 self
.dualflag
= parameters
[10]
80 self
.rotxy
= parameters
[11]
81 self
.rotz
= parameters
[12]
82 self
.klass
= parameters
[13]
83 self
.sform
= parameters
[14]
84 self
.super = 0 # Toggles superellipse.
85 if self
.square
!= 2.0 or self
.squarez
!= 2.0:
87 self
.odd
= 0 # Is the frequency odd. It matters for dome building.
88 if self
.frequency
% 2 != 0:
91 def makegeodesic(self
):
92 self
.vertedgefacedata() # PKHG only a pass 13okt11
93 self
.config() # Generate all the configuration information.
96 if self
.faceshape
== 1:
97 self
.hexify() # Hexagonal faces
98 elif self
.faceshape
== 2:
99 self
.starify() # Hex and Triangle faces
103 self
.sphericalize() # Convert x,y,z positions into spherical u,v.
104 self
.sphere2cartesian() # Convert spherical uv back into cartesian x,y,z for final shape.
105 for i
in range(len(self
.verts
)):
106 self
.verts
[i
].index
= i
107 for edg
in self
.edges
:
110 def vertedgefacedata(self
):
114 for i
in range(len(self
.vertskeleton
)):
115 self
.vertskeleton
[i
].index
= i
116 for edges
in self
.edgeskeleton
:
117 s
= skeletonrow(self
.frequency
, edges
, 0, self
) # self a geodesic
118 self
.skeleton
.append(s
)
119 for i
in range(len(self
.verts
)):
120 self
.verts
[i
].index
= i
121 for i
in range(len(self
.panelpoints
)):
122 a
= self
.vertsdone
[self
.panelpoints
[i
][0]][1]
123 b
= self
.vertsdone
[self
.panelpoints
[i
][1]][1]
124 c
= self
.vertsdone
[self
.panelpoints
[i
][2]][1]
125 panpoints
= [self
.verts
[a
],
128 panedges
= [self
.skeleton
[self
.paneledges
[i
][0]],
129 self
.skeleton
[self
.paneledges
[i
][1]],
130 self
.skeleton
[self
.paneledges
[i
][2]]]
132 for flag
in self
.reversepanel
:
135 p
= panel(panpoints
, panedges
, reverseflag
, self
)
137 def sphericalize(self
):
140 for vert
in(self
.verts
):
146 u
= self
.usphericalise(x
, y
, z
)
147 v
= self
.vsphericalise(x
, y
, z
)
148 self
.sphericalverts
.append([u
, v
])
150 def sphere2cartesian(self
):
151 for i
in range(len(self
.verts
)):
154 x
= self
.verts
[i
].vector
.x
* self
.radius
* self
.eccentricity
155 y
= self
.verts
[i
].vector
.y
* self
.radius
156 z
= self
.verts
[i
].vector
.z
* self
.radius
* self
.squish
158 u
= self
.sphericalverts
[i
][0]
159 v
= self
.sphericalverts
[i
][1]
160 if self
.squish
!= 1.0 or self
.eccentricity
> 1.0:
161 scalez
= 1 / self
.squish
162 v
= self
.ellipsecomp(scalez
, v
)
163 u
= self
.ellipsecomp(self
.eccentricity
, u
)
165 r1
= self
.superell(self
.square
, u
, self
.rotxy
)
166 r2
= self
.superell(self
.squarez
, v
, self
.rotz
)
172 r1
= r1
* self
.superform(self
.sform
[0], self
.sform
[1],
173 self
.sform
[2], self
.sform
[3],
174 self
.sform
[14] + u
, self
.sform
[4],
175 self
.sform
[5], self
.sform
[16] * v
)
177 r2
= r2
* self
.superform(self
.sform
[6], self
.sform
[7],
178 self
.sform
[8], self
.sform
[9],
179 self
.sform
[15] + v
, self
.sform
[10],
180 self
.sform
[11], self
.sform
[17] * v
)
181 x
, y
, z
= self
.cartesian(u
, v
, r1
, r2
)
183 self
.verts
[i
] = vertex((x
, y
, z
))
185 def usphericalise(self
, x
, y
, z
):
199 if x
< 0.0 and y
< 0.0:
200 theta
= theta
+ self
.a180
201 elif x
< 0.0 and y
> 0.0:
202 theta
= theta
+ self
.a180
206 def vsphericalise(self
, x
, y
, z
):
210 rho
= sqrt(x
** 2 + y
** 2 + z
** 2)
215 def ellipsecomp(self
, efactor
, theta
):
216 if theta
== self
.a90
:
218 elif theta
== self
.a270
:
221 result
= atan(tan(theta
) / efactor
**0.5)
224 y
= self
.a180
+ result
225 if fabs(x
- theta
) <= fabs(y
- theta
):
230 x
= self
.a180
+ result
233 if fabs(x
- theta
) <= fabs(y
- theta
):
239 def cutbasecomp(self
):
242 def cartesian(self
, u
, v
, r1
, r2
):
243 x
= r1
* cos(u
) * r2
* sin(v
) * self
.radius
* self
.eccentricity
244 y
= r1
* sin(u
) * r2
* sin(v
) * self
.radius
245 z
= r2
* cos(v
) * self
.radius
* self
.squish
250 def __init__(self
, count
, anchor
, leftindex
, rightindex
, stepvector
, endflag
, parentgeo
):
253 # Make a row of evenly spaced points.
254 for i
in range(count
+ 1):
256 self
.points
.append(leftindex
)
257 elif i
== count
and not endflag
:
258 self
.points
.append(rightindex
)
259 else: # PKHG Vectors added!
260 newpoint
= anchor
+ (stepvector
* i
)
261 vertcount
= len(parentgeo
.verts
)
262 self
.points
.append(vertcount
)
263 newpoint
.index
= vertcount
264 parentgeo
.verts
.append(newpoint
)
265 for i
in range(count
):
266 a
= parentgeo
.verts
[self
.points
[i
]]
267 b
= parentgeo
.verts
[self
.points
[i
+ 1]]
269 self
.edges
.append(len(parentgeo
.edges
))
270 parentgeo
.edges
.append(line
)
274 def __init__(self
, count
, skeletonedge
, shortflag
, parentgeo
):
277 self
.vect
= skeletonedge
.vect
278 self
.step
= skeletonedge
.vect
/ float(count
)
279 # Make a row of evenly spaced points.
280 for i
in range(count
+ 1):
281 vert1
= skeletonedge
.a
282 vert2
= skeletonedge
.b
284 if parentgeo
.vertsdone
[vert1
.index
][0]:
285 self
.points
.append(parentgeo
.vertsdone
[vert1
.index
][1])
287 newpoint
= vertex(vert1
.vector
)
288 vertcount
= len(parentgeo
.verts
)
289 self
.points
.append(vertcount
)
290 newpoint
.index
= vertcount
291 parentgeo
.vertsdone
[vert1
.index
] = [1, vertcount
]
292 parentgeo
.verts
.append(newpoint
)
295 if parentgeo
.vertsdone
[vert2
.index
][0]:
296 self
.points
.append(parentgeo
.vertsdone
[vert2
.index
][1])
298 newpoint
= vertex(vert2
.vector
)
299 vertcount
= len(parentgeo
.verts
)
300 self
.points
.append(vertcount
)
301 newpoint
.index
= vertcount
302 parentgeo
.vertsdone
[vert2
.index
] = [1, vertcount
]
303 parentgeo
.verts
.append(newpoint
)
305 newpoint
= vertex(vert1
.vector
+ (self
.step
* i
)) # must be a vertex!
306 vertcount
= len(parentgeo
.verts
)
307 self
.points
.append(vertcount
)
308 newpoint
.index
= vertcount
309 parentgeo
.verts
.append(newpoint
)
310 for i
in range(count
):
311 a
= parentgeo
.verts
[self
.points
[i
]]
312 b
= parentgeo
.verts
[self
.points
[i
+ 1]]
314 self
.edges
.append(len(parentgeo
.edges
))
315 parentgeo
.edges
.append(line
)
319 def __init__(self
, upper
, lower
, reverseflag
, parentgeo
, finish
):
320 for i
in range(finish
):
321 a
, b
, c
= upper
.points
[i
], lower
.points
[i
+ 1], lower
.points
[i
]
323 upface
= face([parentgeo
.verts
[a
], parentgeo
.verts
[c
], parentgeo
.verts
[b
]])
325 upface
= face([parentgeo
.verts
[a
], parentgeo
.verts
[b
], parentgeo
.verts
[c
]])
326 parentgeo
.faces
.append(upface
)
330 d
= upper
.points
[i
+ 1]
332 downface
= face([parentgeo
.verts
[b
], parentgeo
.verts
[d
], parentgeo
.verts
[a
]])
334 downface
= face([parentgeo
.verts
[b
], parentgeo
.verts
[a
], parentgeo
.verts
[d
]])
335 line
= edge(parentgeo
.verts
[a
], parentgeo
.verts
[b
])
336 line2
= edge(parentgeo
.verts
[d
], parentgeo
.verts
[b
])
337 parentgeo
.faces
.append(downface
)
338 parentgeo
.edges
.append(line
)
339 parentgeo
.edges
.append(line2
)
343 def __init__(self
, points
, edges
, reverseflag
, parentgeo
):
344 self
.cardinal
= points
[0]
345 self
.leftv
= points
[1]
346 self
.rightv
= points
[2]
347 self
.leftedge
= edges
[0]
348 self
.rightedge
= edges
[1]
349 self
.baseedge
= edges
[2]
351 self
.orient(parentgeo
, edges
)
352 self
.createrows(parentgeo
)
353 self
.createfaces(parentgeo
, reverseflag
)
355 def orient(self
, parentgeo
, edges
):
356 if self
.leftedge
.points
[0] != self
.cardinal
.index
:
357 self
.leftedge
.points
.reverse()
358 self
.leftedge
.vect
.negative()
360 if self
.rightedge
.points
[0] != self
.cardinal
.index
:
361 self
.rightedge
.points
.reverse()
362 self
.rightedge
.vect
.negative()
364 if self
.baseedge
.points
[0] != self
.leftv
.index
:
366 self
.baseedge
.points
.reverse()
367 self
.baseedge
.vect
.negative()
369 def createrows(self
, parentgeo
):
370 for i
in range(len(self
.leftedge
.points
)):
371 if i
== parentgeo
.frequency
:
372 newrow
= self
.baseedge
374 newrow
= edgerow(i
, parentgeo
.verts
[self
.leftedge
.points
[i
]], self
.leftedge
.points
[i
],
375 self
.rightedge
.points
[i
], self
.baseedge
.step
, 0, parentgeo
)
376 self
.rows
.append(newrow
)
378 def createfaces(self
, parentgeo
, reverseflag
):
379 for i
in range(len(self
.leftedge
.points
) - 1):
380 facefill(self
.rows
[i
], self
.rows
[i
+ 1], reverseflag
, parentgeo
, len(self
.rows
[i
].points
))
383 # for point on top? YES!
384 class tetrahedron(geodesic
, mesh
):
385 def __init__(self
, parameter
):
386 geodesic
.__init
__(mesh
)
387 geodesic
.setparameters(self
, parameter
)
388 self
.set_vert_edge_skeleons()
390 def set_vert_edge_skeleons(self
):
391 self
.vertskeleton
= [vertex((0.0, 0.0, 1.73205080757)),
392 vertex((0.0, -1.63299316185, -0.577350269185)),
393 vertex((1.41421356237, 0.816496580927, -0.57735026919)),
394 vertex((-1.41421356237, 0.816496580927, -0.57735026919))]
396 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
397 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
398 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
399 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
400 edge(self
.vertskeleton
[2], self
.vertskeleton
[3]),
401 edge(self
.vertskeleton
[1], self
.vertskeleton
[3])]
403 self
.panelpoints
= [[0, 1, 2], [0, 2, 3], [0, 1, 3], [1, 2, 3]]
404 self
.paneledges
= [[0, 1, 3], [1, 2, 4], [0, 2, 5], [3, 5, 4]]
405 self
.reversepanel
= [2, 3]
407 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
410 # for edge on top? YES
411 class tetraedge(geodesic
):
412 def __init__(self
, parameter
):
413 geodesic
.__init
__(mesh
)
414 geodesic
.setparameters(self
, parameter
)
415 self
.set_vert_edge_skeleons()
417 def set_vert_edge_skeleons(self
):
418 self
.vertskeleton
= [vertex((0.0, -1.41421356237, 1.0)),
419 vertex((0.0, 1.41421356237, 1.0)),
420 vertex((1.41421356237, 0.0, -1.0)),
421 vertex((-1.41421356237, 0.0, -1.0))]
423 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
424 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
425 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
426 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
427 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
428 edge(self
.vertskeleton
[2], self
.vertskeleton
[3])]
430 for i
in range(len(self
.vertskeleton
)):
431 self
.vertskeleton
[i
].index
= i
433 self
.panelpoints
= [[0, 1, 2], [1, 2, 3], [0, 1, 3], [0, 2, 3]]
434 self
.paneledges
= [[0, 1, 4], [4, 3, 5], [0, 2, 3], [1, 2, 5]]
435 self
.reversepanel
= [0, 3]
437 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
440 # for face on top? YES
441 class tetraface(geodesic
):
442 def __init__(self
, parameter
):
443 geodesic
.__init
__(mesh
)
444 geodesic
.setparameters(self
, parameter
)
445 self
.set_vert_edge_skeleons()
447 def set_vert_edge_skeleons(self
):
448 self
.vertskeleton
= [vertex((-1.41421356237, -0.816496580927, 0.57735026919)),
449 vertex((1.41421356237, -0.816496580927, 0.57735026919)),
450 vertex((0.0, 1.63299316185, 0.577350269185)),
451 vertex((0.0, 0.0, -1.73205080757))]
453 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
454 edge(self
.vertskeleton
[2], self
.vertskeleton
[1]),
455 edge(self
.vertskeleton
[2], self
.vertskeleton
[0]),
456 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
457 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
458 edge(self
.vertskeleton
[2], self
.vertskeleton
[3])
460 self
.panelpoints
= [[2, 0, 1], [0, 1, 3], [2, 1, 3], [2, 0, 3]]
462 self
.paneledges
= [[2, 1, 0], [0, 3, 4], [1, 5, 4], [2, 5, 3]]
463 self
.reversepanel
= [1, 3]
465 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
468 class octahedron(geodesic
):
469 def __init__(self
, parameter
):
470 geodesic
.__init
__(mesh
)
471 geodesic
.setparameters(self
, parameter
)
472 self
.set_vert_edge_skeleons()
474 def set_vert_edge_skeleons(self
):
475 self
.vertskeleton
= [vertex((0.0, 0.0, 1.0)),
476 vertex((0.0, 1.0, 0.0)),
477 vertex((-1.0, 0.0, 0.0)),
478 vertex((0.0, -1.0, 0.0)),
479 vertex((1.0, 0.0, 0.0)),
480 vertex((0.0, 0.0, -1.0))]
482 for i
in range(len(self
.vertskeleton
)):
483 self
.vertskeleton
[i
].index
= i
484 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
485 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
486 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
487 edge(self
.vertskeleton
[0], self
.vertskeleton
[4]),
488 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
489 edge(self
.vertskeleton
[2], self
.vertskeleton
[3]),
490 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
491 edge(self
.vertskeleton
[4], self
.vertskeleton
[1]),
492 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
493 edge(self
.vertskeleton
[2], self
.vertskeleton
[5]),
494 edge(self
.vertskeleton
[3], self
.vertskeleton
[5]),
495 edge(self
.vertskeleton
[4], self
.vertskeleton
[5])]
497 self
.panelpoints
= [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [1, 2, 5],
498 [2, 3, 5], [3, 4, 5], [4, 1, 5]]
499 self
.paneledges
= [[0, 1, 4], [1, 2, 5], [2, 3, 6], [3, 0, 7], [4, 8, 9],
500 [5, 9, 10], [6, 10, 11], [7, 11, 8]]
501 self
.reversepanel
= [4, 5, 6, 7]
503 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
506 class octaedge(geodesic
):
507 def __init__(self
, parameter
):
508 geodesic
.__init
__(mesh
)
509 geodesic
.setparameters(self
, parameter
)
510 self
.set_vert_edge_skeleons()
512 def set_vert_edge_skeleons(self
):
513 self
.vertskeleton
= [vertex((0.0, -0.707106781187, 0.707106781187)),
514 vertex((0.0, 0.707106781187, 0.707106781187)),
515 vertex((1.0, 0.0, 0.0)),
516 vertex((-1.0, 0.0, 0.0)),
517 vertex((0.0, -0.707106781187, -0.707106781187)),
518 vertex((0.0, 0.707106781187, -0.707106781187))]
520 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
521 edge(self
.vertskeleton
[0], self
.vertskeleton
[4]),
522 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
523 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
524 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
525 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
526 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
527 edge(self
.vertskeleton
[2], self
.vertskeleton
[4]),
528 edge(self
.vertskeleton
[2], self
.vertskeleton
[5]),
529 edge(self
.vertskeleton
[3], self
.vertskeleton
[5]),
530 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
531 edge(self
.vertskeleton
[4], self
.vertskeleton
[5])]
533 self
.panelpoints
= [[0, 1, 2], [0, 1, 3], [0, 2, 4], [1, 2, 5], [1, 3, 5],
534 [0, 3, 4], [2, 4, 5], [3, 4, 5]]
535 self
.paneledges
= [[0, 2, 3], [0, 6, 5], [2, 1, 7], [3, 4, 8], [5, 4, 9],
536 [6, 1, 10], [7, 8, 11], [10, 9, 11]]
538 self
.reversepanel
= [0, 2, 4, 7]
540 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
543 class octaface(geodesic
):
544 def __init__(self
, parameter
):
545 geodesic
.__init
__(mesh
)
546 geodesic
.setparameters(self
, parameter
)
547 self
.set_vert_edge_skeleons()
549 def set_vert_edge_skeleons(self
):
550 self
.vertskeleton
= [vertex((0.408248458663, -0.707106781187, 0.577350150255)),
551 vertex((0.408248458663, 0.707106781187, 0.577350150255)),
552 vertex((-0.816496412728, 0.0, 0.577350507059)),
553 vertex((-0.408248458663, -0.707106781187, -0.577350150255)),
554 vertex((0.816496412728, 0.0, -0.577350507059)),
555 vertex((-0.408248458663, 0.707106781187, -0.577350150255))]
557 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
558 edge(self
.vertskeleton
[2], self
.vertskeleton
[1]),
559 edge(self
.vertskeleton
[2], self
.vertskeleton
[0]),
560 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
561 edge(self
.vertskeleton
[0], self
.vertskeleton
[4]),
562 edge(self
.vertskeleton
[1], self
.vertskeleton
[4]),
563 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
564 edge(self
.vertskeleton
[2], self
.vertskeleton
[5]),
565 edge(self
.vertskeleton
[2], self
.vertskeleton
[3]),
566 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
567 edge(self
.vertskeleton
[4], self
.vertskeleton
[5]),
568 edge(self
.vertskeleton
[3], self
.vertskeleton
[5])]
570 self
.panelpoints
= [[2, 0, 1], [0, 3, 4], [0, 1, 4], [1, 4, 5],
571 [2, 1, 5], [2, 3, 5], [2, 0, 3], [3, 4, 5]]
573 self
.paneledges
= [[2, 1, 0], [3, 4, 9], [0, 4, 5], [5, 6, 10],
574 [1, 7, 6], [8, 7, 11], [2, 8, 3], [9, 11, 10]]
576 self
.reversepanel
= [2, 5, 6, 7]
578 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
581 class icosahedron(geodesic
):
582 def __init__(self
, parameter
):
583 geodesic
.__init
__(mesh
)
584 geodesic
.setparameters(self
, parameter
)
585 self
.set_vert_edge_skeleons()
587 def set_vert_edge_skeleons(self
):
588 self
.vertskeleton
= [vertex((0.0, 0.0, 0.587785252292)),
589 vertex((0.0, -0.525731096637, 0.262865587024)),
590 vertex((0.5, -0.162459832634, 0.262865565628)),
591 vertex((0.309016994375, 0.425325419658, 0.262865531009)),
592 vertex((-0.309016994375, 0.425325419658, 0.262865531009)),
593 vertex((-0.5, -0.162459832634, 0.262865565628)),
594 vertex((0.309016994375, -0.425325419658, -0.262865531009)),
595 vertex((0.5, 0.162459832634, -0.262865565628)),
596 vertex((0.0, 0.525731096637, -0.262865587024)),
597 vertex((-0.5, 0.162459832634, -0.262865565628)),
598 vertex((-0.309016994375, -0.425325419658, -0.262865531009)),
599 vertex((0.0, 0.0, -0.587785252292))]
601 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
602 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
603 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
604 edge(self
.vertskeleton
[0], self
.vertskeleton
[4]),
605 edge(self
.vertskeleton
[0], self
.vertskeleton
[5]),
606 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
607 edge(self
.vertskeleton
[2], self
.vertskeleton
[3]),
608 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
609 edge(self
.vertskeleton
[4], self
.vertskeleton
[5]),
610 edge(self
.vertskeleton
[5], self
.vertskeleton
[1]),
611 edge(self
.vertskeleton
[1], self
.vertskeleton
[6]),
612 edge(self
.vertskeleton
[2], self
.vertskeleton
[6]),
613 edge(self
.vertskeleton
[2], self
.vertskeleton
[7]),
614 edge(self
.vertskeleton
[3], self
.vertskeleton
[7]),
615 edge(self
.vertskeleton
[3], self
.vertskeleton
[8]),
616 edge(self
.vertskeleton
[4], self
.vertskeleton
[8]),
617 edge(self
.vertskeleton
[4], self
.vertskeleton
[9]),
618 edge(self
.vertskeleton
[5], self
.vertskeleton
[9]),
619 edge(self
.vertskeleton
[5], self
.vertskeleton
[10]),
620 edge(self
.vertskeleton
[1], self
.vertskeleton
[10]),
621 edge(self
.vertskeleton
[6], self
.vertskeleton
[7]),
622 edge(self
.vertskeleton
[7], self
.vertskeleton
[8]),
623 edge(self
.vertskeleton
[8], self
.vertskeleton
[9]),
624 edge(self
.vertskeleton
[9], self
.vertskeleton
[10]),
625 edge(self
.vertskeleton
[10], self
.vertskeleton
[6]),
626 edge(self
.vertskeleton
[6], self
.vertskeleton
[11]),
627 edge(self
.vertskeleton
[7], self
.vertskeleton
[11]),
628 edge(self
.vertskeleton
[8], self
.vertskeleton
[11]),
629 edge(self
.vertskeleton
[9], self
.vertskeleton
[11]),
630 edge(self
.vertskeleton
[10], self
.vertskeleton
[11])]
632 self
.panelpoints
= [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1], [1, 2, 6],
633 [2, 6, 7], [2, 3, 7], [3, 7, 8], [3, 4, 8], [4, 8, 9], [4, 5, 9],
634 [5, 9, 10], [5, 1, 10], [1, 10, 6], [6, 7, 11], [7, 8, 11],
635 [8, 9, 11], [9, 10, 11], [10, 6, 11]]
637 self
.paneledges
= [[0, 1, 5], [1, 2, 6], [2, 3, 7], [3, 4, 8], [4, 0, 9], [5, 10, 11],
638 [11, 12, 20], [6, 12, 13], [13, 14, 21], [7, 14, 15], [15, 16, 22],
639 [8, 16, 17], [17, 18, 23], [9, 18, 19], [19, 10, 24], [20, 25, 26],
640 [21, 26, 27], [22, 27, 28], [23, 28, 29], [24, 29, 25]]
642 self
.reversepanel
= [5, 7, 9, 11, 13, 15, 16, 17, 18, 19]
644 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
647 class icoedge(geodesic
):
648 def __init__(self
, parameter
):
649 geodesic
.__init
__(mesh
)
650 geodesic
.setparameters(self
, parameter
)
651 self
.set_vert_edge_skeleons()
653 def set_vert_edge_skeleons(self
):
654 self
.vertskeleton
= [vertex((0, 0.309016994375, 0.5)),
655 vertex((0, -0.309016994375, 0.5)),
656 vertex((-0.5, 0, 0.309016994375)),
657 vertex((0.5, 0, 0.309016994375)),
658 vertex((-0.309016994375, -0.5, 0)),
659 vertex((0.309016994375, -0.5, 0)),
660 vertex((0.309016994375, 0.5, 0)),
661 vertex((-0.309016994375, 0.5, 0)),
662 vertex((-0.5, 0, -0.309016994375)),
663 vertex((0.5, 0, -0.309016994375)),
664 vertex((0, 0.309016994375, -0.5)),
665 vertex((0, -0.309016994375, -0.5))]
667 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
668 edge(self
.vertskeleton
[0], self
.vertskeleton
[7]),
669 edge(self
.vertskeleton
[0], self
.vertskeleton
[2]),
670 edge(self
.vertskeleton
[1], self
.vertskeleton
[2]),
671 edge(self
.vertskeleton
[1], self
.vertskeleton
[4]),
672 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
673 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
674 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
675 edge(self
.vertskeleton
[0], self
.vertskeleton
[6]),
676 edge(self
.vertskeleton
[2], self
.vertskeleton
[7]),
677 edge(self
.vertskeleton
[2], self
.vertskeleton
[8]),
678 edge(self
.vertskeleton
[2], self
.vertskeleton
[4]),
679 edge(self
.vertskeleton
[4], self
.vertskeleton
[5]),
680 edge(self
.vertskeleton
[3], self
.vertskeleton
[5]),
681 edge(self
.vertskeleton
[3], self
.vertskeleton
[9]),
682 edge(self
.vertskeleton
[3], self
.vertskeleton
[6]),
683 edge(self
.vertskeleton
[6], self
.vertskeleton
[7]),
684 edge(self
.vertskeleton
[7], self
.vertskeleton
[10]),
685 edge(self
.vertskeleton
[7], self
.vertskeleton
[8]),
686 edge(self
.vertskeleton
[4], self
.vertskeleton
[8]),
687 edge(self
.vertskeleton
[4], self
.vertskeleton
[11]),
688 edge(self
.vertskeleton
[5], self
.vertskeleton
[11]),
689 edge(self
.vertskeleton
[5], self
.vertskeleton
[9]),
690 edge(self
.vertskeleton
[6], self
.vertskeleton
[9]),
691 edge(self
.vertskeleton
[6], self
.vertskeleton
[10]),
692 edge(self
.vertskeleton
[8], self
.vertskeleton
[10]),
693 edge(self
.vertskeleton
[8], self
.vertskeleton
[11]),
694 edge(self
.vertskeleton
[9], self
.vertskeleton
[11]),
695 edge(self
.vertskeleton
[9], self
.vertskeleton
[10]),
696 edge(self
.vertskeleton
[10], self
.vertskeleton
[11])]
698 self
.panelpoints
= [[0, 1, 2], [0, 1, 3], [0, 2, 7], [1, 2, 4], [1, 4, 5],
699 [1, 3, 5], [0, 3, 6], [0, 6, 7], [2, 7, 8], [2, 4, 8],
700 [3, 5, 9], [3, 6, 9], [7, 8, 10], [4, 8, 11], [4, 5, 11],
701 [5, 9, 11], [6, 9, 10], [6, 7, 10], [8, 10, 11], [9, 10, 11]]
703 self
.paneledges
= [[0, 2, 3], [0, 7, 6], [2, 1, 9], [3, 4, 11], [4, 5, 12], [6, 5, 13],
704 [7, 8, 15], [8, 1, 16], [9, 10, 18], [11, 10, 19], [13, 14, 22],
705 [15, 14, 23], [18, 17, 25], [19, 20, 26], [12, 20, 21], [22, 21, 27],
706 [23, 24, 28], [16, 24, 17], [25, 26, 29], [28, 27, 29]]
708 self
.reversepanel
= [0, 2, 5, 9, 11, 12, 14, 15, 17, 19]
710 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
713 class icoface(geodesic
):
714 def __init__(self
, parameter
):
715 geodesic
.__init
__(mesh
)
716 geodesic
.setparameters(self
, parameter
)
717 self
.set_vert_edge_skeleons()
719 def set_vert_edge_skeleons(self
):
720 self
.vertskeleton
= [vertex((-0.17841104489, 0.309016994375, 0.46708617948)),
721 vertex((-0.17841104489, -0.309016994375, 0.46708617948)),
722 vertex((0.35682208977, 0.0, 0.467086179484)),
723 vertex((-0.57735026919, 0.0, 0.110264089705)),
724 vertex((-0.288675134594, -0.5, -0.11026408971)),
725 vertex((0.288675134594, -0.5, 0.11026408971)),
726 vertex((0.57735026919, 0.0, -0.110264089705)),
727 vertex((0.288675134594, 0.5, 0.11026408971)),
728 vertex((-0.288675134594, 0.5, -0.11026408971)),
729 vertex((-0.35682208977, 0.0, -0.467086179484)),
730 vertex((0.17841104489, -0.309016994375, -0.46708617948)),
731 vertex((0.17841104489, 0.309016994375, -0.46708617948))]
733 self
.edgeskeleton
= [edge(self
.vertskeleton
[0], self
.vertskeleton
[1]),
734 edge(self
.vertskeleton
[2], self
.vertskeleton
[1]),
735 edge(self
.vertskeleton
[2], self
.vertskeleton
[0]),
736 edge(self
.vertskeleton
[0], self
.vertskeleton
[3]),
737 edge(self
.vertskeleton
[1], self
.vertskeleton
[3]),
738 edge(self
.vertskeleton
[1], self
.vertskeleton
[4]),
739 edge(self
.vertskeleton
[1], self
.vertskeleton
[5]),
740 edge(self
.vertskeleton
[2], self
.vertskeleton
[5]),
741 edge(self
.vertskeleton
[2], self
.vertskeleton
[6]),
742 edge(self
.vertskeleton
[2], self
.vertskeleton
[7]),
743 edge(self
.vertskeleton
[0], self
.vertskeleton
[7]),
744 edge(self
.vertskeleton
[0], self
.vertskeleton
[8]),
745 edge(self
.vertskeleton
[3], self
.vertskeleton
[9]),
746 edge(self
.vertskeleton
[3], self
.vertskeleton
[4]),
747 edge(self
.vertskeleton
[5], self
.vertskeleton
[4]),
748 edge(self
.vertskeleton
[5], self
.vertskeleton
[10]),
749 edge(self
.vertskeleton
[5], self
.vertskeleton
[6]),
750 edge(self
.vertskeleton
[7], self
.vertskeleton
[6]),
751 edge(self
.vertskeleton
[7], self
.vertskeleton
[11]),
752 edge(self
.vertskeleton
[7], self
.vertskeleton
[8]),
753 edge(self
.vertskeleton
[3], self
.vertskeleton
[8]),
754 edge(self
.vertskeleton
[4], self
.vertskeleton
[9]),
755 edge(self
.vertskeleton
[4], self
.vertskeleton
[10]),
756 edge(self
.vertskeleton
[6], self
.vertskeleton
[10]),
757 edge(self
.vertskeleton
[6], self
.vertskeleton
[11]),
758 edge(self
.vertskeleton
[8], self
.vertskeleton
[11]),
759 edge(self
.vertskeleton
[8], self
.vertskeleton
[9]),
760 edge(self
.vertskeleton
[9], self
.vertskeleton
[10]),
761 edge(self
.vertskeleton
[11], self
.vertskeleton
[10]),
762 edge(self
.vertskeleton
[11], self
.vertskeleton
[9])]
764 self
.panelpoints
= [[2, 0, 1], [0, 1, 3], [2, 1, 5], [2, 0, 7], [1, 3, 4], [1, 5, 4],
765 [2, 5, 6], [2, 7, 6], [0, 7, 8], [0, 3, 8], [3, 4, 9], [5, 4, 10],
766 [5, 6, 10], [7, 6, 11], [7, 8, 11], [3, 8, 9], [4, 9, 10],
767 [6, 11, 10], [8, 11, 9], [11, 9, 10]]
769 self
.paneledges
= [[2, 1, 0], [0, 3, 4], [1, 7, 6], [2, 9, 10], [4, 5, 13], [6, 5, 14],
770 [7, 8, 16], [9, 8, 17], [10, 11, 19], [3, 11, 20], [13, 12, 21],
771 [14, 15, 22], [16, 15, 23], [17, 18, 24], [19, 18, 25], [20, 12, 26],
772 [21, 22, 27], [24, 23, 28], [25, 26, 29], [29, 28, 27]]
774 self
.reversepanel
= [1, 3, 5, 7, 9, 10, 12, 14, 17, 19]
776 self
.vertsdone
= [[0, 0]] * len(self
.vertskeleton
)
779 # PKHG TODO this does not work yet ...
780 def creategeo(geo
, polytype
, orientation
, parameters
):
782 if polytype
== 'Tetrahedron':
783 if orientation
== 'PointUp':
784 my_tetrahedron
= tetrahedron(geodesic
)
785 my_tetrahedron
.set_vert_edge_skeleons()
786 my_tetrahedron
.config()
787 check_contains(my_tetrahedron
, "my_tetra", True)
789 elif orientation
== 'EdgeUp':
790 geo
= tetraedge(parameters
)
791 else: # orientation == 2:
792 geo
= tetraface(parameters
)
793 elif polytype
== 'Octahedron':
794 if orientation
== 'PointUp':
795 geo
= octahedron(parameters
)
796 elif orientation
== 'EdgeUp':
797 geo
= octaedge(parameters
)
798 else: # if orientation == 2:
799 geo
= octaface(parameters
)
800 elif polytype
== 'Icosahedron':
801 if orientation
== 'PointUp':
802 geo
= icosahedron(parameters
)
803 elif orientation
== 'EdgeUp':
804 geo
= icoedge(parameters
)
805 else: # if orientation == 2:
806 geo
= icoface(parameters
)