Graphics in Julia
A guide on making graphics visualizations in Julia
MeshCat
MeshCat is a Julia wrapper around three.js. It creates its own server and opens a webpage to access the server.
Getting Started
- Install Julia
- Make a new project
Geometry
using GeometryTypes
# Load the texture
image = PngImage(joinpath(@__DIR__, "circuit_pattern.png"))
texture = Texture(image=image)
# Make the material from the texture
# TODO: Figure out how to set `mat.transparent = true` from within Julia
material = MeshLambertMaterial(map=texture)
# Make the geometry
quadGeometry = HomogenousMesh(
vertices = [Point(0,0,0), Point(0,1,0), Point(0, 0, 1), Point(0, 1, 1)],
normals = [Point(1,0,0),Point(1,0,0),Point(1,0,0),Point(1,0,0)],
faces = [Triangle(1,2,3), Triangle(2,3,4)],
texturecoordinates = [Point(0.0f0,0), Point(1.0f0,0), Point(0.0f0,1), Point(1.0f0,1)]
);
# Add the object to the scene
setobject!(vis["myquad"], quadGeometry , material)
# Set the position
settransform!(vis["myquad"], Translation(0.5, -0.5, 0.5))