From 40d9a2ca7810effbd1323c47ba9004e0c205c785 Mon Sep 17 00:00:00 2001 From: Matthew Huebert Date: Wed, 14 Feb 2024 13:23:50 +0100 Subject: [PATCH] formatting --- bayes3d/genjax/model.py | 2 +- bayes3d/viser.py | 35 +++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/bayes3d/genjax/model.py b/bayes3d/genjax/model.py index d49b7d3f..911b7775 100644 --- a/bayes3d/genjax/model.py +++ b/bayes3d/genjax/model.py @@ -302,4 +302,4 @@ def update_address(trace, key, address, value): key, genjax.choice_map({address: value}), tuple(map(lambda v: Diff(v, UnknownChange), trace.args)), - )[0] \ No newline at end of file + )[0] diff --git a/bayes3d/viser.py b/bayes3d/viser.py index ca9e8a33..14289e35 100644 --- a/bayes3d/viser.py +++ b/bayes3d/viser.py @@ -1,9 +1,13 @@ -import viser +import os import random -import time -import imageio.v3 as iio -import numpy as onp +import numpy as np +import trimesh +import viser + +import bayes3d as b + +server = viser.ViserServer() server.add_frame( "/tree", @@ -18,22 +22,16 @@ client_handle = list(server.get_clients().values())[0] -p,q = client_handle.camera.position, client_handle.camera.wxyz +p, q = client_handle.camera.position, client_handle.camera.wxyz client_handle.camera.position = p client_handle.camera.wxyz = q -img = client_handle.camera.get_render(100,100) - +img = client_handle.camera.get_render(100, 100) - -server = viser.ViserServer() - -import os -import trimesh i = 9 model_dir = os.path.join(b.utils.get_assets_dir(), "ycb_video_models/models") -mesh_path = os.path.join(model_dir, b.utils.ycb_loader.MODEL_NAMES[i],"textured.obj") +mesh_path = os.path.join(model_dir, b.utils.ycb_loader.MODEL_NAMES[i], "textured.obj") mesh = trimesh.load(mesh_path) server.add_mesh_trimesh( @@ -43,16 +41,21 @@ server.reset_scene() - server.add_mesh( name="/trimesh", vertices=mesh.vertices, faces=mesh.faces, ) -sphere = trimesh.creation.uv_sphere(0.1, (10,10,)) +sphere = trimesh.creation.uv_sphere( + 0.1, + ( + 10, + 10, + ), +) server.add_mesh( name="/trimesh2", vertices=sphere.vertices * np.array([1.0, 2.0, 3.0]), faces=sphere.faces, -) \ No newline at end of file +)