-
-
Save Hermann-SW/ef1ceade4aa53412585e42b6c5122354 to your computer and use it in GitHub Desktop.
const jscad = require('@jscad/modeling') | |
const { colorize } = jscad.colors | |
const { cuboid, cube, sphere, cylinder, circle, polygon } = jscad.primitives | |
const { rotate, translate } = jscad.transforms | |
const { degToRad } = jscad.utils | |
const { add, normalize, length, scale, dot } = jscad.maths.vec3 | |
const { extrudeRotate, extrudeLinear } = require('@jscad/modeling').extrusions | |
const { intersect, subtract, union } = require('@jscad/modeling').booleans | |
const { hull, hullChain } = require('@jscad/modeling').hulls | |
const { vectorText } = require('@jscad/modeling').text | |
function getParameterDefinitions() { | |
return [ | |
{ name: 'faces', type: 'choice', values: ['Pentagons', '6coloring', 'None'], initial: 'Pentagons', caption: 'face coloring:' }, | |
,{ name: 'white', type: 'checkbox', checked: true, initial: '20', caption: 'surface of sphere:' }, | |
,{ name: 'half', type: 'checkbox', checked: true, initial: '20', caption: 'half vertex:' }, | |
,{ name: 'vtxt', type: 'choice', values: ['Id', 'Type', 'theta', 'phi', 'None'], initial: 'Type', caption: 'vtxt:' }, | |
,{ name: 'look_inside', type: 'choice', values: ['no', 'yes'], initial: 'no', caption: 'look_inside:' } | |
]; | |
} | |
function map_3D(c, sc) { | |
return [Math.cos(degToRad(c[0]))*Math.sin(degToRad(c[1]))*sc, Math.sin(degToRad(c[0]))*Math.sin(degToRad(c[1]))*sc, Math.cos(degToRad(c[1]))*sc] | |
} | |
eps = 0.00001 | |
sc = 6 | |
coords =[ | |
[105.94578365549577,89.014733792432] | |
, [129.0550019281584,107.73640651121319] | |
, [122.30972392423993,127.71232355724267] | |
, [180,147.15863380965277] | |
, [180,169.0528779365509] | |
, [225,90] | |
, [245.1039093610171,71.03093628640724] | |
, [270,54.735610317245346] | |
, [270,32.84136619034721] | |
, [270,10.947122063449068] | |
, [90,10.947122063449068] | |
, [90,32.84136619034721] | |
, [90,54.735610317245346] | |
, [113.18515789774465,70.53429648012641] | |
, [75.5971911405843,88.77349838595634] | |
, [69.53300415681278,67.45092767974633] | |
, [52.78805157574246,82.2829148799955] | |
, [37.21194842425754,97.7170851200045] | |
, [334.41902365500374,79.0640282740017] | |
, [336.04512254075354,106.63363351165339] | |
, [313.7163439672569,115.57248257820386] | |
, [0,169.0528779365509] | |
, [0,147.15863380965277] | |
, [57.87416984456142,128.24193035086205] | |
, [51.31278560944429,109.8548336856907] | |
, [20.466995843187217,112.54907232025364] | |
, [0,125.26438968275465] | |
, [228.93428612206466,59.59233660582244] | |
, [216.30156855049154,39.039035941107954] | |
, [149.9704195294099,46.57764915405235] | |
, [143.60969003773818,67.8525453307019] | |
, [167.67349268606006,86.44569035792695] | |
, [158.90949820473946,106.48216218396492] | |
, [180,125.26438968275465] | |
, [204.8960906389829,108.96906371359275] | |
, [200.50128981570253,85.00236355911403] | |
] | |
function vertex(_v, half=false) { | |
p = coords[_v] | |
v = map_3D(p,sc) | |
s = sphere({radius: 0.5, center: v}) | |
if (half) { | |
la1 = degToRad(p[0]) | |
ph1 = degToRad(90 - p[1]) | |
return colorize([0, 0.7, 0], | |
subtract(s, | |
translate([0, 0, 0], | |
rotate([0, 0, la1], | |
rotate([0, -ph1, 0], | |
translate([sc+0.5, 0], | |
rotate([degToRad(90), 0, degToRad(90)], | |
translate([-0, -0, -1], | |
cuboid({size: [1, 1, 0.8]}) | |
) | |
) | |
) | |
) | |
) | |
) | |
) | |
) | |
} else { | |
return colorize([0, 0.7, 0], s) | |
} | |
} | |
function txt(mesg, w) { | |
const lineRadius = w / 2 | |
const lineCorner = circle({ radius: lineRadius }) | |
const lineSegmentPointArrays = vectorText({ x: 0, y: 0, height: 0.25, input: mesg }) | |
const lineSegments = [] | |
lineSegmentPointArrays.forEach(function(segmentPoints) { | |
const corners = segmentPoints.map((point) => translate(point, lineCorner)) | |
lineSegments.push(hullChain(corners)) | |
}) | |
const message2D = union(lineSegments) | |
return extrudeLinear({ height: w }, message2D) | |
} | |
function vtxt(_p1, num) { | |
str = num.toString() | |
p1 = coords[_p1] | |
la1 = degToRad(p1[0]) | |
ph1 = degToRad(90 - p1[1]) | |
return translate([0, 0, 0], | |
rotate([0, 0, la1], | |
rotate([0, -ph1, 0], | |
translate([sc+0.5, 0.15-0.25*str.length], | |
rotate([degToRad(90), 0, degToRad(90)], | |
colorize([0, 0, 0], | |
txt(str, 0.05) | |
) | |
) | |
) | |
) | |
) | |
) | |
} | |
function edge(_v, _w, _e) { | |
v = map_3D(coords[_v], sc) | |
w = map_3D(coords[_w], sc) | |
d = [0, 0, 0] | |
x = [0, 0, 0] | |
jscad.maths.vec3.subtract(d, w, v) | |
add(x, v, w) | |
scale(w, x, 0.5) | |
if (length(d) >= eps) { | |
return colorize([0, 0, 1, 1], | |
translate(w, | |
rotate([0, Math.acos(d[2]/length(d)), Math.atan2(d[1], d[0])], | |
cylinder({radius: 0.1, height: length(d)}) | |
) | |
) | |
) | |
} else { | |
return cube({size: 0.01}) | |
} | |
} | |
function edge2(_p1, _p2, _e) { | |
p1 = coords[_p1] | |
p2 = coords[_p2] | |
// al/la/ph: alpha/lambda/phi | lxy/sxy: delta lambda_xy/sigma_xy | |
// https://en.wikipedia.org/wiki/Great-circle_navigation#Course | |
la1 = degToRad(p1[0]) | |
la2 = degToRad(p2[0]) | |
l12 = la2 - la1 | |
ph1 = degToRad(90 - p1[1]) | |
ph2 = degToRad(90 - p2[1]) | |
al1 = Math.atan2(Math.cos(ph2)*Math.sin(l12), Math.cos(ph1)*Math.sin(ph2)-Math.sin(ph1)*Math.cos(ph2)*Math.cos(l12)) | |
// delta sigma_12 | |
// https://en.wikipedia.org/wiki/Great-circle_distance#Formulae | |
s12 = Math.acos(Math.sin(ph1)*Math.sin(ph2)+Math.cos(ph1)*Math.cos(ph2)*Math.cos(l12)) | |
return rotate([0, 0, la1], | |
rotate([0, -ph1, 0], | |
rotate([degToRad(90)-al1, 0, 0], | |
colorize([0, 0, 0.7], | |
extrudeRotate({segments: 32, angle: s12}, | |
circle({radius: 0.1, center: [sc,0]}) | |
) | |
) | |
) | |
) | |
) | |
} | |
function sp_tria2(r, tang, pang, thi, points, segments) { | |
const coords = [] | |
pts2 = Math.trunc(points / 2) | |
for(i = 0; i<pts2; i=i+1) { | |
th = i*(tang/(pts2-1)) | |
coords.push([(r-thi/2)*Math.sin(th), (r-thi/2)*Math.cos(th)]) | |
} | |
for(i = pts2-1; i>=0; i=i-1) { | |
th = i*(tang/(pts2-1)) | |
coords.push([(r+thi/2)*Math.sin(th), (r+thi/2)*Math.cos(th)]) | |
} | |
return extrudeRotate({segments: segments, angle: pang}, | |
polygon({points: coords}) | |
) | |
} | |
function sp_tria(_p1, _p2, _p3, sub) { | |
p1 = coords[_p1] | |
p2 = coords[_p2] | |
p3 = coords[_p3] | |
// al/la/ph: alpha/lambda/phi | lxy/sxy: delta lambda_xy/sigma_xy | |
// https://en.wikipedia.org/wiki/Great-circle_navigation#Course | |
la1 = degToRad(p1[0]) | |
la2 = degToRad(p2[0]) | |
la3 = degToRad(p3[0]) | |
l12 = la2 - la1 | |
l13 = la3 - la1 | |
l32 = la2 - la3 | |
l23 = la3 - la2 | |
l31 = la1 - la3 | |
ph1 = degToRad(90 - p1[1]) | |
ph2 = degToRad(90 - p2[1]) | |
ph3 = degToRad(90 - p3[1]) | |
al12 = Math.atan2(Math.cos(ph2)*Math.sin(l12), Math.cos(ph1)*Math.sin(ph2)-Math.sin(ph1)*Math.cos(ph2)*Math.cos(l12)) | |
al13 = Math.atan2(Math.cos(ph3)*Math.sin(l13), Math.cos(ph1)*Math.sin(ph3)-Math.sin(ph1)*Math.cos(ph3)*Math.cos(l13)) | |
al31 = Math.atan2(Math.cos(ph1)*Math.sin(l31), Math.cos(ph3)*Math.sin(ph1)-Math.sin(ph3)*Math.cos(ph1)*Math.cos(l31)) | |
al32 = Math.atan2(Math.cos(ph2)*Math.sin(l32), Math.cos(ph3)*Math.sin(ph2)-Math.sin(ph3)*Math.cos(ph2)*Math.cos(l32)) | |
// delta sigma_xy | |
// https://en.wikipedia.org/wiki/Great-circle_distance#Formulae | |
s12 = Math.acos(Math.sin(ph1)*Math.sin(ph2)+Math.cos(ph1)*Math.cos(ph2)*Math.cos(l12)) | |
s23 = Math.acos(Math.sin(ph2)*Math.sin(ph3)+Math.cos(ph2)*Math.cos(ph3)*Math.cos(l23)) | |
s13 = Math.acos(Math.sin(ph1)*Math.sin(ph3)+Math.cos(ph1)*Math.cos(ph3)*Math.cos(l13)) | |
if (s13 < s12) { | |
if (s12 >= s23) { | |
return sp_tria(_p1, _p3, _p2, sub) | |
} else { | |
return sp_tria(_p2, _p1, _p3, sub) | |
} | |
} else { | |
if (s13 < s23) { | |
return sp_tria(_p2, _p1, _p3, sub) | |
} else if (Math.abs(s13-s12-s23) >= eps) { | |
function mpi(ang) { return (ang < -Math.PI) ? 2*Math.PI + ang : ((ang > Math.PI) ? ang - 2*Math.PI : ang) } | |
v1 = map_3D(p1, 1) | |
v2 = map_3D(p2, 1) | |
v3 = map_3D(p3, 1) | |
ms = [0, 0, 0] | |
ms2 = [0, 0, 0] | |
sv1=[0, 0, 0] | |
sv2=[0, 0, 0] | |
sv3=[0, 0, 0] | |
s1=[0, 0, 0] | |
s2=[0, 0, 0] | |
s3=[0, 0, 0] | |
add(ms, v1, v2) | |
add(ms, ms, v3) | |
normalize(ms2, ms) | |
mi = Math.min(dot(v1, ms2), dot(v2, ms2), dot(v3, ms2)) | |
scale(sv1, v1, sc) | |
scale(sv2, v2, sc) | |
scale(sv3, v3, sc) | |
scale(s1, sv1, 1/mi) | |
scale(s2, sv2, 1/mi) | |
scale(s3, sv3, 1/mi) | |
return colorize([0.5, 0.5, 0.5], | |
subtract( | |
intersect( | |
union( | |
translate([0, 0, 0], | |
rotate([0, 0, la1-degToRad(180)], | |
rotate([0, ph1-degToRad(90), 0], | |
rotate([0,0,-al13], | |
sp_tria2(sc, s12, mpi(al13-al12), 0.1, 24, 30) | |
) | |
) | |
) | |
), | |
translate([0, 0, 0], | |
rotate([0, 0, la3-degToRad(180)], | |
rotate([0, ph3-degToRad(90), 0], | |
rotate([0, 0, -al31], | |
sp_tria2(sc, s23, mpi(al31-al32), 0.1, 24, 30) | |
) | |
) | |
) | |
) | |
), | |
hull( | |
cube({center: sv1, size: 0.01}) | |
,cube({center: sv2, size: 0.01}) | |
,cube({center: sv3, size: 0.01}) | |
,cube({center: s1, size: 0.01}) | |
,cube({center: s2, size: 0.01}) | |
,cube({center: s3, size: 0.01}) | |
) | |
) | |
,sub) | |
) | |
} else { | |
return cube({size: 0.01}) | |
} | |
} | |
} | |
function main(params) { | |
sub = [cube({size: (params.look_inside === 'yes')?sc+0.1:0.01, center: [sc/2,-sc/2,sc/2]})] | |
pentagons = (params.faces !== 'Pentagons') ? [] : [[] | |
,sp_tria( 13 , 0 , 14 , sub) | |
,sp_tria( 13 , 14 , 15 , sub) | |
,sp_tria( 13 , 15 , 12 , sub) | |
,sp_tria( 2 , 1 , 32 , sub) | |
,sp_tria( 2 , 32 , 33 , sub) | |
,sp_tria( 2 , 33 , 3 , sub) | |
,sp_tria( 4 , 3 , 33 , sub) | |
,sp_tria( 4 , 33 , 34 , sub) | |
,sp_tria( 4 , 34 , 5 , sub) | |
,sp_tria( 21 , 4 , 5 , sub) | |
,sp_tria( 21 , 5 , 6 , sub) | |
,sp_tria( 21 , 6 , 20 , sub) | |
,sp_tria( 8 , 7 , 27 , sub) | |
,sp_tria( 8 , 27 , 28 , sub) | |
,sp_tria( 8 , 28 , 9 , sub) | |
,sp_tria( 10 , 9 , 28 , sub) | |
,sp_tria( 10 , 28 , 29 , sub) | |
,sp_tria( 10 , 29 , 11 , sub) | |
,sp_tria( 16 , 10 , 11 , sub) | |
,sp_tria( 16 , 11 , 12 , sub) | |
,sp_tria( 16 , 12 , 15 , sub) | |
,sp_tria( 12 , 11 , 29 , sub) | |
,sp_tria( 12 , 29 , 30 , sub) | |
,sp_tria( 12 , 30 , 13 , sub) | |
,sp_tria( 18 , 17 , 25 , sub) | |
,sp_tria( 18 , 25 , 26 , sub) | |
,sp_tria( 18 , 26 , 19 , sub) | |
,sp_tria( 20 , 19 , 26 , sub) | |
,sp_tria( 20 , 26 , 22 , sub) | |
,sp_tria( 20 , 22 , 21 , sub) | |
,sp_tria( 23 , 22 , 26 , sub) | |
,sp_tria( 23 , 26 , 25 , sub) | |
,sp_tria( 23 , 25 , 24 , sub) | |
,sp_tria( 32 , 31 , 35 , sub) | |
,sp_tria( 32 , 35 , 34 , sub) | |
,sp_tria( 32 , 34 , 33 , sub) | |
] | |
sixcol = (params.faces !== '6coloring') ? [] : [[] | |
, colorize( [0,0.4,0.4] , sp_tria( 0 , 32 , 1 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 0 , 31 , 32 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 0 , 30 , 31 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 0 , 13 , 30 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 13 , 15 , 12 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 13 , 14 , 15 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 13 , 0 , 14 , sub)) | |
, colorize( [0,0,0.7] , sp_tria( 14 , 23 , 24 , sub)) | |
, colorize( [0,0,0.7] , sp_tria( 14 , 2 , 23 , sub)) | |
, colorize( [0,0,0.7] , sp_tria( 14 , 1 , 2 , sub)) | |
, colorize( [0,0,0.7] , sp_tria( 14 , 0 , 1 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 2 , 33 , 3 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 2 , 32 , 33 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 2 , 1 , 32 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 23 , 21 , 22 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 23 , 4 , 21 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 23 , 3 , 4 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 23 , 2 , 3 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 4 , 34 , 5 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 4 , 33 , 34 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 4 , 3 , 33 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 21 , 6 , 20 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 21 , 5 , 6 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 21 , 4 , 5 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 6 , 27 , 7 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 6 , 35 , 27 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 6 , 34 , 35 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 6 , 5 , 34 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 20 , 18 , 19 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 20 , 8 , 18 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 20 , 7 , 8 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 20 , 6 , 7 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 8 , 28 , 9 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 8 , 27 , 28 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 8 , 7 , 27 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 18 , 16 , 17 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 18 , 10 , 16 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 18 , 9 , 10 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 18 , 8 , 9 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 10 , 29 , 11 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 10 , 28 , 29 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 10 , 9 , 28 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 16 , 12 , 15 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 16 , 11 , 12 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 16 , 10 , 11 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 12 , 30 , 13 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 12 , 29 , 30 , sub)) | |
, colorize( [0.4,0,0.4] , sp_tria( 12 , 11 , 29 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 15 , 17 , 16 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 15 , 25 , 17 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 15 , 24 , 25 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 15 , 14 , 24 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 18 , 26 , 19 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 18 , 25 , 26 , sub)) | |
, colorize( [0.7,0,0] , sp_tria( 18 , 17 , 25 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 20 , 22 , 21 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 20 , 26 , 22 , sub)) | |
, colorize( [0,0.4,0.4] , sp_tria( 20 , 19 , 26 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 23 , 25 , 24 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 23 , 26 , 25 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 23 , 22 , 26 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 28 , 30 , 29 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 28 , 31 , 30 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 28 , 35 , 31 , sub)) | |
, colorize( [0,0.7,0] , sp_tria( 28 , 27 , 35 , sub)) | |
, colorize( [0,0,0.7] , sp_tria( 32 , 34 , 33 , sub)) | |
, colorize( [0,0,0.7] , sp_tria( 32 , 35 , 34 , sub)) | |
, colorize( [0,0,0.7] , sp_tria( 32 , 31 , 35 , sub)) | |
] | |
white = (!params.white) ? [] : [[] | |
, colorize([1,1,1], | |
subtract( | |
sphere({radius: sc, segments: 30}) | |
,sphere({radius: sc-0.1, segments: 30}) | |
,sub | |
) | |
) | |
] | |
vtype = [ [ 0 , 1 , coords[ 0 ][1].toFixed(1), coords[ 0 ][0].toFixed(1)] | |
,[ 1 , 1 , coords[ 1 ][1].toFixed(1), coords[ 1 ][0].toFixed(1)] | |
,[ 2 , 1 , coords[ 2 ][1].toFixed(1), coords[ 2 ][0].toFixed(1)] | |
,[ 3 , 0 , coords[ 3 ][1].toFixed(1), coords[ 3 ][0].toFixed(1)] | |
,[ 4 , 0 , coords[ 4 ][1].toFixed(1), coords[ 4 ][0].toFixed(1)] | |
,[ 5 , 0 , coords[ 5 ][1].toFixed(1), coords[ 5 ][0].toFixed(1)] | |
,[ 6 , 0 , coords[ 6 ][1].toFixed(1), coords[ 6 ][0].toFixed(1)] | |
,[ 7 , 0 , coords[ 7 ][1].toFixed(1), coords[ 7 ][0].toFixed(1)] | |
,[ 8 , 0 , coords[ 8 ][1].toFixed(1), coords[ 8 ][0].toFixed(1)] | |
,[ 9 , 0 , coords[ 9 ][1].toFixed(1), coords[ 9 ][0].toFixed(1)] | |
,[ 10 , 0 , coords[ 10 ][1].toFixed(1), coords[ 10 ][0].toFixed(1)] | |
,[ 11 , 0 , coords[ 11 ][1].toFixed(1), coords[ 11 ][0].toFixed(1)] | |
,[ 12 , 0 , coords[ 12 ][1].toFixed(1), coords[ 12 ][0].toFixed(1)] | |
,[ 13 , 1 , coords[ 13 ][1].toFixed(1), coords[ 13 ][0].toFixed(1)] | |
,[ 14 , 1 , coords[ 14 ][1].toFixed(1), coords[ 14 ][0].toFixed(1)] | |
,[ 15 , 0 , coords[ 15 ][1].toFixed(1), coords[ 15 ][0].toFixed(1)] | |
,[ 16 , 0 , coords[ 16 ][1].toFixed(1), coords[ 16 ][0].toFixed(1)] | |
,[ 17 , 0 , coords[ 17 ][1].toFixed(1), coords[ 17 ][0].toFixed(1)] | |
,[ 18 , 2 , coords[ 18 ][1].toFixed(1), coords[ 18 ][0].toFixed(1)] | |
,[ 19 , 2 , coords[ 19 ][1].toFixed(1), coords[ 19 ][0].toFixed(1)] | |
,[ 20 , 2 , coords[ 20 ][1].toFixed(1), coords[ 20 ][0].toFixed(1)] | |
,[ 21 , 0 , coords[ 21 ][1].toFixed(1), coords[ 21 ][0].toFixed(1)] | |
,[ 22 , 0 , coords[ 22 ][1].toFixed(1), coords[ 22 ][0].toFixed(1)] | |
,[ 23 , 1 , coords[ 23 ][1].toFixed(1), coords[ 23 ][0].toFixed(1)] | |
,[ 24 , 1 , coords[ 24 ][1].toFixed(1), coords[ 24 ][0].toFixed(1)] | |
,[ 25 , 0 , coords[ 25 ][1].toFixed(1), coords[ 25 ][0].toFixed(1)] | |
,[ 26 , 0 , coords[ 26 ][1].toFixed(1), coords[ 26 ][0].toFixed(1)] | |
,[ 27 , 1 , coords[ 27 ][1].toFixed(1), coords[ 27 ][0].toFixed(1)] | |
,[ 28 , 1 , coords[ 28 ][1].toFixed(1), coords[ 28 ][0].toFixed(1)] | |
,[ 29 , 1 , coords[ 29 ][1].toFixed(1), coords[ 29 ][0].toFixed(1)] | |
,[ 30 , 1 , coords[ 30 ][1].toFixed(1), coords[ 30 ][0].toFixed(1)] | |
,[ 31 , 1 , coords[ 31 ][1].toFixed(1), coords[ 31 ][0].toFixed(1)] | |
,[ 32 , 1 , coords[ 32 ][1].toFixed(1), coords[ 32 ][0].toFixed(1)] | |
,[ 33 , 0 , coords[ 33 ][1].toFixed(1), coords[ 33 ][0].toFixed(1)] | |
,[ 34 , 0 , coords[ 34 ][1].toFixed(1), coords[ 34 ][0].toFixed(1)] | |
,[ 35 , 1 , coords[ 35 ][1].toFixed(1), coords[ 35 ][0].toFixed(1)] | |
] | |
tvtxt = (params.vtxt === 'Type') ? 1 : (params.vtxt === 'theta') ? 2 : (params.vtxt === 'phi') ? 3 : 0 | |
vtxts = (params.vtxt === 'None') ? [] : [ | |
vtxt( 0 , vtype[ 0 ][tvtxt]) | |
,vtxt( 1 , vtype[ 1 ][tvtxt]) | |
,vtxt( 2 , vtype[ 2 ][tvtxt]) | |
,vtxt( 3 , vtype[ 3 ][tvtxt]) | |
,vtxt( 4 , vtype[ 4 ][tvtxt]) | |
,vtxt( 5 , vtype[ 5 ][tvtxt]) | |
,vtxt( 6 , vtype[ 6 ][tvtxt]) | |
,vtxt( 7 , vtype[ 7 ][tvtxt]) | |
,vtxt( 8 , vtype[ 8 ][tvtxt]) | |
,vtxt( 9 , vtype[ 9 ][tvtxt]) | |
,vtxt( 10 , vtype[ 10 ][tvtxt]) | |
,vtxt( 11 , vtype[ 11 ][tvtxt]) | |
,vtxt( 12 , vtype[ 12 ][tvtxt]) | |
,vtxt( 13 , vtype[ 13 ][tvtxt]) | |
,vtxt( 14 , vtype[ 14 ][tvtxt]) | |
,vtxt( 15 , vtype[ 15 ][tvtxt]) | |
,vtxt( 16 , vtype[ 16 ][tvtxt]) | |
,vtxt( 17 , vtype[ 17 ][tvtxt]) | |
,vtxt( 18 , vtype[ 18 ][tvtxt]) | |
,vtxt( 19 , vtype[ 19 ][tvtxt]) | |
,vtxt( 20 , vtype[ 20 ][tvtxt]) | |
,vtxt( 21 , vtype[ 21 ][tvtxt]) | |
,vtxt( 22 , vtype[ 22 ][tvtxt]) | |
,vtxt( 23 , vtype[ 23 ][tvtxt]) | |
,vtxt( 24 , vtype[ 24 ][tvtxt]) | |
,vtxt( 25 , vtype[ 25 ][tvtxt]) | |
,vtxt( 26 , vtype[ 26 ][tvtxt]) | |
,vtxt( 27 , vtype[ 27 ][tvtxt]) | |
,vtxt( 28 , vtype[ 28 ][tvtxt]) | |
,vtxt( 29 , vtype[ 29 ][tvtxt]) | |
,vtxt( 30 , vtype[ 30 ][tvtxt]) | |
,vtxt( 31 , vtype[ 31 ][tvtxt]) | |
,vtxt( 32 , vtype[ 32 ][tvtxt]) | |
,vtxt( 33 , vtype[ 33 ][tvtxt]) | |
,vtxt( 34 , vtype[ 34 ][tvtxt]) | |
,vtxt( 35 , vtype[ 35 ][tvtxt]) | |
] | |
return[ | |
,vertex( 0 , params.half && ((tvtxt !== 1) || (vtype[ 0 ][1] !== 0))) | |
,vertex( 1 , params.half && ((tvtxt !== 1) || (vtype[ 1 ][1] !== 0))) | |
,vertex( 2 , params.half && ((tvtxt !== 1) || (vtype[ 2 ][1] !== 0))) | |
,vertex( 3 , params.half && ((tvtxt !== 1) || (vtype[ 3 ][1] !== 0))) | |
,vertex( 4 , params.half && ((tvtxt !== 1) || (vtype[ 4 ][1] !== 0))) | |
,vertex( 5 , params.half && ((tvtxt !== 1) || (vtype[ 5 ][1] !== 0))) | |
,vertex( 6 , params.half && ((tvtxt !== 1) || (vtype[ 6 ][1] !== 0))) | |
,colorize([0.7, 0, 0], vertex( 7 , params.half && ((tvtxt !== 1) || (vtype[ 7 ][1] !== 0)))) | |
,vertex( 8 , params.half && ((tvtxt !== 1) || (vtype[ 8 ][1] !== 0))) | |
,vertex( 9 , params.half && ((tvtxt !== 1) || (vtype[ 9 ][1] !== 0))) | |
,vertex( 10 , params.half && ((tvtxt !== 1) || (vtype[ 10 ][1] !== 0))) | |
,vertex( 11 , params.half && ((tvtxt !== 1) || (vtype[ 11 ][1] !== 0))) | |
,colorize([0.7, 0, 0], vertex( 12 , params.half && ((tvtxt !== 1) || (vtype[ 12 ][1] !== 0)))) | |
,vertex( 13 , params.half && ((tvtxt !== 1) || (vtype[ 13 ][1] !== 0))) | |
,vertex( 14 , params.half && ((tvtxt !== 1) || (vtype[ 14 ][1] !== 0))) | |
,vertex( 15 , params.half && ((tvtxt !== 1) || (vtype[ 15 ][1] !== 0))) | |
,vertex( 16 , params.half && ((tvtxt !== 1) || (vtype[ 16 ][1] !== 0))) | |
,vertex( 17 , params.half && ((tvtxt !== 1) || (vtype[ 17 ][1] !== 0))) | |
,vertex( 18 , params.half && ((tvtxt !== 1) || (vtype[ 18 ][1] !== 0))) | |
,vertex( 19 , params.half && ((tvtxt !== 1) || (vtype[ 19 ][1] !== 0))) | |
,vertex( 20 , params.half && ((tvtxt !== 1) || (vtype[ 20 ][1] !== 0))) | |
,vertex( 21 , params.half && ((tvtxt !== 1) || (vtype[ 21 ][1] !== 0))) | |
,vertex( 22 , params.half && ((tvtxt !== 1) || (vtype[ 22 ][1] !== 0))) | |
,vertex( 23 , params.half && ((tvtxt !== 1) || (vtype[ 23 ][1] !== 0))) | |
,vertex( 24 , params.half && ((tvtxt !== 1) || (vtype[ 24 ][1] !== 0))) | |
,vertex( 25 , params.half && ((tvtxt !== 1) || (vtype[ 25 ][1] !== 0))) | |
,colorize([0.7, 0, 0], vertex( 26 , params.half && ((tvtxt !== 1) || (vtype[ 26 ][1] !== 0)))) | |
,vertex( 27 , params.half && ((tvtxt !== 1) || (vtype[ 27 ][1] !== 0))) | |
,vertex( 28 , params.half && ((tvtxt !== 1) || (vtype[ 28 ][1] !== 0))) | |
,vertex( 29 , params.half && ((tvtxt !== 1) || (vtype[ 29 ][1] !== 0))) | |
,vertex( 30 , params.half && ((tvtxt !== 1) || (vtype[ 30 ][1] !== 0))) | |
,vertex( 31 , params.half && ((tvtxt !== 1) || (vtype[ 31 ][1] !== 0))) | |
,vertex( 32 , params.half && ((tvtxt !== 1) || (vtype[ 32 ][1] !== 0))) | |
,colorize([0.7, 0, 0], vertex( 33 , params.half && ((tvtxt !== 1) || (vtype[ 33 ][1] !== 0)))) | |
,vertex( 34 , params.half && ((tvtxt !== 1) || (vtype[ 34 ][1] !== 0))) | |
,vertex( 35 , params.half && ((tvtxt !== 1) || (vtype[ 35 ][1] !== 0))) | |
,edge2( 0 , 13 , 0 ) | |
,edge2( 0 , 14 , 1 ) | |
,edge2( 0 , 1 , 2 ) | |
,edge2( 1 , 2 , 3 ) | |
,edge2( 1 , 32 , 4 ) | |
,edge2( 2 , 23 , 5 ) | |
,edge2( 2 , 3 , 6 ) | |
,colorize([1,0.66666,0],edge2( 3 , 4 , 7 )) | |
,colorize([1,0.66666,0],edge2( 3 , 33 , 8 )) | |
,colorize([1,0.66666,0],edge2( 4 , 21 , 9 )) | |
,edge2( 4 , 5 , 10 ) | |
,colorize([1,0.66666,0],edge2( 5 , 6 , 11 )) | |
,colorize([1,0.66666,0],edge2( 5 , 34 , 12 )) | |
,edge2( 6 , 20 , 13 ) | |
,colorize([1,0.66666,0],edge2( 6 , 7 , 14 )) | |
,colorize([1,0.66666,0],edge2( 7 , 8 , 15 )) | |
,edge2( 7 , 27 , 16 ) | |
,edge2( 8 , 18 , 17 ) | |
,colorize([1,0.66666,0],edge2( 8 , 9 , 18 )) | |
,colorize([1,0.66666,0],edge2( 9 , 10 , 19 )) | |
,edge2( 9 , 28 , 20 ) | |
,edge2( 10 , 16 , 21 ) | |
,colorize([1,0.66666,0],edge2( 10 , 11 , 22 )) | |
,colorize([1,0.66666,0],edge2( 11 , 12 , 23 )) | |
,edge2( 11 , 29 , 24 ) | |
,colorize([1,0.66666,0],edge2( 12 , 15 , 25 )) | |
,edge2( 12 , 13 , 26 ) | |
,edge2( 13 , 30 , 27 ) | |
,edge2( 14 , 15 , 28 ) | |
,edge2( 14 , 24 , 29 ) | |
,colorize([1,0.66666,0],edge2( 15 , 16 , 30 )) | |
,colorize([1,0.66666,0],edge2( 16 , 17 , 31 )) | |
,edge2( 17 , 18 , 32 ) | |
,colorize([1,0.66666,0],edge2( 17 , 25 , 33 )) | |
,edge2( 18 , 19 , 34 ) | |
,edge2( 19 , 20 , 35 ) | |
,edge2( 19 , 26 , 36 ) | |
,edge2( 20 , 21 , 37 ) | |
,colorize([1,0.66666,0],edge2( 21 , 22 , 38 )) | |
,edge2( 22 , 23 , 39 ) | |
,colorize([1,0.66666,0],edge2( 22 , 26 , 40 )) | |
,edge2( 23 , 24 , 41 ) | |
,edge2( 24 , 25 , 42 ) | |
,colorize([1,0.66666,0],edge2( 25 , 26 , 43 )) | |
,edge2( 27 , 28 , 44 ) | |
,edge2( 27 , 35 , 45 ) | |
,edge2( 28 , 29 , 46 ) | |
,edge2( 29 , 30 , 47 ) | |
,edge2( 30 , 31 , 48 ) | |
,edge2( 31 , 32 , 49 ) | |
,edge2( 31 , 35 , 50 ) | |
,edge2( 32 , 33 , 51 ) | |
,colorize([1,0.66666,0],edge2( 33 , 34 , 52 )) | |
,edge2( 34 , 35 , 53 ) | |
,pentagons | |
,sixcol | |
,white | |
,vtxts | |
] } | |
module.exports = { main, getParameterDefinitions } |
Can be viewed witth openjscad.xyz ...
https://openjscad.xyz/?uri=https://gist.githubusercontent.com/Hermann-SW/ef1ceade4aa53412585e42b6c5122354/raw/21381da1f05a65d11ff4c6d78b3f6dbce18cf971/C36_10.correct.jscad
... and jscad.app:
https://jscad.app/#https://gist.githubusercontent.com/Hermann-SW/ef1ceade4aa53412585e42b6c5122354/raw/21381da1f05a65d11ff4c6d78b3f6dbce18cf971/C36_10.correct.jscad
I changed initial face coloring to "6coloring", new version accessible here:
https://jscad.app/#https://gist.githubusercontent.com/Hermann-SW/ef1ceade4aa53412585e42b6c5122354/raw/e46f3b9946b4c3d4c100e6ba664dad964175cd06/C36_10.correct.jscad
Removing commit hash from
https://gist.githubusercontent.com/{user}/{gist_hash}/raw/{commit_hash}/{file}
resulting in
https://gist.githubusercontent.com/{user}/{gist_hash}/raw/{file}
allows to always access latest version of file.
https://jscad.app/#https://gist.githubusercontent.com/Hermann-SW/ef1ceade4aa53412585e42b6c5122354/raw/C36_10.correct.jscad
OK, raw gists have these reponse headers set:
Access-Control-Allow-Origin: *
Cache-Control: max-age=300
While the 1st is essential to make jscad.app directly fetch the URL and not use its own caching proxy, the 2nd means that after a gist update it takes 5 minutes for a client having such a file fetched to get the new version.
Clearing local browser cache does not help, because github does the 5 minute caching.
curl shows that only one "*allow*" header is returned:
from: