Graphics in Julia: Difference between revisions
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
===MeshCat=== | ===MeshCat=== | ||
MeshCat.jl is a Julia wrapper around three.js. It creates its own server and opens a webpage to access the server. | MeshCat.jl is a Julia wrapper around [http://threejs.org three.js] built using [https://github.com/JuliaGizmos/WebIO.jl WebIO.jl]. It creates its own server and opens a webpage to access the server. However, MeshCat.js is a bit lacking in documentation and does not expose all the features of three.js. We may need to extend it for additional features. | ||
Line 8: | Line 8: | ||
* Install Julia | * Install Julia | ||
* Make a new project | * Make a new project | ||
* Add MeshCat, Colors, GeometryTypes, CoordinateTransformations to your project | |||
Line 17: | Line 18: | ||
Example of how to create a quad: | Example of how to create a quad: | ||
<syntaxhighlight lang="julia> | <syntaxhighlight lang="julia> | ||
using MeshCat | |||
using GeometryTypes | using GeometryTypes | ||
vis = Visualizer() | |||
open(vis) | |||
# Load the texture | # Load the texture | ||
Line 28: | Line 33: | ||
# Make the geometry | # Make the geometry | ||
# Note that you can also use Array{Float32, 1} instead of Point{3, Float32} for the vertices and the normals. | |||
quadGeometry = HomogenousMesh( | quadGeometry = HomogenousMesh( | ||
vertices = [Point(0,0,0), Point(0,1,0), Point(0, 0, 1), Point(0, 1, 1)], | vertices = [Point(0,0,0), Point(0,1,0), Point(0, 0, 1), Point(0, 1, 1)], | ||
Line 53: | Line 59: | ||
settransform!(vis["robots", "valkyrie"], Translation(0.5, -0.5, 0.5)) | settransform!(vis["robots", "valkyrie"], Translation(0.5, -0.5, 0.5)) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
====Updating Geometry==== | |||
After you update your geometry, say by changing your vertex positions, | |||
you need to call <code>setobject!</code> again for it to update. |