From: ozmikepittman Date: Fri, 16 May 2008 02:57:01 +0000 (+0000) Subject: Adding extension Effects->Render->3D Polyhedron by inductiveload - see LP #230478 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5ebc6b4949d9f7aea914640d3e27e0a67e23ba8d;p=inkscape.git Adding extension Effects->Render->3D Polyhedron by inductiveload - see LP #230478 --- diff --git a/po/POTFILES.in b/po/POTFILES.in index 5ea99dc81..fbda23fb3 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -371,6 +371,7 @@ src/winmain.cpp [type: gettext/xml] share/extensions/pathscatter.inx [type: gettext/xml] share/extensions/perfectboundcover.inx [type: gettext/xml] share/extensions/perspective.inx +[type: gettext/xml] share/extensions/polyhedron_3D.inx [type: gettext/xml] share/extensions/ps_input.inx [type: gettext/xml] share/extensions/radiusrand.inx [type: gettext/xml] share/extensions/render_alphabetsoup.inx diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 4544b0866..62fa9eeda 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -2,6 +2,7 @@ SUBDIRS = \ alphabet_soup \ Barcode \ + Poly3DObjects \ xaml2svg extensiondir = $(datadir)/inkscape/extensions @@ -73,6 +74,7 @@ extensions = \ pathmodifier.py\ perfectboundcover.py \ perspective.py \ + polyhedron_3d.py \ ps2dxf.sh \ ps2epsi.sh \ ps2pdf.cmd \ @@ -186,6 +188,7 @@ modules = \ pdf_output_via_gs_on_win32.inx.txt \ perfectboundcover.inx \ perspective.inx \ + polyhedron_3d.inx \ ps_input.inx \ radiusrand.inx \ render_barcode.inx \ diff --git a/share/extensions/Poly3DObjects/cube.obj b/share/extensions/Poly3DObjects/cube.obj new file mode 100644 index 000000000..ed249d456 --- /dev/null +++ b/share/extensions/Poly3DObjects/cube.obj @@ -0,0 +1,19 @@ +#Name:Cube +#Type:Face-specified +#Direction:Clockwise + +v -0.5 -0.5 -0.5 +v -0.5 -0.5 0.5 +v -0.5 0.5 -0.5 +v -0.5 0.5 0.5 +v 0.5 -0.5 -0.5 +v 0.5 -0.5 0.5 +v 0.5 0.5 -0.5 +v 0.5 0.5 0.5 + +f 8 4 2 6 +f 8 6 5 7 +f 8 7 3 4 +f 4 3 1 2 +f 1 3 7 5 +f 2 1 5 6 \ No newline at end of file diff --git a/share/extensions/Poly3DObjects/cuboct.obj b/share/extensions/Poly3DObjects/cuboct.obj new file mode 100644 index 000000000..030743f92 --- /dev/null +++ b/share/extensions/Poly3DObjects/cuboct.obj @@ -0,0 +1,30 @@ +#Name:Cuboctahedron +#Type:Face_specified + +v -1. 0 0 +v -0.5 -0.5 -0.70710678 +v -0.5 -0.5 0.70710678 +v -0.5 0.5 -0.70710678 +v -0.5 0.5 0.70710678 +v 0 -1. 0 +v 0 1. 0 +v 0.5 -0.5 -0.70710678 +v 0.5 -0.5 0.70710678 +v 0.5 0.5 -0.70710678 +v 0.5 0.5 0.70710678 +v 1. 0 0 + +f 12 11 9 +f 3 5 1 +f 6 9 3 +f 5 11 7 +f 8 10 12 +f 1 4 2 +f 2 8 6 +f 7 10 4 +f 4 10 8 2 +f 3 9 11 5 +f 9 6 8 12 +f 3 1 2 6 +f 5 7 4 1 +f 11 12 10 7 diff --git a/share/extensions/Poly3DObjects/dodec.obj b/share/extensions/Poly3DObjects/dodec.obj new file mode 100644 index 000000000..823f53911 --- /dev/null +++ b/share/extensions/Poly3DObjects/dodec.obj @@ -0,0 +1,36 @@ +#NameDodecahedron +#Type:Face_specified + +v 0 0 1.4012585 +v 0 0 -1.4012585 +v 0.17841104 -1.3090170 0.46708618 +v 0.17841104 1.3090170 0.46708618 +v 0.46708618 -0.80901699 -1.0444364 +v 0.46708618 0.80901699 -1.0444364 +v 1.0444364 -0.80901699 0.46708618 +v 1.0444364 0.80901699 0.46708618 +v -1.2228475 -0.5 0.46708618 +v -1.2228475 0.5 0.46708618 +v 1.2228475 -0.5 -0.46708618 +v 1.2228475 0.5 -0.46708618 +v -0.93417236 0 -1.0444364 +v -0.46708618 -0.80901699 1.0444364 +v -0.46708618 0.80901699 1.0444364 +v 0.93417236 0 1.0444364 +v -1.0444364 -0.80901699 -0.46708618 +v -1.0444364 0.80901699 -0.46708618 +v -0.17841104 -1.3090170 -0.46708618 +v -0.17841104 1.3090170 -0.46708618 + +f 15 10 9 14 1 +f 2 6 12 11 5 +f 5 11 7 3 19 +f 11 12 8 16 7 +f 12 6 20 4 8 +f 6 2 13 18 20 +f 2 5 19 17 13 +f 4 20 18 10 15 +f 18 13 17 9 10 +f 17 19 3 14 9 +f 3 7 16 1 14 +f 16 8 4 15 1 diff --git a/share/extensions/Poly3DObjects/great_dodec.obj b/share/extensions/Poly3DObjects/great_dodec.obj new file mode 100644 index 000000000..8feac9c6c --- /dev/null +++ b/share/extensions/Poly3DObjects/great_dodec.obj @@ -0,0 +1,96 @@ +#Name:Great Dodecahedron +#Type:Face_specified + +v 0. 0. -0.951057 +v 0. 0. 0.951057 +v -0.425325 -0.309017 -0.100406 +v -0.425325 0.309017 -0.100406 +v 0.425325 -0.309017 0.100406 +v 0.425325 0.309017 0.100406 +v -0.688191 -0.5 0.425325 +v -0.688191 0.5 0.425325 +v 0.688191 -0.5 -0.425325 +v 0.688191 0.5 -0.425325 +v -0.850651 0. -0.425325 +v 0.850651 0. 0.425325 +v -0.100406 -0.309017 0.425325 +v -0.100406 0.309017 0.425325 +v 0.100406 -0.309017 -0.425325 +v 0.100406 0.309017 -0.425325 +v -0.32492 0. 0.425325 +v -0.16246 -0.5 0.100406 +v -0.16246 0.5 0.100406 +v 0.16246 -0.5 -0.100406 +v 0.16246 0.5 -0.100406 +v 0.32492 0. -0.425325 +v -0.525731 0. 0.100406 +v -0.262866 -0.809017 -0.425325 +v -0.262866 0.190983 -0.425325 +v -0.262866 -0.190983 -0.425325 +v -0.262866 0.809017 -0.425325 +v 0.262866 -0.809017 0.425325 +v 0.262866 0.190983 0.425325 +v 0.262866 -0.190983 0.425325 +v 0.262866 0.809017 0.425325 +v 0.525731 0. -0.100406 + +f 14 2 31 +f 14 31 8 +f 14 8 2 +f 17 2 8 +f 17 8 7 +f 17 7 2 +f 13 2 7 +f 13 7 28 +f 13 28 2 +f 30 2 28 +f 30 28 12 +f 30 12 2 +f 29 2 12 +f 29 12 31 +f 29 31 2 +f 15 9 24 +f 15 24 1 +f 15 1 9 +f 22 10 9 +f 22 9 1 +f 22 1 10 +f 16 27 10 +f 16 10 1 +f 16 1 27 +f 25 11 27 +f 25 27 1 +f 25 1 11 +f 26 24 11 +f 26 11 1 +f 26 1 24 +f 19 31 27 +f 19 27 8 +f 19 8 31 +f 23 8 11 +f 23 11 7 +f 23 7 8 +f 18 7 24 +f 18 24 28 +f 18 28 7 +f 5 28 9 +f 5 9 12 +f 5 12 28 +f 6 12 10 +f 6 10 31 +f 6 31 12 +f 20 9 28 +f 20 28 24 +f 20 24 9 +f 32 10 12 +f 32 12 9 +f 32 9 10 +f 21 27 31 +f 21 31 10 +f 21 10 27 +f 4 11 8 +f 4 8 27 +f 4 27 11 +f 3 24 7 +f 3 7 11 +f 3 11 24 diff --git a/share/extensions/Poly3DObjects/great_rhombicosidodec.obj b/share/extensions/Poly3DObjects/great_rhombicosidodec.obj new file mode 100644 index 000000000..7dffdd757 --- /dev/null +++ b/share/extensions/Poly3DObjects/great_rhombicosidodec.obj @@ -0,0 +1,185 @@ +#Name:Great Rhombicosidodecahedron +#Type:face_specified +v -1. -1.30902 -3.42705 +v -1. -1.30902 3.42705 +v -1. 1.30902 -3.42705 +v -1. 1.30902 3.42705 +v -0.5 -0.5 -3.73607 +v -0.5 -0.5 3.73607 +v -0.5 0.5 -3.73607 +v -0.5 0.5 3.73607 +v -0.5 -3.73607 -0.5 +v -0.5 -3.73607 0.5 +v -0.5 -2.11803 -3.11803 +v -0.5 -2.11803 3.11803 +v -0.5 3.73607 -0.5 +v -0.5 3.73607 0.5 +v -0.5 2.11803 -3.11803 +v -0.5 2.11803 3.11803 +v 0.5 -0.5 -3.73607 +v 0.5 -0.5 3.73607 +v 0.5 0.5 -3.73607 +v 0.5 0.5 3.73607 +v 0.5 -3.73607 -0.5 +v 0.5 -3.73607 0.5 +v 0.5 -2.11803 -3.11803 +v 0.5 -2.11803 3.11803 +v 0.5 3.73607 -0.5 +v 0.5 3.73607 0.5 +v 0.5 2.11803 -3.11803 +v 0.5 2.11803 3.11803 +v 1. -1.30902 -3.42705 +v 1. -1.30902 3.42705 +v 1. 1.30902 -3.42705 +v 1. 1.30902 3.42705 +v -3.42705 -1. -1.30902 +v -3.42705 -1. 1.30902 +v -3.42705 1. -1.30902 +v -3.42705 1. 1.30902 +v -2.92705 -1.80902 -1.61803 +v -2.92705 -1.80902 1.61803 +v -2.92705 1.80902 -1.61803 +v -2.92705 1.80902 1.61803 +v -1.80902 -1.61803 -2.92705 +v -1.80902 -1.61803 2.92705 +v -1.80902 1.61803 -2.92705 +v -1.80902 1.61803 2.92705 +v -1.30902 -3.42705 -1. +v -1.30902 -3.42705 1. +v -1.30902 -2.42705 -2.61803 +v -1.30902 -2.42705 2.61803 +v -1.30902 2.42705 -2.61803 +v -1.30902 2.42705 2.61803 +v -1.30902 3.42705 -1. +v -1.30902 3.42705 1. +v -2.61803 -1.30902 -2.42705 +v -2.61803 -1.30902 2.42705 +v -2.61803 1.30902 -2.42705 +v -2.61803 1.30902 2.42705 +v -3.73607 -0.5 -0.5 +v -3.73607 -0.5 0.5 +v -3.73607 0.5 -0.5 +v -3.73607 0.5 0.5 +v -1.61803 -2.92705 -1.80902 +v -1.61803 -2.92705 1.80902 +v -1.61803 2.92705 -1.80902 +v -1.61803 2.92705 1.80902 +v -3.11803 -0.5 -2.11803 +v -3.11803 -0.5 2.11803 +v -3.11803 0.5 -2.11803 +v -3.11803 0.5 2.11803 +v -2.11803 -3.11803 -0.5 +v -2.11803 -3.11803 0.5 +v -2.11803 3.11803 -0.5 +v -2.11803 3.11803 0.5 +v -2.42705 -2.61803 -1.30902 +v -2.42705 -2.61803 1.30902 +v -2.42705 2.61803 -1.30902 +v -2.42705 2.61803 1.30902 +v 1.61803 -2.92705 -1.80902 +v 1.61803 -2.92705 1.80902 +v 1.61803 2.92705 -1.80902 +v 1.61803 2.92705 1.80902 +v 2.42705 -2.61803 -1.30902 +v 2.42705 -2.61803 1.30902 +v 2.42705 2.61803 -1.30902 +v 2.42705 2.61803 1.30902 +v 3.73607 -0.5 -0.5 +v 3.73607 -0.5 0.5 +v 3.73607 0.5 -0.5 +v 3.73607 0.5 0.5 +v 2.11803 -3.11803 -0.5 +v 2.11803 -3.11803 0.5 +v 2.11803 3.11803 -0.5 +v 2.11803 3.11803 0.5 +v 1.30902 -3.42705 -1. +v 1.30902 -3.42705 1. +v 1.30902 -2.42705 -2.61803 +v 1.30902 -2.42705 2.61803 +v 1.30902 2.42705 -2.61803 +v 1.30902 2.42705 2.61803 +v 1.30902 3.42705 -1. +v 1.30902 3.42705 1. +v 2.61803 -1.30902 -2.42705 +v 2.61803 -1.30902 2.42705 +v 2.61803 1.30902 -2.42705 +v 2.61803 1.30902 2.42705 +v 3.11803 -0.5 -2.11803 +v 3.11803 -0.5 2.11803 +v 3.11803 0.5 -2.11803 +v 3.11803 0.5 2.11803 +v 1.80902 -1.61803 -2.92705 +v 1.80902 -1.61803 2.92705 +v 1.80902 1.61803 -2.92705 +v 1.80902 1.61803 2.92705 +v 2.92705 -1.80902 -1.61803 +v 2.92705 -1.80902 1.61803 +v 2.92705 1.80902 -1.61803 +v 2.92705 1.80902 1.61803 +v 3.42705 -1. -1.30902 +v 3.42705 -1. 1.30902 +v 3.42705 1. -1.30902 +v 3.42705 1. 1.30902 + +f 2 6 8 4 44 56 68 66 54 42 +f 109 29 17 19 31 111 103 107 105 101 +f 24 30 18 6 2 12 +f 7 3 15 27 31 19 +f 58 57 33 37 73 69 70 74 38 34 +f 84 116 120 88 87 119 115 83 91 92 +f 90 89 81 113 117 85 86 118 114 82 +f 36 40 76 72 71 75 39 35 59 60 +f 5 17 29 23 11 1 +f 4 8 20 32 28 16 +f 67 55 43 3 7 5 1 41 53 65 +f 18 30 110 102 106 108 104 112 32 20 +f 79 83 115 103 111 97 +f 38 74 62 48 42 54 +f 4 16 50 44 +f 23 29 109 95 +f 96 110 30 24 +f 43 49 15 3 +f 53 41 47 61 73 37 +f 98 112 104 116 84 80 +f 69 45 9 10 46 70 +f 26 100 92 91 99 25 +f 82 114 102 110 96 78 +f 55 39 75 63 49 43 +f 1 11 47 41 +f 28 32 112 98 +f 61 47 11 23 95 77 93 21 9 45 +f 50 16 28 98 80 100 26 14 52 64 +f 97 111 31 27 +f 42 48 12 2 +f 44 50 64 76 40 56 +f 77 95 109 101 113 81 +f 63 51 13 25 99 79 97 27 15 49 +f 46 10 22 94 78 96 24 12 48 62 +f 52 14 13 51 71 72 +f 22 21 93 89 90 94 +f 115 119 107 103 +f 34 38 54 66 +f 71 51 63 75 +f 94 90 82 78 +f 114 118 106 102 +f 35 39 55 67 +f 70 46 62 74 +f 99 91 83 79 +f 65 53 37 33 +f 104 108 120 116 +f 77 81 89 93 +f 76 64 52 72 +f 59 35 67 65 33 57 +f 106 118 86 88 120 108 +f 68 56 40 36 +f 101 105 117 113 +f 80 84 92 100 +f 73 61 45 69 +f 34 66 68 36 60 58 +f 105 107 119 87 85 117 +f 7 19 17 5 +f 6 18 20 8 +f 14 26 25 13 +f 9 21 22 10 +f 58 60 59 57 +f 85 87 88 86 diff --git a/share/extensions/Poly3DObjects/great_rhombicuboct.obj b/share/extensions/Poly3DObjects/great_rhombicuboct.obj new file mode 100644 index 000000000..eb9bdb714 --- /dev/null +++ b/share/extensions/Poly3DObjects/great_rhombicuboct.obj @@ -0,0 +1,77 @@ +#Name:Great Rhombicuboctahedron +#Type:face_specified +v -0.5 1.20711 -1.91421 +v -0.5 1.20711 1.91421 +v -0.5 -1.20711 -1.91421 +v -0.5 -1.20711 1.91421 +v -0.5 -1.91421 1.20711 +v -0.5 -1.91421 -1.20711 +v -0.5 1.91421 1.20711 +v -0.5 1.91421 -1.20711 +v 0.5 1.20711 -1.91421 +v 0.5 1.20711 1.91421 +v 0.5 -1.20711 -1.91421 +v 0.5 -1.20711 1.91421 +v 0.5 -1.91421 1.20711 +v 0.5 -1.91421 -1.20711 +v 0.5 1.91421 1.20711 +v 0.5 1.91421 -1.20711 +v 1.20711 -0.5 -1.91421 +v 1.20711 -0.5 1.91421 +v 1.20711 0.5 -1.91421 +v 1.20711 0.5 1.91421 +v 1.20711 -1.91421 -0.5 +v 1.20711 -1.91421 0.5 +v 1.20711 1.91421 -0.5 +v 1.20711 1.91421 0.5 +v -1.20711 -0.5 -1.91421 +v -1.20711 -0.5 1.91421 +v -1.20711 0.5 -1.91421 +v -1.20711 0.5 1.91421 +v -1.20711 -1.91421 -0.5 +v -1.20711 -1.91421 0.5 +v -1.20711 1.91421 -0.5 +v -1.20711 1.91421 0.5 +v -1.91421 -0.5 1.20711 +v -1.91421 -0.5 -1.20711 +v -1.91421 0.5 1.20711 +v -1.91421 0.5 -1.20711 +v -1.91421 1.20711 -0.5 +v -1.91421 1.20711 0.5 +v -1.91421 -1.20711 -0.5 +v -1.91421 -1.20711 0.5 +v 1.91421 -0.5 1.20711 +v 1.91421 -0.5 -1.20711 +v 1.91421 0.5 1.20711 +v 1.91421 0.5 -1.20711 +v 1.91421 1.20711 -0.5 +v 1.91421 1.20711 0.5 +v 1.91421 -1.20711 -0.5 +v 1.91421 -1.20711 0.5 + +f 44 42 17 19 +f 14 6 3 11 +f 34 36 27 25 +f 8 16 9 1 +f 20 18 41 43 +f 12 4 5 13 +f 26 28 35 33 +f 2 10 15 7 +f 45 23 24 46 +f 39 29 30 40 +f 48 22 21 47 +f 38 32 31 37 +f 9 19 17 11 3 25 27 1 +f 2 28 26 4 12 18 20 10 +f 41 48 47 42 44 45 46 43 +f 35 38 37 36 34 39 40 33 +f 15 24 23 16 8 31 32 7 +f 5 30 29 6 14 21 22 13 +f 46 24 15 10 20 43 +f 35 28 2 7 32 38 +f 41 18 12 13 22 48 +f 40 30 5 4 26 33 +f 44 19 9 16 23 45 +f 37 31 8 1 27 36 +f 47 21 14 11 17 42 +f 34 25 3 6 29 39 diff --git a/share/extensions/Poly3DObjects/great_stel_dodec.obj b/share/extensions/Poly3DObjects/great_stel_dodec.obj new file mode 100644 index 000000000..443abd5aa --- /dev/null +++ b/share/extensions/Poly3DObjects/great_stel_dodec.obj @@ -0,0 +1,96 @@ +#Name:Great Stellated Dodecahedron +#Type:face_specified + +v 0. 0. -0.951057 +v 0. 0. 0.951057 +v -0.425325 -1.30902 1.80171 +v -0.425325 1.30902 1.80171 +v 0.425325 -1.30902 -1.80171 +v 0.425325 1.30902 -1.80171 +v -0.688191 -0.5 0.425325 +v -0.688191 0.5 0.425325 +v -0.688191 -2.11803 0.425325 +v -0.688191 2.11803 0.425325 +v 0.688191 -0.5 -0.425325 +v 0.688191 0.5 -0.425325 +v 0.688191 -2.11803 -0.425325 +v 0.688191 2.11803 -0.425325 +v -0.850651 0. -0.425325 +v 0.850651 0. 0.425325 +v -1.11352 -0.809017 -1.80171 +v -1.11352 0.809017 -1.80171 +v 1.11352 -0.809017 1.80171 +v 1.11352 0.809017 1.80171 +v -1.80171 -1.30902 -0.425325 +v -1.80171 1.30902 -0.425325 +v 1.80171 -1.30902 0.425325 +v 1.80171 1.30902 0.425325 +v -2.22703 0. 0.425325 +v 2.22703 0. -0.425325 +v -0.262866 -0.809017 -0.425325 +v -0.262866 0.809017 -0.425325 +v 0.262866 -0.809017 0.425325 +v 0.262866 0.809017 0.425325 +v -1.37638 0. 1.80171 +v 1.37638 0. -1.80171 + +f 4 2 30 +f 4 30 8 +f 4 8 2 +f 31 2 8 +f 31 8 7 +f 31 7 2 +f 3 2 7 +f 3 7 29 +f 3 29 2 +f 19 2 29 +f 19 29 16 +f 19 16 2 +f 20 2 16 +f 20 16 30 +f 20 30 2 +f 5 11 27 +f 5 27 1 +f 5 1 11 +f 32 12 11 +f 32 11 1 +f 32 1 12 +f 6 28 12 +f 6 12 1 +f 6 1 28 +f 18 15 28 +f 18 28 1 +f 18 1 15 +f 17 27 15 +f 17 15 1 +f 17 1 27 +f 10 30 28 +f 10 28 8 +f 10 8 30 +f 25 8 15 +f 25 15 7 +f 25 7 8 +f 9 7 27 +f 9 27 29 +f 9 29 7 +f 23 29 11 +f 23 11 16 +f 23 16 29 +f 24 16 12 +f 24 12 30 +f 24 30 16 +f 13 11 29 +f 13 29 27 +f 13 27 11 +f 26 12 16 +f 26 16 11 +f 26 11 12 +f 14 28 30 +f 14 30 12 +f 14 12 28 +f 22 15 8 +f 22 8 28 +f 22 28 15 +f 21 27 7 +f 21 7 15 +f 21 15 27 diff --git a/share/extensions/Poly3DObjects/icos.obj b/share/extensions/Poly3DObjects/icos.obj new file mode 100644 index 000000000..d0e991a77 --- /dev/null +++ b/share/extensions/Poly3DObjects/icos.obj @@ -0,0 +1,36 @@ +#Name:Icosahedron +#Type:face_specified + +v 0 0 -0.95105652 +v 0 0 0.95105652 +v -0.85065081 0 -0.42532540 +v 0.85065081 0 0.42532540 +v 0.68819096 -0.50000000 -0.42532540 +v 0.68819096 0.50000000 -0.42532540 +v -0.68819096 -0.50000000 0.42532540 +v -0.68819096 0.50000000 0.42532540 +v -0.26286556 -0.80901699 -0.42532540 +v -0.26286556 0.80901699 -0.42532540 +v 0.26286556 -0.80901699 0.42532540 +v 0.26286556 0.80901699 0.42532540 + +f 2 12 8 +f 2 8 7 +f 2 7 11 +f 2 11 4 +f 2 4 12 +f 5 9 1 +f 6 5 1 +f 10 6 1 +f 3 10 1 +f 9 3 1 +f 12 10 8 +f 8 3 7 +f 7 9 11 +f 11 5 4 +f 4 6 12 +f 5 11 9 +f 6 4 5 +f 10 12 6 +f 3 8 10 +f 9 7 3 diff --git a/share/extensions/Poly3DObjects/icosidodec.obj b/share/extensions/Poly3DObjects/icosidodec.obj new file mode 100644 index 000000000..a7489219b --- /dev/null +++ b/share/extensions/Poly3DObjects/icosidodec.obj @@ -0,0 +1,65 @@ +#Name:Icosidodecahedron +#Type:face_specified +v 0. -1.61803 0. +v 0. 1.61803 0. +v 0.262866 -0.809017 -1.37638 +v 0.262866 0.809017 -1.37638 +v 0.425325 -1.30902 0.850651 +v 0.425325 1.30902 0.850651 +v 0.688191 -0.5 1.37638 +v 0.688191 0.5 1.37638 +v 1.11352 -0.809017 -0.850651 +v 1.11352 0.809017 -0.850651 +v -1.37638 0. -0.850651 +v -0.688191 -0.5 -1.37638 +v -0.688191 0.5 -1.37638 +v 1.37638 0. 0.850651 +v 0.951057 -1.30902 0. +v 0.951057 1.30902 0. +v 0.850651 0. -1.37638 +v -0.951057 -1.30902 0. +v -0.951057 1.30902 0. +v -1.53884 -0.5 0. +v -1.53884 0.5 0. +v 1.53884 -0.5 0. +v 1.53884 0.5 0. +v -0.850651 0. 1.37638 +v -1.11352 -0.809017 0.850651 +v -1.11352 0.809017 0.850651 +v -0.425325 -1.30902 -0.850651 +v -0.425325 1.30902 -0.850651 +v -0.262866 -0.809017 1.37638 +v -0.262866 0.809017 1.37638 + +f 30 24 29 7 8 +f 26 24 30 +f 25 29 24 +f 5 7 29 +f 14 8 7 +f 6 30 8 +f 16 2 6 +f 19 21 26 +f 20 18 25 +f 1 15 5 +f 22 23 14 +f 2 19 26 30 6 +f 21 20 25 24 26 +f 18 1 5 29 25 +f 15 22 14 7 5 +f 23 16 6 8 14 +f 12 13 4 17 3 +f 3 17 9 +f 17 4 10 +f 4 13 28 +f 13 12 11 +f 12 3 27 +f 27 1 18 +f 9 22 15 +f 10 16 23 +f 28 19 2 +f 11 20 21 +f 27 3 9 15 1 +f 9 17 10 23 22 +f 10 4 28 2 16 +f 28 13 11 21 19 +f 11 12 27 18 20 diff --git a/share/extensions/Poly3DObjects/jessens_orthog_icos.obj b/share/extensions/Poly3DObjects/jessens_orthog_icos.obj new file mode 100644 index 000000000..b08b2c4d1 --- /dev/null +++ b/share/extensions/Poly3DObjects/jessens_orthog_icos.obj @@ -0,0 +1,35 @@ +#Name:Jessen's Orthogonal Icosahedron +#Type:face_specified +v 0. -0.809017 0.5 +v 0. -0.809017 -0.5 +v 0. 0.809017 0.5 +v 0. 0.809017 -0.5 +v 0.5 0. -0.809017 +v 0.5 0. 0.809017 +v -0.5 0. -0.809017 +v -0.5 0. 0.809017 +v -0.809017 0.5 0. +v -0.809017 -0.5 0. +v 0.809017 0.5 0. +v 0.809017 -0.5 0. + +f 3 1 6 +f 6 1 12 +f 6 12 5 +f 11 3 6 +f 6 5 11 +f 12 1 10 +f 12 10 2 +f 5 12 2 +f 3 11 9 +f 1 3 8 +f 8 10 1 +f 7 2 10 +f 10 8 7 +f 3 9 8 +f 7 8 9 +f 5 2 4 +f 2 7 4 +f 7 9 4 +f 4 9 11 +f 5 4 11 \ No newline at end of file diff --git a/share/extensions/Poly3DObjects/methane.obj b/share/extensions/Poly3DObjects/methane.obj new file mode 100644 index 000000000..2a89979ab --- /dev/null +++ b/share/extensions/Poly3DObjects/methane.obj @@ -0,0 +1,13 @@ +#Name:Methane Molecule +#Type:edge_specified + +v 0 0 0 +v 0 0 0.61237244 +v -0.28867513 -0.50000000 -0.20412415 +v -0.28867513 0.50000000 -0.20412415 +v 0.57735027 0 -0.20412415 + +l 1 2 +l 1 3 +l 1 4 +l 1 5 diff --git a/share/extensions/Poly3DObjects/oct.obj b/share/extensions/Poly3DObjects/oct.obj new file mode 100644 index 000000000..3f98f6840 --- /dev/null +++ b/share/extensions/Poly3DObjects/oct.obj @@ -0,0 +1,17 @@ +#Name:Octahedron +#Type:face_specified +v -0.5 -0.5 0 +v -0.5 0.5 0 +v 0 0 -0.70710678 +v 0 0 0.70710678 +v 0.5 -0.5 0 +v 0.5 0.5 0 + +f 4 5 6 +f 4 6 2 +f 4 2 1 +f 4 1 5 +f 5 1 3 +f 5 3 6 +f 3 1 2 +f 6 3 2 diff --git a/share/extensions/Poly3DObjects/rh_axes.obj b/share/extensions/Poly3DObjects/rh_axes.obj new file mode 100644 index 000000000..23042c170 --- /dev/null +++ b/share/extensions/Poly3DObjects/rh_axes.obj @@ -0,0 +1,12 @@ +#Name:Right Handed Coordinate Axes +#Type:Edge_specified + +v 0 0 0 +v 1 0 0 +v 0 1 0 +v 0 0 1 + +l 1 2 +l 1 3 +l 1 4 + diff --git a/share/extensions/Poly3DObjects/rhomb_dodec.obj b/share/extensions/Poly3DObjects/rhomb_dodec.obj new file mode 100644 index 000000000..353c6e6c0 --- /dev/null +++ b/share/extensions/Poly3DObjects/rhomb_dodec.obj @@ -0,0 +1,29 @@ +#Name:Rhombic Dodecahedron +#Type:face_specified +v -0.816497 -0.816497 0. +v -0.816497 0. -0.57735 +v -0.816497 0. 0.57735 +v -0.816497 0.816497 0. +v 0. -0.816497 -0.57735 +v 0. -0.816497 0.57735 +v 0. 0. -1.1547 +v 0. 0. 1.1547 +v 0. 0.816497 -0.57735 +v 0. 0.816497 0.57735 +v 0.816497 -0.816497 0. +v 0.816497 0. -0.57735 +v 0.816497 0. 0.57735 +v 0.816497 0.816497 0. + +f 2 1 3 4 +f 1 2 7 5 +f 6 8 3 1 +f 2 4 9 7 +f 8 10 4 3 +f 11 6 1 5 +f 9 4 10 14 +f 5 7 12 11 +f 11 13 8 6 +f 7 9 14 12 +f 13 14 10 8 +f 14 13 11 12 \ No newline at end of file diff --git a/share/extensions/Poly3DObjects/rhomb_triacont.obj b/share/extensions/Poly3DObjects/rhomb_triacont.obj new file mode 100644 index 000000000..9fd85d07f --- /dev/null +++ b/share/extensions/Poly3DObjects/rhomb_triacont.obj @@ -0,0 +1,65 @@ +#Name:Rhombic Triacontahedron +#Type:face_specified +v 0. 0. -1.61803 +v 0. 0. 1.61803 +v 0.276393 -0.850651 1.17082 +v 0.276393 0.850651 1.17082 +v 0.894427 0. 1.17082 +v 1.17082 -0.850651 0.723607 +v 1.17082 -0.850651 -0.276393 +v 1.17082 0.850651 0.723607 +v 1.17082 0.850651 -0.276393 +v -0.894427 0. -1.17082 +v -0.447214 -1.37638 0.723607 +v -0.447214 -1.37638 -0.276393 +v -0.447214 1.37638 0.723607 +v -0.447214 1.37638 -0.276393 +v 0.447214 -1.37638 0.276393 +v 0.447214 -1.37638 -0.723607 +v 0.447214 1.37638 0.276393 +v 0.447214 1.37638 -0.723607 +v -1.44721 0. 0.723607 +v -1.44721 0. -0.276393 +v -0.723607 -0.525731 1.17082 +v -0.723607 0.525731 1.17082 +v 0.723607 -0.525731 -1.17082 +v 0.723607 0.525731 -1.17082 +v 1.44721 0. 0.276393 +v 1.44721 0. -0.723607 +v -1.17082 -0.850651 0.276393 +v -1.17082 -0.850651 -0.723607 +v -1.17082 0.850651 0.276393 +v -1.17082 0.850651 -0.723607 +v -0.276393 -0.850651 -1.17082 +v -0.276393 0.850651 -1.17082 + +f 16 15 11 12 +f 14 13 17 18 +f 10 28 20 30 +f 8 5 6 25 +f 12 28 31 16 +f 32 30 14 18 +f 6 3 11 15 +f 8 17 13 4 +f 11 21 19 27 +f 13 29 19 22 +f 7 16 23 26 +f 24 18 9 26 +f 12 11 27 28 +f 30 29 13 14 +f 7 6 15 16 +f 18 17 8 9 +f 2 22 19 21 +f 23 1 24 26 +f 3 2 21 11 +f 4 13 22 2 +f 16 31 1 23 +f 1 32 18 24 +f 31 28 10 1 +f 10 30 32 1 +f 6 5 2 3 +f 8 4 2 5 +f 28 27 19 20 +f 20 19 29 30 +f 26 25 6 7 +f 9 8 25 26 diff --git a/share/extensions/Poly3DObjects/small_rhombicosidodec.obj b/share/extensions/Poly3DObjects/small_rhombicosidodec.obj new file mode 100644 index 000000000..94cb91ce7 --- /dev/null +++ b/share/extensions/Poly3DObjects/small_rhombicosidodec.obj @@ -0,0 +1,127 @@ +#Name:Small Rhombicosidodecahedron +#Type:face_specified + +v -0.5 -0.5 -2.11803 +v -0.5 -0.5 2.11803 +v -0.5 0.5 -2.11803 +v -0.5 0.5 2.11803 +v -0.5 -2.11803 -0.5 +v -0.5 -2.11803 0.5 +v -0.5 2.11803 -0.5 +v -0.5 2.11803 0.5 +v 0. -1.30902 -1.80902 +v 0. -1.30902 1.80902 +v 0. 1.30902 -1.80902 +v 0. 1.30902 1.80902 +v 0.5 -0.5 -2.11803 +v 0.5 -0.5 2.11803 +v 0.5 0.5 -2.11803 +v 0.5 0.5 2.11803 +v 0.5 -2.11803 -0.5 +v 0.5 -2.11803 0.5 +v 0.5 2.11803 -0.5 +v 0.5 2.11803 0.5 +v -1.80902 0. -1.30902 +v -1.80902 0. 1.30902 +v -0.809017 -1.61803 -1.30902 +v -0.809017 -1.61803 1.30902 +v -0.809017 1.61803 -1.30902 +v -0.809017 1.61803 1.30902 +v -1.61803 -1.30902 -0.809017 +v -1.61803 -1.30902 0.809017 +v -1.61803 1.30902 -0.809017 +v -1.61803 1.30902 0.809017 +v -2.11803 -0.5 -0.5 +v -2.11803 -0.5 0.5 +v -2.11803 0.5 -0.5 +v -2.11803 0.5 0.5 +v -1.30902 -1.80902 0. +v -1.30902 -0.809017 -1.61803 +v -1.30902 -0.809017 1.61803 +v -1.30902 0.809017 -1.61803 +v -1.30902 0.809017 1.61803 +v -1.30902 1.80902 0. +v 0.809017 -1.61803 -1.30902 +v 0.809017 -1.61803 1.30902 +v 0.809017 1.61803 -1.30902 +v 0.809017 1.61803 1.30902 +v 1.61803 -1.30902 -0.809017 +v 1.61803 -1.30902 0.809017 +v 1.61803 1.30902 -0.809017 +v 1.61803 1.30902 0.809017 +v 2.11803 -0.5 -0.5 +v 2.11803 -0.5 0.5 +v 2.11803 0.5 -0.5 +v 2.11803 0.5 0.5 +v 1.30902 -1.80902 0. +v 1.30902 -0.809017 -1.61803 +v 1.30902 -0.809017 1.61803 +v 1.30902 0.809017 -1.61803 +v 1.30902 0.809017 1.61803 +v 1.30902 1.80902 0. +v 1.80902 0. -1.30902 +v 1.80902 0. 1.30902 + +f 36 23 27 +f 37 28 24 +f 40 8 7 +f 35 5 6 +f 38 29 25 +f 39 26 30 +f 10 14 2 +f 9 1 13 +f 12 4 16 +f 11 15 3 +f 54 45 41 +f 55 42 46 +f 58 19 20 +f 53 18 17 +f 56 43 47 +f 57 48 44 +f 34 32 22 +f 33 21 31 +f 59 51 49 +f 60 50 52 +f 27 31 21 36 +f 23 36 1 9 +f 10 2 37 24 +f 37 22 32 28 +f 8 40 30 26 +f 25 29 40 7 +f 35 27 23 5 +f 6 24 28 35 +f 3 38 25 11 +f 21 33 29 38 +f 39 30 34 22 +f 12 26 39 4 +f 55 14 10 42 +f 41 9 13 54 +f 57 44 12 16 +f 15 11 43 56 +f 45 54 59 49 +f 50 60 55 46 +f 48 58 20 44 +f 43 19 58 47 +f 53 17 41 45 +f 46 42 18 53 +f 59 56 47 51 +f 52 48 57 60 +f 31 32 34 33 +f 17 18 6 5 +f 1 3 15 13 +f 14 16 4 2 +f 7 8 20 19 +f 51 52 50 49 +f 3 1 36 21 38 +f 22 37 2 4 39 +f 29 33 34 30 40 +f 27 35 28 32 31 +f 42 10 24 6 18 +f 41 17 5 23 9 +f 20 8 26 12 44 +f 11 25 7 19 43 +f 56 59 54 13 15 +f 57 16 14 55 60 +f 58 48 52 51 47 +f 49 50 46 53 45 + diff --git a/share/extensions/Poly3DObjects/small_rhombicuboct.obj b/share/extensions/Poly3DObjects/small_rhombicuboct.obj new file mode 100644 index 000000000..24da8f4a3 --- /dev/null +++ b/share/extensions/Poly3DObjects/small_rhombicuboct.obj @@ -0,0 +1,54 @@ +#Name:Small Rhombicuboctahedron +#Type:face_specified + +v -0.5 -0.5 -1.20711 +v -0.5 -0.5 1.20711 +v -0.5 0.5 -1.20711 +v -0.5 0.5 1.20711 +v -0.5 -1.20711 -0.5 +v -0.5 -1.20711 0.5 +v -0.5 1.20711 -0.5 +v -0.5 1.20711 0.5 +v 0.5 -0.5 -1.20711 +v 0.5 -0.5 1.20711 +v 0.5 0.5 -1.20711 +v 0.5 0.5 1.20711 +v 0.5 -1.20711 -0.5 +v 0.5 -1.20711 0.5 +v 0.5 1.20711 -0.5 +v 0.5 1.20711 0.5 +v -1.20711 -0.5 -0.5 +v -1.20711 -0.5 0.5 +v -1.20711 0.5 -0.5 +v -1.20711 0.5 0.5 +v 1.20711 -0.5 -0.5 +v 1.20711 -0.5 0.5 +v 1.20711 0.5 -0.5 +v 1.20711 0.5 0.5 + +f 3 11 9 1 +f 2 10 12 4 +f 24 22 21 23 +f 19 17 18 20 +f 5 13 14 6 +f 8 16 15 7 +f 13 21 22 14 +f 16 24 23 15 +f 6 18 17 5 +f 7 19 20 8 +f 6 14 10 2 +f 4 12 16 8 +f 22 24 12 10 +f 2 4 20 18 +f 1 9 13 5 +f 7 15 11 3 +f 9 11 23 21 +f 17 19 3 1 +f 22 10 14 +f 16 12 24 +f 6 2 18 +f 20 4 8 +f 13 9 21 +f 23 11 15 +f 17 1 5 +f 7 3 19 diff --git a/share/extensions/Poly3DObjects/small_triam_icos.obj b/share/extensions/Poly3DObjects/small_triam_icos.obj new file mode 100644 index 000000000..d7094cc8e --- /dev/null +++ b/share/extensions/Poly3DObjects/small_triam_icos.obj @@ -0,0 +1,95 @@ +#Name:Small Triambic Icosahedron +#Type:face_specified +v 0. 0. -0.951057 +v 0. 0. 0.951057 +v 0.262866 -0.809017 0.425325 +v 0.262866 0.809017 0.425325 +v 0.688191 -0.5 -0.425325 +v 0.688191 0.5 -0.425325 +v 0.995959 0. -0.190211 +v -0.688191 -0.5 0.425325 +v -0.688191 0.5 0.425325 +v -0.49798 -0.361803 -0.805748 +v -0.49798 0.361803 -0.805748 +v 0.49798 -0.361803 0.805748 +v 0.49798 0.361803 0.805748 +v 0.190211 -0.58541 -0.805748 +v 0.190211 0.58541 -0.805748 +v 0.850651 0. 0.425325 +v -0.190211 -0.58541 0.805748 +v -0.190211 0.58541 0.805748 +v -0.615537 0. 0.805748 +v -0.307768 -0.947214 0.190211 +v -0.307768 0.947214 0.190211 +v 0.307768 -0.947214 -0.190211 +v 0.307768 0.947214 -0.190211 +v 0.615537 0. -0.805748 +v 0.805748 -0.58541 0.190211 +v 0.805748 0.58541 0.190211 +v -0.850651 0. -0.425325 +v -0.262866 -0.809017 -0.425325 +v -0.262866 0.809017 -0.425325 +v -0.995959 0. 0.190211 +v -0.805748 -0.58541 -0.190211 +v -0.805748 0.58541 -0.190211 + +f 18 2 4 +f 18 4 9 +f 18 9 2 +f 19 2 9 +f 19 9 8 +f 19 8 2 +f 17 2 8 +f 17 8 3 +f 17 3 2 +f 12 2 3 +f 12 3 16 +f 12 16 2 +f 13 2 16 +f 13 16 4 +f 13 4 2 +f 14 5 28 +f 14 28 1 +f 14 1 5 +f 24 6 5 +f 24 5 1 +f 24 1 6 +f 15 29 6 +f 15 6 1 +f 15 1 29 +f 11 27 29 +f 11 29 1 +f 11 1 27 +f 10 28 27 +f 10 27 1 +f 10 1 28 +f 21 4 29 +f 21 29 9 +f 21 9 4 +f 30 9 27 +f 30 27 8 +f 30 8 9 +f 20 8 28 +f 20 28 3 +f 20 3 8 +f 25 3 5 +f 25 5 16 +f 25 16 3 +f 26 16 6 +f 26 6 4 +f 26 4 16 +f 22 5 3 +f 22 3 28 +f 22 28 5 +f 7 6 16 +f 7 16 5 +f 7 5 6 +f 23 29 4 +f 23 4 6 +f 23 6 29 +f 32 27 9 +f 32 9 29 +f 32 29 27 +f 31 28 8 +f 31 8 27 +f 31 27 28 diff --git a/share/extensions/Poly3DObjects/snub_cube.obj b/share/extensions/Poly3DObjects/snub_cube.obj new file mode 100644 index 000000000..d144c7e36 --- /dev/null +++ b/share/extensions/Poly3DObjects/snub_cube.obj @@ -0,0 +1,65 @@ +#Name:Snub Cube +#Type:face_specified +v -1.1426135 -0.33775397 -0.62122641 +v -1.1426135 0.33775397 0.62122641 +v -1.1426135 -0.62122641 0.33775397 +v -1.1426135 0.62122641 -0.33775397 +v 1.1426135 -0.33775397 0.62122641 +v 1.1426135 0.33775397 -0.62122641 +v 1.1426135 -0.62122641 -0.33775397 +v 1.1426135 0.62122641 0.33775397 +v -0.33775397 -1.1426135 0.62122641 +v -0.33775397 1.1426135 -0.62122641 +v -0.33775397 -0.62122641 -1.1426135 +v -0.33775397 0.62122641 1.1426135 +v 0.33775397 -1.1426135 -0.62122641 +v 0.33775397 1.1426135 0.62122641 +v 0.33775397 -0.62122641 1.1426135 +v 0.33775397 0.62122641 -1.1426135 +v -0.62122641 -1.1426135 -0.33775397 +v -0.62122641 1.1426135 0.33775397 +v -0.62122641 -0.33775397 1.1426135 +v -0.62122641 0.33775397 -1.1426135 +v 0.62122641 -1.1426135 0.33775397 +v 0.62122641 1.1426135 -0.33775397 +v 0.62122641 -0.33775397 -1.1426135 +v 0.62122641 0.33775397 1.1426135 + +f 3 1 17 +f 3 17 9 +f 3 19 2 +f 3 9 19 +f 1 4 20 +f 1 20 11 +f 1 11 17 +f 2 19 12 +f 2 18 4 +f 2 12 18 +f 4 18 10 +f 4 10 20 +f 17 11 13 +f 19 9 15 +f 18 12 14 +f 20 10 16 +f 9 21 15 +f 11 23 13 +f 12 24 14 +f 10 22 16 +f 13 23 7 +f 13 7 21 +f 15 21 5 +f 15 5 24 +f 16 22 6 +f 16 6 23 +f 14 24 8 +f 14 8 22 +f 21 7 5 +f 23 6 7 +f 24 5 8 +f 22 8 6 +f 1 3 2 4 +f 21 9 17 13 +f 24 12 19 15 +f 10 18 14 22 +f 11 20 16 23 +f 8 5 7 6 diff --git a/share/extensions/Poly3DObjects/snub_dodec.obj b/share/extensions/Poly3DObjects/snub_dodec.obj new file mode 100644 index 000000000..8dfbda342 --- /dev/null +++ b/share/extensions/Poly3DObjects/snub_dodec.obj @@ -0,0 +1,156 @@ +#Name:Snub Dodecahedron +#Type:face_specified + +v -2.0502159 -0.64302961 0.17539263 +v 2.0502159 -0.64302961 -0.17539263 +v -1.6450691 0.64302961 1.2360806 +v 1.6450691 0.64302961 -1.2360806 +v -2.0927544 0.33092102 0.39812710 +v 2.0927544 0.33092102 -0.39812710 +v -1.3329632 1.6469179 -0.39812710 +v 1.3329632 1.6469179 0.39812710 +v -1.8252651 -0.33092102 1.0984232 +v 1.8252651 -0.33092102 -1.0984232 +v -0.62604653 1.7461864 -1.0984232 +v 0.62604653 1.7461864 1.0984232 +v -1.0622158 1.4540242 1.1853886 +v 1.0622158 1.4540242 -1.1853886 +v -1.9321359 0.84755005 -0.44288192 +v 1.9321359 0.84755005 0.44288192 +v -1.1448745 -0.84755005 1.6181953 +v 1.1448745 -0.84755005 -1.6181953 +v -1.5819879 -1.4540242 -0.17539263 +v 1.5819879 -1.4540242 0.17539263 +v -1.0574124 0.37482166 -1.8409298 +v 1.0574124 0.37482166 1.8409298 +v -0.43913786 -0.37482166 -2.0770897 +v 0.43913786 -0.37482166 2.0770897 +v -1.5624104 -1.2495038 0.80327387 +v 1.5624104 -1.2495038 -0.80327387 +v -1.8633072 -0.72833518 -0.80327387 +v 1.8633072 -0.72833518 0.80327387 +v -1.7000678 1.2495038 0.44288192 +v 1.7000678 1.2495038 -0.44288192 +v -0.72811404 -1.6469179 1.1853886 +v 0.72811404 -1.6469179 -1.1853886 +v -0.26565458 -1.7461864 -1.2360806 +v 0.26565458 -1.7461864 1.2360806 +v -0.75979117 -1.9778390 -0.39812710 +v 0.75979117 -1.9778390 0.39812710 +v -1.1992186 -1.4152654 -1.0984232 +v 1.1992186 -1.4152654 1.0984232 +v -1.7903298 0.19289371 -1.1853886 +v 1.7903298 0.19289371 1.1853886 +v -1.3064371 -0.56771537 -1.6181953 +v 1.3064371 -0.56771537 1.6181953 +v -0.85331128 0.72833518 1.8409298 +v 0.85331128 0.72833518 -1.8409298 +v -1.3794145 1.1031568 -1.2360806 +v 1.3794145 1.1031568 1.2360806 +v -0.10503615 0.56771537 -2.0770897 +v 0.10503615 0.56771537 2.0770897 +v -0.46822796 2.0970538 -0.17539263 +v 0.46822796 2.0970538 0.17539263 +v -0.30089684 1.9778390 0.80327387 +v 0.30089684 1.9778390 -0.80327387 +v -0.16156263 1.4152654 1.6181953 +v 0.16156263 1.4152654 -1.6181953 +v -0.54417401 -0.19289371 2.0770897 +v 0.54417401 -0.19289371 -2.0770897 +v -0.23206810 -2.0970538 0.44288192 +v 0.23206810 -2.0970538 -0.44288192 +v -0.20410113 -1.1031568 1.8409298 +v 0.20410113 -1.1031568 -1.8409298 + +f 5 1 9 +f 5 9 3 +f 5 29 15 +f 5 3 29 +f 1 27 19 +f 1 19 25 +f 1 25 9 +f 15 29 7 +f 15 45 39 +f 15 7 45 +f 27 39 41 +f 27 41 37 +f 27 37 19 +f 9 25 17 +f 39 45 21 +f 39 21 41 +f 29 3 13 +f 3 43 13 +f 19 37 35 +f 25 31 17 +f 45 7 11 +f 7 49 11 +f 41 21 23 +f 37 33 35 +f 17 31 59 +f 17 59 55 +f 13 43 53 +f 13 53 51 +f 21 47 23 +f 43 55 48 +f 43 48 53 +f 35 33 58 +f 35 58 57 +f 31 57 34 +f 31 34 59 +f 11 49 52 +f 11 52 54 +f 55 59 24 +f 55 24 48 +f 49 51 50 +f 49 50 52 +f 23 47 56 +f 23 56 60 +f 51 53 12 +f 51 12 50 +f 33 60 32 +f 33 32 58 +f 57 58 36 +f 57 36 34 +f 47 54 44 +f 47 44 56 +f 48 24 22 +f 54 52 14 +f 54 14 44 +f 60 56 18 +f 60 18 32 +f 34 36 38 +f 24 42 22 +f 50 12 8 +f 12 46 8 +f 32 18 26 +f 36 20 38 +f 44 14 4 +f 22 42 40 +f 22 40 46 +f 14 30 4 +f 18 10 26 +f 38 20 28 +f 38 28 42 +f 42 28 40 +f 8 46 16 +f 8 16 30 +f 46 40 16 +f 26 10 2 +f 26 2 20 +f 20 2 28 +f 4 30 6 +f 4 6 10 +f 30 16 6 +f 10 6 2 +f 39 27 1 5 15 +f 3 9 17 55 43 +f 51 49 7 29 13 +f 57 31 25 19 35 +f 47 21 45 11 54 +f 33 37 41 23 60 +f 42 24 59 34 38 +f 46 12 53 48 22 +f 36 58 32 26 20 +f 14 52 50 8 30 +f 44 4 10 18 56 +f 16 40 28 2 6 diff --git a/share/extensions/Poly3DObjects/szilassi.obj b/share/extensions/Poly3DObjects/szilassi.obj new file mode 100644 index 000000000..00639b85b --- /dev/null +++ b/share/extensions/Poly3DObjects/szilassi.obj @@ -0,0 +1,24 @@ +#Face:Szilassi Polyhedron +#Type:face_specified +v -4.8 0. 4.8 +v -2.8 -1. 0.8 +v -2.8 0. 0.8 +v -1.8 1. 0.8 +v -1.5 -1.5 -1.2 +v -0.8 2. -3.2 +v 0. -5.04 -4.8 +v 0. 5.04 -4.8 +v 0.8 -2. -3.2 +v 1.5 1.5 -1.2 +v 1.8 -1. 0.8 +v 2.8 0. 0.8 +v 2.8 1. 0.8 +v 4.8 0. 4.8 + +f 4 10 6 1 14 13 +f 3 2 1 6 8 7 +f 5 10 4 3 7 9 +f 10 5 11 12 8 6 +f 12 13 14 9 7 8 +f 11 5 9 14 1 2 +f 13 12 11 2 3 4 diff --git a/share/extensions/Poly3DObjects/tet.obj b/share/extensions/Poly3DObjects/tet.obj new file mode 100644 index 000000000..75d90ff96 --- /dev/null +++ b/share/extensions/Poly3DObjects/tet.obj @@ -0,0 +1,12 @@ +#Name:Tetrahedron +#Type:face_specified + +v 0 0 0.61237244 +v -0.28867513 -0.50000000 -0.20412415 +v -0.28867513 0.50000000 -0.20412415 +v 0.57735027 0 -0.20412415 + +f 2 3 4 +f 3 2 1 +f 4 1 2 +f 1 4 3 diff --git a/share/extensions/Poly3DObjects/trunc_cube.obj b/share/extensions/Poly3DObjects/trunc_cube.obj new file mode 100644 index 000000000..59ce6d07e --- /dev/null +++ b/share/extensions/Poly3DObjects/trunc_cube.obj @@ -0,0 +1,42 @@ +#Name:Truncated Cube +#Type:face_specified + +v -0.5 1.2071068 1.2071068 +v -0.5 1.2071068 -1.2071068 +v -0.5 -1.2071068 1.2071068 +v -0.5 -1.2071068 -1.2071068 +v 0.5 1.2071068 1.2071068 +v 0.5 1.2071068 -1.2071068 +v 0.5 -1.2071068 1.2071068 +v 0.5 -1.2071068 -1.2071068 +v 1.2071068 -0.5 1.2071068 +v 1.2071068 -0.5 -1.2071068 +v 1.2071068 0.5 1.2071068 +v 1.2071068 0.5 -1.2071068 +v 1.2071068 1.2071068 -0.5 +v 1.2071068 1.2071068 0.5 +v 1.2071068 -1.2071068 -0.5 +v 1.2071068 -1.2071068 0.5 +v -1.2071068 -0.5 1.2071068 +v -1.2071068 -0.5 -1.2071068 +v -1.2071068 0.5 1.2071068 +v -1.2071068 0.5 -1.2071068 +v -1.2071068 1.2071068 -0.5 +v -1.2071068 1.2071068 0.5 +v -1.2071068 -1.2071068 -0.5 +v -1.2071068 -1.2071068 0.5 + +f 6 12 10 8 4 18 20 2 +f 1 19 17 3 7 9 11 5 +f 3 24 23 4 8 15 16 7 +f 5 14 13 6 2 21 22 1 +f 9 16 15 10 12 13 14 11 +f 19 22 21 20 18 23 24 17 +f 16 9 7 +f 5 11 14 +f 3 17 24 +f 22 19 1 +f 8 10 15 +f 13 12 6 +f 23 18 4 +f 2 20 21 diff --git a/share/extensions/Poly3DObjects/trunc_dodec.obj b/share/extensions/Poly3DObjects/trunc_dodec.obj new file mode 100644 index 000000000..1e21c798e --- /dev/null +++ b/share/extensions/Poly3DObjects/trunc_dodec.obj @@ -0,0 +1,96 @@ +#Name:Truncated Dodecahedron +#Type:face_specified + +v 0 -1.6180340 2.4898983 +v 0 -1.6180340 -2.4898983 +v 0 1.6180340 2.4898983 +v 0 1.6180340 -2.4898983 +v 0.42532540 -2.9270510 0.26286556 +v 0.42532540 2.9270510 0.26286556 +v 0.68819096 -2.1180340 1.9641672 +v 0.68819096 2.1180340 1.9641672 +v -2.7527638 0 -1.1135164 +v -2.0645729 -2.1180340 0.26286556 +v -2.0645729 2.1180340 0.26286556 +v -1.3763819 -2.6180340 -0.26286556 +v -1.3763819 2.6180340 -0.26286556 +v -0.68819096 -2.1180340 -1.9641672 +v -0.68819096 2.1180340 -1.9641672 +v 1.3763819 -2.6180340 0.26286556 +v 1.3763819 2.6180340 0.26286556 +v 2.7527638 0 1.1135164 +v 1.8017073 -1.3090170 -1.9641672 +v 1.8017073 1.3090170 -1.9641672 +v 2.0645729 -2.1180340 -0.26286556 +v 2.0645729 2.1180340 -0.26286556 +v 2.2270327 0 1.9641672 +v 2.2270327 -1.6180340 -1.1135164 +v 2.2270327 1.6180340 -1.1135164 +v -2.6523581 -1.3090170 0.26286556 +v -2.6523581 1.3090170 0.26286556 +v 2.6523581 -1.3090170 -0.26286556 +v 2.6523581 1.3090170 -0.26286556 +v 2.9152237 -0.5 0.26286556 +v 2.9152237 0.5 0.26286556 +v -2.9152237 -0.5 -0.26286556 +v -2.9152237 0.5 -0.26286556 +v 0.95105652 -1.3090170 2.4898983 +v 0.95105652 -1.3090170 -2.4898983 +v 0.95105652 1.3090170 2.4898983 +v 0.95105652 1.3090170 -2.4898983 +v 0.85065081 -2.6180340 1.1135164 +v 0.85065081 2.6180340 1.1135164 +v -0.95105652 -1.3090170 2.4898983 +v -0.95105652 -1.3090170 -2.4898983 +v -0.95105652 1.3090170 2.4898983 +v -0.95105652 1.3090170 -2.4898983 +v -1.5388418 -0.5 2.4898983 +v -1.5388418 -0.5 -2.4898983 +v -1.5388418 0.5 2.4898983 +v -1.5388418 0.5 -2.4898983 +v 1.5388418 -0.5 2.4898983 +v 1.5388418 -0.5 -2.4898983 +v 1.5388418 0.5 2.4898983 +v 1.5388418 0.5 -2.4898983 +v -2.2270327 0 -1.9641672 +v -2.2270327 -1.6180340 1.1135164 +v -2.2270327 1.6180340 1.1135164 +v -0.85065081 -2.6180340 -1.1135164 +v -0.85065081 2.6180340 -1.1135164 +v -1.8017073 -1.3090170 1.9641672 +v -1.8017073 1.3090170 1.9641672 +v -0.42532540 -2.9270510 -0.26286556 +v -0.42532540 2.9270510 -0.26286556 + +f 3 42 46 44 40 1 34 48 50 36 +f 47 43 4 37 51 49 35 2 41 45 +f 2 35 19 24 21 16 5 59 55 14 +f 49 51 20 25 29 31 30 28 24 19 +f 37 4 15 56 60 6 17 22 25 20 +f 43 47 52 9 33 27 11 13 56 15 +f 45 41 14 55 12 10 26 32 9 52 +f 6 60 13 11 54 58 42 3 8 39 +f 27 33 32 26 53 57 44 46 58 54 +f 10 12 59 5 38 7 1 40 57 53 +f 16 21 28 30 18 23 48 34 7 38 +f 31 29 22 17 39 8 36 50 23 18 +f 9 32 33 +f 18 30 31 +f 47 45 52 +f 50 48 23 +f 10 53 26 +f 27 54 11 +f 21 24 28 +f 29 25 22 +f 40 44 57 +f 58 46 42 +f 35 49 19 +f 20 51 37 +f 12 55 59 +f 60 56 13 +f 41 2 14 +f 15 4 43 +f 34 1 7 +f 8 3 36 +f 38 5 16 +f 17 6 39 diff --git a/share/extensions/Poly3DObjects/trunc_icos.obj b/share/extensions/Poly3DObjects/trunc_icos.obj new file mode 100644 index 000000000..f325bef3b --- /dev/null +++ b/share/extensions/Poly3DObjects/trunc_icos.obj @@ -0,0 +1,96 @@ +#Name:Truncated Icosahedron +#Type:Face_specified + +v -0.16245985 -2.1180340 1.2759762 +v -0.16245985 2.1180340 1.2759762 +v 0.16245985 -2.1180340 -1.2759762 +v 0.16245985 2.1180340 -1.2759762 +v -0.26286556 -0.80901699 -2.3274384 +v -0.26286556 -2.4270510 -0.42532540 +v -0.26286556 0.80901699 -2.3274384 +v -0.26286556 2.4270510 -0.42532540 +v 0.26286556 -0.80901699 2.3274384 +v 0.26286556 -2.4270510 0.42532540 +v 0.26286556 0.80901699 2.3274384 +v 0.26286556 2.4270510 0.42532540 +v 0.68819096 -0.5 -2.3274384 +v 0.68819096 0.5 -2.3274384 +v 1.2139221 -2.1180340 0.42532540 +v 1.2139221 2.1180340 0.42532540 +v -2.0645729 -0.5 1.2759762 +v -2.0645729 0.5 1.2759762 +v -1.3763819 -1.0 1.8017073 +v -1.3763819 1.0 1.8017073 +v -1.3763819 -1.6180340 -1.2759762 +v -1.3763819 1.6180340 -1.2759762 +v -0.68819096 -0.5 2.3274384 +v -0.68819096 0.5 2.3274384 +v 1.3763819 -1.0 -1.8017073 +v 1.3763819 1.0 -1.8017073 +v 1.3763819 -1.6180340 1.2759762 +v 1.3763819 1.6180340 1.2759762 +v -1.7013016 0 -1.8017073 +v 1.7013016 0 1.8017073 +v -1.2139221 -2.1180340 -0.42532540 +v -1.2139221 2.1180340 -0.42532540 +v -1.9641672 -0.80901699 -1.2759762 +v -1.9641672 0.80901699 -1.2759762 +v 2.0645729 -0.5 -1.2759762 +v 2.0645729 0.5 -1.2759762 +v 2.2270327 -1.0 -0.42532540 +v 2.2270327 1.0 -0.42532540 +v 2.3894926 -0.5 0.42532540 +v 2.3894926 0.5 0.42532540 +v -1.1135164 -1.8090170 1.2759762 +v -1.1135164 1.8090170 1.2759762 +v 1.1135164 -1.8090170 -1.2759762 +v 1.1135164 1.8090170 -1.2759762 +v -2.3894926 -0.5 -0.42532540 +v -2.3894926 0.5 -0.42532540 +v -1.6392475 -1.8090170 0.42532540 +v -1.6392475 1.8090170 0.42532540 +v 1.6392475 -1.8090170 -0.42532540 +v 1.6392475 1.8090170 -0.42532540 +v 1.9641672 -0.80901699 1.2759762 +v 1.9641672 0.80901699 1.2759762 +v 0.85065081 0 2.3274384 +v -2.2270327 -1.0 0.42532540 +v -2.2270327 1.0 0.42532540 +v -0.85065081 0 -2.3274384 +v -0.52573111 -1.6180340 -1.8017073 +v -0.52573111 1.6180340 -1.8017073 +v 0.52573111 -1.6180340 1.8017073 +v 0.52573111 1.6180340 1.8017073 + +f 53 11 24 23 9 +f 51 39 40 52 30 +f 60 28 16 12 2 +f 20 42 48 55 18 +f 19 17 54 47 41 +f 1 10 15 27 59 +f 36 26 44 50 38 +f 4 58 22 32 8 +f 34 29 33 45 46 +f 21 57 3 6 31 +f 37 49 43 25 35 +f 13 5 56 7 14 +f 9 59 27 51 30 53 +f 53 30 52 28 60 11 +f 11 60 2 42 20 24 +f 24 20 18 17 19 23 +f 23 19 41 1 59 9 +f 13 25 43 3 57 5 +f 5 57 21 33 29 56 +f 56 29 34 22 58 7 +f 7 58 4 44 26 14 +f 14 26 36 35 25 13 +f 40 38 50 16 28 52 +f 16 50 44 4 8 12 +f 12 8 32 48 42 2 +f 48 32 22 34 46 55 +f 55 46 45 54 17 18 +f 54 45 33 21 31 47 +f 47 31 6 10 1 41 +f 10 6 3 43 49 15 +f 15 49 37 39 51 27 +f 39 37 35 36 38 40 diff --git a/share/extensions/Poly3DObjects/trunc_oct.obj b/share/extensions/Poly3DObjects/trunc_oct.obj new file mode 100644 index 000000000..e7b0df593 --- /dev/null +++ b/share/extensions/Poly3DObjects/trunc_oct.obj @@ -0,0 +1,42 @@ +#Name:Truncated Octahedron +#Type:face_specified + +v -1.5 -0.5 0 +v -1.5 0.5 0 +v -1. -1. -0.70710678 +v -1. -1. 0.70710678 +v -1. 1. -0.70710678 +v -1. 1. 0.70710678 +v -0.5 -1.5 0 +v -0.5 -0.5 -1.4142136 +v -0.5 -0.5 1.4142136 +v -0.5 0.5 -1.4142136 +v -0.5 0.5 1.4142136 +v -0.5 1.5 0 +v 0.5 -1.5 0 +v 0.5 -0.5 -1.4142136 +v 0.5 -0.5 1.4142136 +v 0.5 0.5 -1.4142136 +v 0.5 0.5 1.4142136 +v 0.5 1.5 0 +v 1. -1. -0.70710678 +v 1. -1. 0.70710678 +v 1. 1. -0.70710678 +v 1. 1. 0.70710678 +v 1.5 -0.5 0 +v 1.5 0.5 0 + +f 17 11 9 15 +f 14 8 10 16 +f 22 24 21 18 +f 12 5 2 6 +f 13 19 23 20 +f 4 1 3 7 +f 19 13 7 3 8 14 +f 15 9 4 7 13 20 +f 16 10 5 12 18 21 +f 22 18 12 6 11 17 +f 20 23 24 22 17 15 +f 14 16 21 24 23 19 +f 9 11 6 2 1 4 +f 3 1 2 5 10 8 \ No newline at end of file diff --git a/share/extensions/Poly3DObjects/trunc_tet.obj b/share/extensions/Poly3DObjects/trunc_tet.obj new file mode 100644 index 000000000..eaa9233ad --- /dev/null +++ b/share/extensions/Poly3DObjects/trunc_tet.obj @@ -0,0 +1,24 @@ +#Name:Truncated Tetrahedron +#Type:face_specified + +v 0 -1. -0.61237244 +v 0 1. -0.61237244 +v -0.57735027 -1. 0.20412415 +v -0.57735027 1. 0.20412415 +v -0.28867513 -0.5 1.0206207 +v -0.28867513 0.5 1.0206207 +v 0.57735027 0 1.0206207 +v 1.1547005 0 0.20412415 +v -0.86602540 -0.5 -0.61237244 +v -0.86602540 0.5 -0.61237244 +v 0.86602540 -0.5 -0.61237244 +v 0.86602540 0.5 -0.61237244 + +f 11 12 8 +f 3 9 1 +f 2 10 4 +f 6 5 7 +f 11 8 7 5 3 1 +f 2 4 6 7 8 12 +f 9 3 5 6 4 10 +f 2 12 11 1 9 10 \ No newline at end of file diff --git a/share/extensions/polyhedron_3d.inx b/share/extensions/polyhedron_3d.inx new file mode 100644 index 000000000..e09311c06 --- /dev/null +++ b/share/extensions/polyhedron_3d.inx @@ -0,0 +1,96 @@ + + + <_name>3D Polyhedron + math.polyhedron.3d + polyhedron_3d.py + inkex.py + + + + <_option value="cube">Cube + <_option value="t_cube">Truncated Cube + <_option value="sn_cube">Snub Cube + <_option value="cuboct">Cuboctohedron + <_option value="tet">Tetrahedron + <_option value="t_tet">Truncated Tetrahedron + <_option value="oct">Octahedron + <_option value="t_oct">Truncated Octahedron + <_option value="icos">Icosahedron + <_option value="t_icos">Truncated Icosahedron + <_option value="s_t_icos">Small Triambic Icosahedron + <_option value="dodec">Dodecahedron + <_option value="t_dodec">Truncated Dodecahedron + <_option value="sn_dodec">Snub Dodecahedron + <_option value="g_dodec">Great Dodecahedron + <_option value="g_s_dodec">Great Stellated Dodecahedron + <_option value="from_file">Load From File + + great_rhombicuboct.obj + 0 + + + + <_option value="x">X-Axis + <_option value="y">Y-Axis + <_option value="z">Z-Axis + 0 + + <_option value="x">X-Axis + <_option value="y">Y-Axis + <_option value="z">Z-Axis + 0 + + <_option value="x">X-Axis + <_option value="y">Y-Axis + <_option value="z">Z-Axis + 0 + + <_option value="x">X-Axis + <_option value="y">Y-Axis + <_option value="z">Z-Axis + 0 + + <_option value="x">X-Axis + <_option value="y">Y-Axis + <_option value="z">Z-Axis + 0 + + <_option value="x">X-Axis + <_option value="y">Y-Axis + <_option value="z">Z-Axis + 0 + + + 100 + 255 + 0 + 0 + 100 + 100 + 2 + 0 + 1 + 1 + -2 + + <_option value="vtx">Vertices + <_option value="edg">Edges + <_option value="fce">Faces + 0 + + <_option value="max">Maximum + <_option value="min">Minimum + <_option value="mean">Mean + 0 + + + + all + + + + + + \ No newline at end of file diff --git a/share/extensions/polyhedron_3d.py b/share/extensions/polyhedron_3d.py new file mode 100644 index 000000000..2b5698e74 --- /dev/null +++ b/share/extensions/polyhedron_3d.py @@ -0,0 +1,492 @@ +#!/usr/bin/env python +''' +Copyright (C) 2007 John Beard john.j.beard@gmail.com + +##This extension draws 3d objects from an .obj file stored in a local folder +##Many settings for appearance, lighting, rotation, etc are available. + +# ^y +# | +# __--``| |_--``| __-- +# __--`` | __--``| |_--`` +# | z | | |_--``| +# | <----|--------|-----_0-----|---------------- +# | | |_--`` | | +# | __--`` <-``| |_--`` +# |__--`` x |__--``| +# IMAGE PLANE SCENE| +# | + +#The .obj file must contain "#Name:" followed by a name, +#and "#Type:" follwed by "edge_specified" or "face-specified" +#if edge_specified is given, then faces cannot be drawn, +#if face_specified is given then faces and edges can be drawn + +#Vertices are given as "v" followed by three numbers (x,y,z). +#All files need a vertex list +#v x.xxx y.yyy z.zzz + +#Faces are given by a list of vertices +#(vertex 1 is the first in the list above, 2 the second, etc): +#f 1 2 3 + +#Edges are given by a list of vertices. These will be broken down +#into adjacent pairs. Each edge can connect only two vertices +#l 1 2 3 + +#Faces are rendered according to the painter's algorithm and perhaps +#back-face culling, if selected. The parameter to sort the faces by +#is user-selectable + +######LICENCE####### +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +''' + +import inkex +import simplestyle, sys, simplepath, re +from math import * +try: + from numpy import * +except: + inkex.debug("Failed to import the numpy module. This module is required by this extension. Please install them and try again. On a Debian-like system this can be done with the command, sudo apt-get install python-numpy.") + sys.exit() + +def mydir(): + import os.path + if __name__ == '__main__': + filename = sys.argv[0] + else: + filename = __file__ + return os.path.abspath(os.path.dirname(filename)) + +def get_obj_data(obj, name): + infile = open(mydir() +'\\Poly3DObjects\\'+name) + + #regular expressions + getname = '(.[nN]ame:\\s*)(.*)' + gettype = '(.[tT]ype:\\s*)([Ff]ace|[Ee]dge)(.specified)' + getvertex = '(v\\s+)([\-\\d*\.]*)\\s+([\-\\d*\.]*)\\s+([\-\\d*\.]*)' + getedgeline = '(l\\s+)(.*)' + getfaceline = '(f\\s+)(.*)' + getnextint = '\\s*(\\d+)(.*)' + + obj.vtx = [] + obj.edg = [] + obj.fce = [] + obj.type='' + obj.name='' + + for line in infile: + if line[0]=='#': #we have a comment line + m = re.search(getname, line) + if m: + obj.name = m.group(2) + m = re.search(gettype, line) + if m: + typestr = m.group(2).lower() + obj.type=typestr + elif line[0:1] == 'v': #we have a vertex (maybe) + m = re.search(getvertex, line) + if m: #we have a valid vertex + obj.vtx.append( [float(m.group(2)), float(m.group(3)), float(m.group(4)) ] ) + elif line[0:1] == 'l':#we have a line (maybe) + m = re.search(getedgeline, line) + if m:#we have a line beginning 'l ' + vtxlist = []#buffer + while line: + m2 = re.search(getnextint, line) + if m2: + vtxlist.append( int(m2.group(1)) ) + line = m2.group(2)#remainder + else: + line = None + if len(vtxlist) > 1:#we need at least 2 vertices to make an edge + for i in range (len(vtxlist)-1):#we can have more than one vertex per line - get adjacent pairs + obj.edg.append( ( vtxlist[i], vtxlist[i+1] ) )#get the vertex pair between that vertex and the next + elif line[0:1] == 'f':#we have a face (maybe) + m = re.search(getfaceline, line) + if m:#we have a line beginning 'l ' + vtxlist = []#buffer + while line: + m2 = re.search(getnextint, line) + if m2: + vtxlist.append( int(m2.group(1)) ) + line = m2.group(2)#remainder + else: + line = None + if len(vtxlist) > 2:#we need at least 3 vertices to make an edge + obj.fce.append(vtxlist) + +def draw_SVG_dot((cx, cy), st, name, parent): + style = { 'stroke': '#000000', 'stroke-width':str(st.th), 'fill': st.fill, 'stroke-opacity':st.s_opac, 'fill-opacity':st.f_opac} + circ_attribs = {'style':simplestyle.formatStyle(style), + 'inkscape:label':name, + 'r':str(st.r), + 'cx':str(cx), 'cy':str(-cy)} + inkex.etree.SubElement(parent, inkex.addNS('circle','svg'), circ_attribs ) + +def draw_SVG_line((x1, y1),(x2, y2), st, name, parent): + #sys.stderr.write(str(p1)) + style = { 'stroke': '#000000', 'stroke-width':str(st.th)} + line_attribs = {'style':simplestyle.formatStyle(style), + 'inkscape:label':name, + 'd':'M '+str(x1)+','+str(-y1)+' L '+str(x2)+','+str(-y2)} + inkex.etree.SubElement(parent, inkex.addNS('path','svg'), line_attribs ) + +def draw_SVG_poly(pts, face, st, name, parent): + style = { 'stroke': '#000000', 'stroke-width':str(st.th), 'stroke-linejoin':st.linejoin, \ + 'stroke-opacity':st.s_opac, 'fill': st.fill, 'fill-opacity':st.f_opac} + for i in range(len(face)): + if i == 0:#for first point + d = 'M'#move to + else: + d = d + 'L'#line to + d = d+ str(pts[face[i]-1][0]) + ',' + str(-pts[face[i]-1][1])#add point + d = d + 'z' #close the polygon + + line_attribs = {'style':simplestyle.formatStyle(style), + 'inkscape:label':name,'d': d} + inkex.etree.SubElement(parent, inkex.addNS('path','svg'), line_attribs ) + +def get_normal( pts, face): #returns the normal vector for the plane passing though the first three elements of face of pts + #n = pt[0]->pt[1] x pt[0]->pt[3] + a = (array(pts[ face[0]-1 ]) - array(pts[ face[1]-1 ])) + b = (array(pts[ face[0]-1 ]) - array(pts[ face[2]-1 ])) + return cross(a,b).flatten() + +def get_max_z(pts, face): #returns the largest z_value of any point in the face + max_z = pts[ face[0]-1 ][2] + for i in range(1, len(face)): + if pts[ face[0]-1 ][2] >= max_z: + max_z = pts[ face[0]-1 ][2] + return max_z + +def get_min_z(pts, face): #returns the smallest z_value of any point in the face + min_z = pts[ face[0]-1 ][2] + for i in range(1, len(face)): + if pts[ face[i]-1 ][2] <= min_z: + min_z = pts[ face[i]-1 ][2] + return min_z + +def get_cent_z(pts, face): #returns the centroid z_value of any point in the face + sum = 0 + for i in range(len(face)): + sum += pts[ face[i]-1 ][2] + return sum/len(face) + +def length(vector):#return the pythagorean length of a vector + return sqrt(dot(vector,vector)) + +def rot_z( matrix , a): + trans_mat = mat(array( [[ cos(a) , -sin(a) , 0 ], + [ sin(a) , cos(a) , 0 ], + [ 0 , 0 , 1 ]])) + return trans_mat*matrix + +def rot_y( matrix , a): + trans_mat = mat(array( [[ cos(a) , 0 , sin(a) ], + [ 0 , 1 , 0 ], + [-sin(a) , 0 , cos(a) ]])) + return trans_mat*matrix + +def rot_x( matrix , a): + trans_mat = mat(array( [[ 1 , 0 , 0 ], + [ 0 , cos(a) ,-sin(a) ], + [ 0 , sin(a) , cos(a) ]])) + return trans_mat*matrix + +def make_edge_list(face_list):#make an edge vertex list from an existing face vertex list + edge_list = [] + for i in range(len(face_list)):#for every face + edges = len(face_list[i]) #number of edges around that face + for j in range(edges):#for every vertex in that face + edge_list.append( [face_list[i][j], face_list[i][(j+1)%edges] ] )#get the vertex pair between that vertex and the next + + for i in range(len(edge_list)): + edge_list[i].sort()#sort the entries of the entries + edge_list.sort()#sort the list + + last = edge_list[-1] #delete duplicate entries + for i in range(len(edge_list)-2, -1, -1): + if last==edge_list[i]: + del edge_list[i] + else: + last=edge_list[i] + return edge_list + +class Style(object): #container for style information + def __init__(self): + None + +class Obj(object): #a 3d object defined by the vertices and the faces (eg a polyhedron) +#edges can be generated from this information + def __init__(self): + None + +class Draw_From_Triangle(inkex.Effect): + def __init__(self): + inkex.Effect.__init__(self) + self.OptionParser.add_option("--tab", + action="store", type="string", + dest="tab", default="object") + + self.OptionParser.add_option("--obj", + action="store", type="string", + dest="obj", default='cube') + self.OptionParser.add_option("--spec_file", + action="store", type="string", + dest="spec_file", default='great_rhombicuboct.obj') + self.OptionParser.add_option("--cw_wound", + action="store", type="inkbool", + dest="cw_wound", default='true') +#VEIW SETTINGS + self.OptionParser.add_option("--r1_ax", + action="store", type="string", + dest="r1_ax", default=0) + self.OptionParser.add_option("--r2_ax", + action="store", type="string", + dest="r2_ax", default=0) + self.OptionParser.add_option("--r3_ax", + action="store", type="string", + dest="r3_ax", default=0) + self.OptionParser.add_option("--r4_ax", + action="store", type="string", + dest="r4_ax", default=0) + self.OptionParser.add_option("--r5_ax", + action="store", type="string", + dest="r5_ax", default=0) + self.OptionParser.add_option("--r6_ax", + action="store", type="string", + dest="r6_ax", default=0) + self.OptionParser.add_option("--r1_ang", + action="store", type="float", + dest="r1_ang", default=0) + self.OptionParser.add_option("--r2_ang", + action="store", type="float", + dest="r2_ang", default=0) + self.OptionParser.add_option("--r3_ang", + action="store", type="float", + dest="r3_ang", default=0) + self.OptionParser.add_option("--r4_ang", + action="store", type="float", + dest="r4_ang", default=0) + self.OptionParser.add_option("--r5_ang", + action="store", type="float", + dest="r5_ang", default=0) + self.OptionParser.add_option("--r6_ang", + action="store", type="float", + dest="r6_ang", default=0) + self.OptionParser.add_option("--scl", + action="store", type="float", + dest="scl", default=100.0) +#STYLE SETTINGS + self.OptionParser.add_option("--show", + action="store", type="string", + dest="show", default='faces') + self.OptionParser.add_option("--shade", + action="store", type="inkbool", + dest="shade", default='true') + self.OptionParser.add_option("--f_r", + action="store", type="int", + dest="f_r", default=255) + self.OptionParser.add_option("--f_g", + action="store", type="int", + dest="f_g", default=0) + self.OptionParser.add_option("--f_b", + action="store", type="int", + dest="f_b", default=0) + self.OptionParser.add_option("--f_opac", + action="store", type="int", + dest="f_opac", default=100) + self.OptionParser.add_option("--s_opac", + action="store", type="int", + dest="s_opac", default=100) + self.OptionParser.add_option("--th", + action="store", type="float", + dest="th", default=2) + self.OptionParser.add_option("--lv_x", + action="store", type="float", + dest="lv_x", default=1) + self.OptionParser.add_option("--lv_y", + action="store", type="float", + dest="lv_y", default=1) + self.OptionParser.add_option("--lv_z", + action="store", type="float", + dest="lv_z", default=-2) + self.OptionParser.add_option("--back", + action="store", type="inkbool", + dest="back", default='false') + self.OptionParser.add_option("--norm", + action="store", type="inkbool", + dest="norm", default='true') + self.OptionParser.add_option("--z_sort", + action="store", type="string", + dest="z_sort", default='min') + + + def effect(self): + so = self.options + + st = Style() + st.th = so.th + st.fill= '#ff0000' + st.col = '#000000' + st.r = 2 + st.f_opac = str(so.f_opac/100.0) + st.s_opac = str(so.s_opac/100.0) + st.linecap = 'round' + st.linejoin = 'round' + + file = '' + obj = Obj() #create the object + if so.obj == 'cube': + file = 'cube.obj' + elif so.obj == 't_cube': + file = 'trunc_cube.obj' + elif so.obj == 'sn_cube': + file = 'snub_cube.obj' + elif so.obj == 'cuboct': + file = 'cuboct.obj' + elif so.obj == 'tet': + file = 'tet.obj' + elif so.obj == 't_tet': + file = 'trunc_tet.obj' + elif so.obj == 'oct': + file = 'oct.obj' + elif so.obj == 't_oct': + file = 'trunc_oct.obj' + elif so.obj == 'icos': + file = 'icos.obj' + elif so.obj == 't_icos': + file = 'trunc_icos.obj' + elif so.obj == 's_t_icos': + file = 'small_triam_icos.obj' + elif so.obj == 'g_s_dodec': + file = 'great_stel_dodec.obj' + elif so.obj == 'dodec': + file = 'dodec.obj' + elif so.obj == 'sn_dodec': + file = 'snub_dodec.obj' + elif so.obj == 'g_dodec': + file = 'great_dodec.obj' + elif so.obj == 't_dodec': + file = 'trunc_dodec.obj' + elif so.obj == 'from_file': + file = so.spec_file + get_obj_data(obj, file) + + trans_mat = mat(identity(3, float)) #init. trans matrix as identity matrix + + #perform rotations + for i in range(1, 7):#for each rotation + axis = eval('so.r'+str(i)+'_ax') + angle = eval('so.r'+str(i)+'_ang') *pi/180 + if axis == 'x': + trans_mat = rot_x(trans_mat, angle) + elif axis == 'y': + trans_mat = rot_y(trans_mat, angle) + elif axis == 'z': + trans_mat = rot_z(trans_mat, angle) + + # Embed points in group + #Put in in the centre of the current view + t = 'translate(' + str( self.view_center[0]) + ',' + str( self.view_center[1]) + ')' + #we will put all the rotations in the object name, so it can be repeated in future + proj_attribs = {inkex.addNS('label','inkscape'):obj.name+':'+so.r1_ax+str('%.2f'%so.r1_ang)+':'+ + so.r2_ax+str('%.2f'%so.r2_ang)+':'+ + so.r3_ax+str('%.2f'%so.r3_ang)+':'+ + so.r1_ax+str('%.2f'%so.r4_ang)+':'+ + so.r2_ax+str('%.2f'%so.r5_ang)+':'+ + so.r3_ax+str('%.2f'%so.r6_ang), + 'transform':t } + proj = inkex.etree.SubElement(self.current_layer, 'g', proj_attribs)#the group to put everything in + + vp_pts=[] #the points as projected in the z-axis onto the viewplane + + for i in range(len(obj.vtx)): + vp_pts.append((so.scl* (trans_mat * mat(obj.vtx[i]).T)).T.tolist()[0] )#transform the points at add to vp_pts + + lighting = [so.lv_x,-so.lv_y,so.lv_z] #direction of light vector + lighting = lighting/length(lighting) #normalise + + if so.show == 'vtx': + for i in range(len(vp_pts)): + draw_SVG_dot([vp_pts[i][0],vp_pts[i][1]], st, 'Point'+str(i), proj)#plot points + + elif so.show == 'edg': + if obj.type == 'face':#we must generate the edge list + edge_list = make_edge_list(obj.fce) + else:#we already have an edge list + edge_list = obj.edg + + for i in range(len(edge_list)):#for every edge + pt_1 = vp_pts[ edge_list[i][0]-1 ] #the point at the start + pt_2 = vp_pts[ edge_list[i][1]-1 ] #the point at the end + + draw_SVG_line((pt_1[0], pt_1[1]), + (pt_2[0], pt_2[1]), + st, 'Edge', proj)#plot edges + + elif so.show == 'fce': + if obj.type == 'face':#we have a face list + + if so.cw_wound: rev = -1 #if cw wound, reverse normals + else: rev = 1 + + z_list = [] + + for i in range(len(obj.fce)): + norm = get_normal(vp_pts, obj.fce[i])#get the normal to the face + norm = rev*norm / length(norm)#normalise and reverse if needed + angle = acos( dot(norm, lighting) )#get the angle between the normal and the lighting vector + + + if so.z_sort =='max': + z_sort_param = get_max_z(vp_pts, obj.fce[i]) + elif so.z_sort == 'min': + z_sort_param = get_min_z(vp_pts, obj.fce[i]) + else: + z_sort_param = get_cent_z(vp_pts, obj.fce[i]) + + if so.norm:#if a log of normals is required + if i == 0: + sys.stderr.write('Normal Vectors for each face are: \n\n') + sys.stderr.write('Face '+str(i)+': ' + str(norm) + '\n') + + if so.back: # draw all polygons + z_list.append((z_sort_param, angle, norm, i) ) + elif norm[2] > 0:#ignore backwards-facing faces (back face cull) + z_list.append((z_sort_param, angle, norm, i) ) #record the maximum z-value of the face and angle to light, along with the face ID and normal + + z_list.sort(lambda x, y: cmp(x[0],y[0])) #sort by ascending sort parameter of the face + + for i in range(len(z_list)):#for every polygon that has been sorted + if so.shade: + st.fill = '#' + "%02X" % floor( z_list[i][1]*so.f_r/pi ) \ + + "%02X" % floor( z_list[i][1]*so.f_g/pi ) \ + + "%02X" % floor( z_list[i][1]*so.f_b/pi ) #make the colour string + else: + st.fill = '#' + '%02X' % so.f_r + '%02X' % so.f_g + '%02X' % so.f_b #opaque + + face_no = z_list[i][3]#the number of the face to draw + draw_SVG_poly(vp_pts, obj.fce[ face_no ], st, 'Face:'+str(face_no), proj) + else: + sys.stderr.write('The selected file does not contain face data.\nPlease select point or edge plotting options.') + else: + sys.stderr.write('Internal Error. No view type selected') + +e = Draw_From_Triangle() +e.affect() +