Polytope play made easy

Polytope play made easy

Description

Polygons And Polyhedrons Are The Most Powerful Shapes Available In Openscad. However, It Can Sometimes Be A Challenge To Construct Them Correctly. Consider This [Library] To Help You Construct And Work With Your [Polytopes].. ## [Tools] ## Module **Polytope_Number** (C, F, E, Vi=True, Fi=True, Ei=True, Sp=False, Ts, Th, To, Tr=0) * _Label The Vertices, Paths, And Edges Of A Polytope._ Module **Polytope_Frame** (C, F, E, Vi=True, Fi=True, Ei=True, Vc=1, Fc=2, Ec=0) * _Assemble A Polytope Skeletal Frame Using Child Objects._ Module **Polytope_Bbox (C, F, A)** * _The 3D Or 2D Bounding Box Shape For A Polytope._ ## [Math Functions] ## Function **Polytope_Faces2Edges** (F) * _List The Edge Coordinate Index Pairs Of A Polytope._ Function **Polytope_Limits** (C, F, A, D=[0:2], S=True) * _Determine The Bounding Limits Of A Polytope._ Function **Polytope_Bbox_Pf** (C, F, A) * _Generate A Bounding Box Polytope For Another Polytope In 3D Or 2D._ Function **Polytope_Line** (C, F, E, I, L, R=False) * _Get A Line From An Edge Or Any Two Vetices Of A Polytope._ Function **Polytope_Vertex_Av** (F, I) * _List The Adjacent Vertices For A Given Polytope Vertex._ Function **Polytope_Vertex_Af** (F, I) * _List The Adjacent Face Indexes For A Polytope Vertex._ Function **Polytope_Edge_Af** (F, E, I) * _List The Adjacent Face Indexes For A Polytope Edge._ Function **Polytope_Vertex_N** (C, F, I) * _Get A Normal Vector For A Polytope Vertex._ Function **Polytope_Edge_N** (C, F, E, I) * _Get A Normal Vector For A Polytope Edge._ Function **Polytope_Face_N** (C, F, I, L, Cw=True) * _Get The Normal Vector Of A Polytope Face._ Function **Polytope_Face_M** (C, F, I, L) * _Get The Mean Coordinate Of All Vertices Of A Polytope Face._ Function **Polytope_Face_Mn** (C, F, I, L, Cw=True) * _Get The Mean Coordinate And Normal Vector Of A Polytope Face._ Function **Polytope_Plane** (C, F, I, L, Cw=True) * _Get A Plane For A Polytope Face._ Function **Polytope_Face_Vcounts** (F) * _List The Vertex Counts For All Polytope Faces._ Function **Polytope_Face_Angles** (C, F) * _List The Angles Between All Adjacent Faces Of A Polyhedron._ Function **Polytope_Edge_Lengths** (C, E) * _List The Edge Lengths Of A Polytope._ Function **Polytope_Edge_Angles** (C, F) * _List The Adjacent Edge Angles For Each Polytope Vertex._ Function **Polytope_Faces_Are_Regular** (C, F, E, D=6) * _Test If The Faces Of A Polytope Are All Regular._ Function **Polytope_Triangulate_Ft** (F) * _Triangulate The Faces Of A Convex Polytope Using Fan Triangulation._ Function **Polygod2D_Perimeter** (C, P) * _Calculate The Perimeter Length Of A Polygon In 2D._ Function **Polygod2D_Area** (C, P, S=False) * _Compute The Signed Area Of A Polygon In A Euclidean 2D-Space._ Function **Polygod3D_Area** (C, P, N) * _Compute The Area Of A Polygon In A Euclidean 3D-Space._ Function **Polygod2D_Centroid** (C, P) * _Compute The Center Of Mass Of A Polygon In A Euclidean 2D-Space._ Function **Polygod2D_Is_Cw** (C, P) * _Test The Vertex Ordering Of A Polygon In A Euclidean 2D-Space._ Function **Polygod2D_Is_Convex** (C, P) * _Test The Convexity Of A Polygon In A Euclidean 2D-Space._ Function **Polygod2D_Winding** (C, P, T) * _Compute The Winding Number Of A Polygon About A Point In A Euclidean 2D-Space._ Function **Polygod2D_Is_Pip_Wn** (C, P, T) * _Test If A Point Is Inside A Polygon In A Euclidean 2D-Space Using Winding Number._ Function **Polygod2D_Is_Pip_As** (C, P, T) * _Test If A Point Is Inside A Polygon In A Euclidean 2D-Space Using Angle Summation._ Function **Polyhedron_Area** (C, F) * _Compute The Surface Area Of A Polyhedron In A Euclidean 3D-Space._ Function **Polyhedron_Volume_Tf** (C, F) * _Compute The Volume Of A Triangulated Polyhedron In A Euclidean 3D-Space._ Function **Polyhedron_Centroid_Tf** (C, F) * _Compute The Center Of Mass Of A Triangulated Polyhedron In A Euclidean 3D-Space._ Function **Linear_Extrude_Pp2Pf** (C, P, H=1, Centroid=False, Center=False) * _Convert A Polygon To A Polyhedron By Adding A Height Dimension._ ## Examples ## #### Numbering #### ``` Include <Omdl-V0.6.1/Omdl-Base.Scad>; Include <Omdl-V0.6.1/Database/Geometry/Polyhedra/Johnson.Scad>; Tc = Dtc_Polyhedra_Johnson; Tr = Dtr_Polyhedra_Johnson; Id = "Metagyrate_Diminished_Rhombicosidodecahedron"; C = Get_Table_V(Tr, Tc, Id, "C"); F = Get_Table_V(Tr, Tc, Id, "F"); V = Coordinates_Csc(C, 100); Polytope_Number(V, F, Sp=True); ``` #### Framing #### ``` Include <Omdl-V0.6.1/Omdl-Base.Scad>; Include <Omdl-V0.6.1/Database/Geometry/Polyhedra/Cupolas.Scad>; Tc = Dtc_Polyhedra_Cupolas; Tr = Dtr_Polyhedra_Cupolas; Id = "Pentagonal_Cupola"; C = Get_Table_V(Tr, Tc, Id, "C"); F = Get_Table_V(Tr, Tc, Id, "F"); V1 = Coordinates_Csc(C, 100); V2 = Coordinates_Csc(C, 100, True); Grid_Repeat(2, 225, Center=True) { Polytope_Frame(V1, F) {Circle(R=4); Color("Grey") Sphere(R=6);} Polytope_Frame(V2, F) {Circle(R=4); Color("Grey") Sphere(R=6);} } ``` #### Shapes On Edge, Vertex, Face #### ``` Include <Omdl-V0.6.1/Omdl-Base.Scad>; Include <Omdl-V0.6.1/Database/Geometry/Polyhedra/Archimedean.Scad>; Tc = Dtc_Polyhedra_Archimedean; Tr = Dtr_Polyhedra_Archimedean; Id = "Truncated_Cuboctahedron"; C = Get_Table_V(Tr, Tc, Id, "C"); F = Get_Table_V(Tr, Tc, Id, "F"); V = Coordinates_Csc(C, 100); Polytope_Frame(V, F, Fi="Even") { Circle(R=2); Color("Grey") Sphere(R=4); Color("Red") Star3D(20); } Polytope_Frame(V, F, Fi="Odd", Fc=0, Vc=-1, Ec=-1) Color("Blue") Star3D(20); Polyhedron(V, F); ``` # Omdl # This Design Uses [Omdl]. To Render The Design, This Library Must Be Available. More Information Is Available In [Omdl On Thingiverse]. To Install [Omdl] Open A Bash Shell And Type: ``` $ Mkdir Tmp && Cd Tmp $ Wget Https://Git.Io/Setup-Omdl.Bash $ Chmod +X Setup-Omdl.Bash $ ./Setup-Omdl.Bash --Branch V0.6.1 --Yes --Install ``` [Tools]: Http://Www.Thingiverse.Com/Thing:1934498 [Math Functions]: Http://Www.Thingiverse.Com/Thing:1934498 [Omdl]: Https://Royasutton.Github.Io/Omdl [Thing]: Http://Www.Thingiverse.Com/Thing:1934498 [Library]: Http://Www.Thingiverse.Com/Thing:1934498 [Omdl On Thingiverse]: Http://Www.Thingiverse.Com/Thing:1934498 [Polytopes]: Https://En.Wikipedia.Org/Wiki/Polytope

Statistics

Likes

8

Downloads

0

Category

Math