diff --git a/Readme.md b/Readme.md index 14b7128..fbfe581 100644 --- a/Readme.md +++ b/Readme.md @@ -69,7 +69,7 @@ setobject!(vis, PointCloud(verts, colors)) ![demo-points](https://user-images.githubusercontent.com/591886/36703986-3d18e232-1b2c-11e8-8c40-a73e55cc93b6.png) -### Complex Geometries +### Contours ```julia # Visualize a mesh from the level set of a function @@ -83,6 +83,28 @@ setobject!(vis, mesh, ![demo-contour](https://user-images.githubusercontent.com/591886/36703981-37b62ba6-1b2c-11e8-90aa-4c38486732e7.png) +### Polyhedra + +``` +# Visualize a polyhedron from Polyhedra.jl +using Polyhedra +using CDDLib +# Construct a polyhedron in 4 dimensions +ext1 = SimpleVRepresentation([0 1 2 3;0 2 1 3; 1 0 2 3; 1 2 0 3; 2 0 1 3; 2 1 0 3; + 0 1 3 2;0 3 1 2; 1 0 3 2; 1 3 0 2; 3 0 1 2; 3 1 0 2; + 0 3 2 1;0 2 3 1; 3 0 2 1; 3 2 0 1; 2 0 3 1; 2 3 0 1; + 3 1 2 0;3 2 1 0; 1 3 2 0; 1 2 3 0; 2 3 1 0; 2 1 3 0]) +poly1 = CDDPolyhedron{4,Rational{BigInt}}(ext1) + +# Project that polyhedron down to 3 dimensions for visualization +poly2 = project(poly1, [1 1 1; -1 1 1; 0 -2 1; 0 0 -3]) + +# Show the result +setobject!(vis, poly2) +``` + +![polyhedron](https://user-images.githubusercontent.com/591886/37313984-fa3b20c2-2627-11e8-8238-71607a7f16e7.png) + ### Mechanisms Using https://github.com/rdeits/MeshCatMechanisms.jl