Created
December 2, 2019 21:07
-
-
Save SimonDanisch/40a2e27bf1757c212a590ae36bc4fbb1 to your computer and use it in GitHub Desktop.
mutating poly in place
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Makie, GeometryTypes | |
points = decompose(Point2f0, Circle(Point2f0(0), 1f0)) | |
points[1] ≈ points[end] # first and last are the same, so they will get removed | |
# lets remove it ourselves, so that we can more easily map over it! | |
pop!(points) | |
mesh = GLNormalMesh(points) | |
# Visualize poly | |
scene = Makie.mesh(mesh, shading = false) | |
mplot = scene[end] | |
# Points get converted to 3d + get one end point | |
new_points = map(x->Point3f0(x[1] + rand() * 0.1, x[2] + rand() * 0.1, 0.0), points) | |
# update mesh inplace | |
mesh.vertices[:] = new_points | |
# Update plot with new mesh | |
mplot[1] = mesh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment