mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Improved polyhedron docs.
This commit is contained in:
parent
aa963640f6
commit
9182319994
1 changed files with 51 additions and 26 deletions
|
@ -188,15 +188,15 @@ function _unique_groups(m) = [
|
||||||
// regular_polyhedron("great stellated dodecahedron");
|
// regular_polyhedron("great stellated dodecahedron");
|
||||||
// Example: Third Archimedean solid
|
// Example: Third Archimedean solid
|
||||||
// regular_polyhedron(type="archimedean", index=2);
|
// regular_polyhedron(type="archimedean", index=2);
|
||||||
// Example: Solids that have 8 or 10 vertex faces
|
// Example(Med): Solids that have 8 or 10 vertex faces
|
||||||
// N = len(regular_polyhedron_info("index set", hasfaces=[8,10]));
|
// N = len(regular_polyhedron_info("index set", hasfaces=[8,10]));
|
||||||
// for(i=[0:N-1]) right(3*i)
|
// for(i=[0:N-1]) right(3*i)
|
||||||
// regular_polyhedron(hasfaces=[8,10], index=i, mr=1);
|
// regular_polyhedron(hasfaces=[8,10], index=i, mr=1);
|
||||||
// Example: Solids that include a quadrilateral face
|
// Example(Big): Solids that include a quadrilateral face
|
||||||
// N = len(regular_polyhedron_info("index set", hasfaces=4));
|
// N = len(regular_polyhedron_info("index set", hasfaces=4));
|
||||||
// for(i=[0:N-1]) right(3*i)
|
// for(i=[0:N-1]) right(3*i)
|
||||||
// regular_polyhedron(hasfaces=4, index=i, mr=1);
|
// regular_polyhedron(hasfaces=4, index=i, mr=1);
|
||||||
// Example: Solids with only quadrilateral faces
|
// Example(Med): Solids with only quadrilateral faces
|
||||||
// N = len(regular_polyhedron_info("index set", facetype=4));
|
// N = len(regular_polyhedron_info("index set", facetype=4));
|
||||||
// for(i=[0:N-1]) right(3*i)
|
// for(i=[0:N-1]) right(3*i)
|
||||||
// regular_polyhedron(facetype=4, index=i, mr=1);
|
// regular_polyhedron(facetype=4, index=i, mr=1);
|
||||||
|
@ -208,7 +208,7 @@ function _unique_groups(m) = [
|
||||||
// regular_polyhedron("octahedron", side=1, rounding=.2);
|
// regular_polyhedron("octahedron", side=1, rounding=.2);
|
||||||
// Example: Rounded catalon solid
|
// Example: Rounded catalon solid
|
||||||
// regular_polyhedron("rhombic dodecahedron", side=1, rounding=0.2);
|
// regular_polyhedron("rhombic dodecahedron", side=1, rounding=0.2);
|
||||||
// Example: Rounded Archimedean solid compared to unrounded version. The small faces are shifted back from their correct position.
|
// Example(Med): Rounded Archimedean solid compared to unrounded version. The small faces are shifted back from their correct position.
|
||||||
// %regular_polyhedron(type="archimedean", mr=1, rounding=0);
|
// %regular_polyhedron(type="archimedean", mr=1, rounding=0);
|
||||||
// regular_polyhedron(type="archimedean", mr=1, rounding=0.3);
|
// regular_polyhedron(type="archimedean", mr=1, rounding=0.3);
|
||||||
// Example: Two children are distributed arbitrarily over the faces
|
// Example: Two children are distributed arbitrarily over the faces
|
||||||
|
@ -216,19 +216,19 @@ function _unique_groups(m) = [
|
||||||
// color("red") sphere(r=.1);
|
// color("red") sphere(r=.1);
|
||||||
// color("green") sphere(r=.1);
|
// color("green") sphere(r=.1);
|
||||||
// }
|
// }
|
||||||
// Example(): Difference the children from the polyhedron; children depend on $faceindex
|
// Example(FlatSpin): Difference the children from the polyhedron; children depend on $faceindex
|
||||||
// difference(){
|
// difference(){
|
||||||
// regular_polyhedron("tetrahedron", side=25);
|
// regular_polyhedron("tetrahedron", side=25);
|
||||||
// regular_polyhedron("tetrahedron", side=25,draw=false)
|
// regular_polyhedron("tetrahedron", side=25,draw=false)
|
||||||
// down(.3) linear_extrude(height=1)
|
// down(.3) linear_extrude(height=1)
|
||||||
// text(str($faceindex),halign="center",valign="center");
|
// text(str($faceindex),halign="center",valign="center");
|
||||||
// }
|
// }
|
||||||
// Example: With `rotate_children` you can control direction of the children.
|
// Example(Big): With `rotate_children` you can control direction of the children.
|
||||||
// right(3)regular_polyhedron( name="tetrahedron", anchor=UP,rotate_children=false)
|
// regular_polyhedron(name="tetrahedron", anchor=UP, rotate_children=true)
|
||||||
// cylinder(r=.1, h=.5);
|
// cylinder(r=.1, h=.5);
|
||||||
// regular_polyhedron( name="tetrahedron", anchor=UP,rotate_children=true)
|
// right(2) regular_polyhedron(name="tetrahedron", anchor=UP, rotate_children=false)
|
||||||
// cylinder(r=.1, h=.5);
|
// cylinder(r=.1, h=.5);
|
||||||
// Example: Using `$face` you can have full control of the construction of your children. This example constructs the Great Icosahedron.
|
// Example(FlatSpin,Med): Using `$face` you can have full control of the construction of your children. This example constructs the Great Icosahedron.
|
||||||
// module makestar(pts) { // Make a star from a point list
|
// module makestar(pts) { // Make a star from a point list
|
||||||
// polygon(
|
// polygon(
|
||||||
// [
|
// [
|
||||||
|
@ -243,7 +243,7 @@ function _unique_groups(m) = [
|
||||||
// }
|
// }
|
||||||
// regular_polyhedron("dodecahedron", side=1, repeat=true)
|
// regular_polyhedron("dodecahedron", side=1, repeat=true)
|
||||||
// linear_extrude(scale=0, height=sqrt((5+2*sqrt(5))/5)) makestar($face);
|
// linear_extrude(scale=0, height=sqrt((5+2*sqrt(5))/5)) makestar($face);
|
||||||
// Example: The spheres are all radius 1 and the octahedra are sized to match the in-sphere, mid-sphere and out-sphere. The sphere size is slightly adjusted for the in-sphere and out-sphere so you can see the relationship: the sphere is tangent to the faces for the former and the corners poke out for the latter. Note also the difference in the size of the three octahedra.
|
// Example(Med): The spheres are all radius 1 and the octahedra are sized to match the in-sphere, mid-sphere and out-sphere. The sphere size is slightly adjusted for the in-sphere and out-sphere so you can see the relationship: the sphere is tangent to the faces for the former and the corners poke out for the latter. Note also the difference in the size of the three octahedra.
|
||||||
// sphere(r=1.005);
|
// sphere(r=1.005);
|
||||||
// %regular_polyhedron("octahedron", ir=1, facedown=false);
|
// %regular_polyhedron("octahedron", ir=1, facedown=false);
|
||||||
// right(3.5) {
|
// right(3.5) {
|
||||||
|
@ -254,7 +254,7 @@ function _unique_groups(m) = [
|
||||||
// %sphere(r=.95); // Slightly undersized sphere means the points poke out a bit
|
// %sphere(r=.95); // Slightly undersized sphere means the points poke out a bit
|
||||||
// regular_polyhedron("octahedron", or=1,facedown=false);
|
// regular_polyhedron("octahedron", or=1,facedown=false);
|
||||||
// }
|
// }
|
||||||
// Example: For the Archimdean solids the in-sphere does not touch all of the faces, as shown by this example, but the circumscribed sphere meets every vertex. (This explains the problem for rounding over these solids because the rounding method uses the in-sphere.)
|
// Example(Med): For the Archimdean solids the in-sphere does not touch all of the faces, as shown by this example, but the circumscribed sphere meets every vertex. (This explains the problem for rounding over these solids because the rounding method uses the in-sphere.)
|
||||||
// sphere(r=1.005);
|
// sphere(r=1.005);
|
||||||
// %regular_polyhedron("snub dodecahedron", ir=1, facedown=false);
|
// %regular_polyhedron("snub dodecahedron", ir=1, facedown=false);
|
||||||
// right(3) {
|
// right(3) {
|
||||||
|
@ -265,7 +265,7 @@ function _unique_groups(m) = [
|
||||||
// %sphere(r=.99);
|
// %sphere(r=.99);
|
||||||
// regular_polyhedron("snub dodecahedron", or=1,facedown=false);
|
// regular_polyhedron("snub dodecahedron", or=1,facedown=false);
|
||||||
// }
|
// }
|
||||||
// Example: For a Catalan solid the in-sphere touches every face but the circumscribed sphere only touches some vertices.
|
// Example(Med): For a Catalan solid the in-sphere touches every face but the circumscribed sphere only touches some vertices.
|
||||||
// sphere(r=1.002);
|
// sphere(r=1.002);
|
||||||
// %regular_polyhedron("pentagonal hexecontahedron", ir=1, facedown=false);
|
// %regular_polyhedron("pentagonal hexecontahedron", ir=1, facedown=false);
|
||||||
// right(3) {
|
// right(3) {
|
||||||
|
@ -546,20 +546,45 @@ _stellated_polyhedra_ = [
|
||||||
// Usage: regular_polyhedron_info(info, ....)
|
// Usage: regular_polyhedron_info(info, ....)
|
||||||
//
|
//
|
||||||
// Description:
|
// Description:
|
||||||
// Calculate characteristics of regular polyhedra or the selection set for regular_polyhedron(). Invoke with the same
|
// Calculate characteristics of regular polyhedra or the selection set for regular_polyhedron().
|
||||||
// arguments used by regular_polyhedron() and use the `info` argument to request the desired return value. Set `info` to:
|
// Invoke with the same arguments used by regular_polyhedron() and use the `info` argument to
|
||||||
// * "vertices": vertex list for the selected polyhedron
|
// request the desired return value. Set `info` to:
|
||||||
// * "faces": list of faces for the selected polyhedron, where each entry on the list is a list of point index values to be used with the vertex list
|
// * `"vertices"`: vertex list for the selected polyhedron
|
||||||
// * "face normals": list of normal vectors for each face
|
// * `"faces"`: list of faces for the selected polyhedron, where each entry on the list is a list of point index values to be used with the vertex list
|
||||||
// * "in_radius": in-sphere radius for the selected polyhedron
|
// * `"face normals"`: list of normal vectors for each face
|
||||||
// * "mid_radius": mid-sphere radius for the selected polyhedron
|
// * `"in_radius"`: in-sphere radius for the selected polyhedron
|
||||||
// * "out_radius": circumscribed sphere radius for the selected polyhedron
|
// * `"mid_radius"`: mid-sphere radius for the selected polyhedron
|
||||||
// * "index set": index set selected by your specifications; use its length to determine the valid range for `index`.
|
// * `"out_radius"`: circumscribed sphere radius for the selected polyhedron
|
||||||
// * "face vertices": number of vertices on the faces of the selected polyhedron (always a list)
|
// * `"index set"`: index set selected by your specifications; use its length to determine the valid range for `index`.
|
||||||
// * "edge length": length of the smallest edge of the selected polyhedron
|
// * `"face vertices"`: number of vertices on the faces of the selected polyhedron (always a list)
|
||||||
// * "center": center for the polyhedron
|
// * `"edge length"`: length of the smallest edge of the selected polyhedron
|
||||||
// * "type": polyhedron type, one of "platonic", "archimedean", "catalan", or "trapezohedron"
|
// * `"center"`: center for the polyhedron
|
||||||
// * "name": name of selected polyhedron
|
// * `"type"`: polyhedron type, one of "platonic", "archimedean", "catalan", or "trapezohedron"
|
||||||
|
// * `"name"`: name of selected polyhedron
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// name = Name of polyhedron to create.
|
||||||
|
// index = Index to select from polyhedron list. Default: 0.
|
||||||
|
// type = Type of polyhedron: "platonic", "archimedean", "catalan".
|
||||||
|
// faces = Number of faces.
|
||||||
|
// facetype = Scalar or vector listing required type of faces as vertex count. Polyhedron must have faces of every type listed and no other types.
|
||||||
|
// hasfaces = Scalar of vector list face vertex counts. Polyhedron must have at least one of the listed types of face.
|
||||||
|
// side = Length of the smallest edge of the polyhedron. Default: 1.
|
||||||
|
// ir = inner radius. Polyhedron is scaled so it has the specified inner radius. Overrides side.
|
||||||
|
// mr = middle radius. Polyhedron is scaled so it has the specified middle radius. Overrides side.
|
||||||
|
// or = outer radius. Polyhedron is scaled so it has the specified outer radius. Overrides side.
|
||||||
|
// r = outer radius. Overrides or.
|
||||||
|
// d = outer diameter. Overrides or.
|
||||||
|
// anchor = Side of the origin to anchor to. The bounding box of the polyhedron is aligned as specified. Use directional constants from `constants.scad`. Default: `CENTER`
|
||||||
|
// center = If given, overrides `anchor`. A true value sets `anchor=CENTER`, false sets `anchor=UP+BACK+RIGHT`.
|
||||||
|
// facedown = If false display the solid in native orientation. If true orient it with a largest face down. If set to a vertex count, orient it so a face with the specified number of vertices is down. Default: true.
|
||||||
|
// rounding = Specify a rounding radius for the shape. Note that depending on $fn the dimensions of the shape may have small dimensional errors.
|
||||||
|
// repeat = If true then repeat the children to fill all the faces. If false use only the available children and stop. Default: true.
|
||||||
|
// draw = If true then draw the polyhedron. If false, draw the children but not the polyhedron. Default: true.
|
||||||
|
// rotate_children = If true then orient children normal to their associated face. If false orient children to the parent coordinate system. Default: true.
|
||||||
|
// stellate = Set to a number to erect a pyramid on every face of your polyhedron with the specified height. The height is a multiple of the side length. Default: false.
|
||||||
|
// longside = Specify the long side length for a trapezohedron. Ignored for other shapes.
|
||||||
|
// h = Specify the height of the apex for a trapezohedron. Ignored for other shapes.
|
||||||
function regular_polyhedron_info(
|
function regular_polyhedron_info(
|
||||||
info=undef, name=undef,
|
info=undef, name=undef,
|
||||||
index=undef, type=undef,
|
index=undef, type=undef,
|
||||||
|
|
Loading…
Reference in a new issue