Merge pull request #377 from adrianVmariano/master

trapezohedron fix
This commit is contained in:
Revar Desmera 2021-01-11 23:46:19 -08:00 committed by GitHub
commit 0260495f19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -689,7 +689,7 @@ function regular_polyhedron_info(
boundtable = [bounds[0], [0,0,0], bounds[1]],
translation = [for(i=[0:2]) -boundtable[1+anchor[i]][i]],
face_normals = rot(p=faces_normals_vertices[1], from=down_direction, to=[0,0,-1]),
side_length = scalefactor * entry[edgelen]
radius_scale = name=="trapezohedron" ? 1 : scalefactor * entry[edgelen]
)
info == "fullentry" ? [
scaled_points,
@ -697,15 +697,15 @@ function regular_polyhedron_info(
stellate ? faces : face_triangles,
faces,
face_normals,
side_length*entry[in_radius]
radius_scale*entry[in_radius]
] :
info == "vnf" ? [move(translation,p=scaled_points), stellate ? faces : face_triangles] :
info == "vertices" ? move(translation,p=scaled_points) :
info == "faces" ? faces :
info == "face normals" ? face_normals :
info == "in_radius" ? side_length * entry[in_radius] :
info == "mid_radius" ? side_length * entry[mid_radius] :
info == "out_radius" ? side_length * entry[out_radius] :
info == "in_radius" ? radius_scale * entry[in_radius] :
info == "mid_radius" ? radius_scale * entry[mid_radius] :
info == "out_radius" ? radius_scale * entry[out_radius] :
info == "index set" ? indexlist :
info == "face vertices" ? (stellate==false? entry[facevertices] : [3]) :
info == "edge length" ? scalefactor * entry[edgelen] :
@ -737,7 +737,7 @@ function _trapezohedron(faces, r, side, longside, h, d) =
)
assert(parmcount==2,"Must define exactly two of 'r', 'side', 'longside', and 'height'")
let(
separation = (
separation = ( // z distance between non-apex vertices that aren't in the same plane
!is_undef(h) ? 2*h*sqr(tan(90/N)) :
(!is_undef(r) && !is_undef(side))? sqrt(side*side+2*r*r*(cos(180/N)-1)) :
(!is_undef(r) && !is_undef(longside))? 2 * sqrt(sqr(longside)-sqr(r)) / (1-sqr(tan(90/N))) * sqr(tan(90/N)) :