Skip to content

Commit

Permalink
update camera in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed May 14, 2024
1 parent b0b25a3 commit 30fadd6
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 35 deletions.
8 changes: 4 additions & 4 deletions docs/examples/booleans.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
A = box.to_vertices_and_faces(triangulated=True)

sphere = Sphere(1, point=[1, 1, 1])
B = sphere.to_vertices_and_faces(u=32, v=32, triangulated=True)
B = sphere.to_vertices_and_faces(u=64, v=64, triangulated=True)

# ==============================================================================
# Remesh the sphere
Expand All @@ -37,8 +37,8 @@

viewer = Viewer()

# viewer.ui.window.viewport.view3d.camera.position = [...]
# viewer.ui.window.viewport.view3d.camera.target = [...]
viewer.renderer.camera.target = [0, 0, 0]
viewer.renderer.camera.position = [4, -6, 3]

viewer.scene.add(shape, linewidth=2, show_points=False)
viewer.scene.add(shape, lineswidth=1, show_points=False)
viewer.show()
6 changes: 3 additions & 3 deletions docs/examples/intersections.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@

viewer = Viewer()

# viewer.ui.window.viewport.view3d.camera.position = [...]
# viewer.ui.window.viewport.view3d.camera.target = [...]
viewer.renderer.camera.target = [0, 0, 0]
viewer.renderer.camera.position = [4, -6, 3]

viewer.scene.add(Mesh.from_vertices_and_faces(*A), facecolor=(1.0, 0.0, 0.0), show_points=False)
viewer.scene.add(Mesh.from_vertices_and_faces(*B), facecolor=(0.0, 1.0, 0.0), show_points=False, opacity=0.3)
Expand All @@ -48,7 +48,7 @@
viewer.scene.add(
polyline,
linecolor=(0.0, 0.0, 1.0),
linewidth=3,
lineswidth=3,
pointcolor=(0.0, 0.0, 1.0),
pointsize=20,
show_points=True,
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/mesh_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

viewer = Viewer()

# viewer.ui.window.viewport.view3d.camera.position = [...]
# viewer.ui.window.viewport.view3d.camera.target = [...]
viewer.renderer.camera.target = [0, 0, 0]
viewer.renderer.camera.position = [4, -6, 3]

for color, vertices in zip([Color.blue(), Color.pink()], mesh.connected_vertices()):
faces = []
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/pointset_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
for x, y, z in points:
viewer.scene.add(Point(x, y, z).scaled(1e-3, 1e-3, 1e-3))

# viewer.view.camera.zoom_extents()
# viewer.renderer.camera.zoom_extents()

viewer.show()
4 changes: 2 additions & 2 deletions docs/examples/pointsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

viewer = Viewer()

# viewer.view.camera.scale = 1000
# viewer.renderer.camera.scale = 1000
# viewer.view.grid.cell_size = 1000

viewer.scene.add(cloud2)
viewer.scene.add(could3, pointcolor=(1.0, 0.0, 0.0))

# viewer.view.camera.zoom_extents()
# viewer.renderer.camera.zoom_extents()
viewer.show()
4 changes: 2 additions & 2 deletions docs/examples/pointsets_normals.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@

viewer = Viewer()

# viewer.view.camera.scale = 1000
# viewer.renderer.camera.scale = 1000
# viewer.view.grid.cell_size = 1000

# line_collection = Collection(lines, line_properties)
# viewer.scene.add(Pointcloud(points))
# viewer.scene.add(line_collection)

# viewer.view.camera.zoom_extents()
# viewer.renderer.camera.zoom_extents()

viewer.show()
4 changes: 2 additions & 2 deletions docs/examples/pointsets_smoothing.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@

viewer = Viewer()

# viewer.view.camera.scale = 1000
# viewer.renderer.camera.scale = 1000
# viewer.view.grid.cell_size = 1000

# viewer.scene.add(cloud_original)
# viewer.scene.add(cloud_transformed)

# viewer.view.camera.zoom_extents()
# viewer.renderer.camera.zoom_extents()

viewer.show()
4 changes: 2 additions & 2 deletions docs/examples/polygonal_poinset_reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@

viewer = Viewer()

# viewer.view.camera.position = [5, -4, 2]
# viewer.view.camera.look_at([0, 1, 0])
# viewer.renderer.camera.position = [5, -4, 2]
# viewer.renderer.camera.target = [0, 1, 0])

# viewer.scene.add(Pointcloud(points))

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

viewer = Viewer(width=1600, height=900)

# viewer.view.camera.position = [-5, -5, 1.5]
# viewer.view.camera.look_at([0, 0, 1.5])
# viewer.renderer.camera.position = [-5, -5, 1.5]
# viewer.renderer.camera.target = [0, 0, 1.5])

viewer.scene.add(mesh, show_points=False)
# viewer.scene.add(cloud)
Expand Down
5 changes: 3 additions & 2 deletions docs/examples/remeshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
# ==============================================================================

viewer = Viewer(width=1600, height=900)
# viewer.view.camera.position = [0, -25, 10]
# viewer.view.camera.look_at([0, 0, 0])

viewer.renderer.camera.target = [0, 0, 0]
viewer.renderer.camera.position = [0, -25, 10]

viewer.scene.add(bunny.transformed(Translation.from_vector([-10, 0, 0])), show_points=False)
viewer.scene.add(mesh.transformed(Translation.from_vector([+10, 0, 0])), show_points=False)
Expand Down
8 changes: 5 additions & 3 deletions docs/examples/skeletonization.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@

viewer = Viewer(width=1600, height=900)

# viewer.view.camera.position = [-5, -5, 1.5]
# viewer.view.camera.look_at([0, 0, 1.5])
viewer.renderer.camera.target = [0, 0, 1.5]
viewer.renderer.camera.position = [-5, -5, 1.5]

viewer.scene.add(mesh, opacity=0.5, show_points=False)
# viewer.scene.add(Collection(polylines), linewidth=5)

for polyline in polylines:
viewer.scene.add(polyline, lineswidth=5, show_points=False)

viewer.show()
6 changes: 3 additions & 3 deletions docs/examples/slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@

viewer = Viewer(width=1600, height=900)

# viewer.view.camera.position = [-40, -70, 40]
# viewer.view.camera.look_at([0, 0, 20])
viewer.renderer.camera.target = [0, 0, 20]
viewer.renderer.camera.position = [-40, -70, 40]

viewer.scene.add(benchy, show_lines=False, show_points=False, opacity=0.5)

for polyline in polylines:
viewer.scene.add(polyline, linecolor=Color.grey(), linewidth=2, show_points=False)
viewer.scene.add(polyline, linecolor=Color.grey(), lineswidth=2, show_points=False)

viewer.show()
4 changes: 1 addition & 3 deletions docs/examples/straight_skeleton_2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from compas.datastructures import Graph
from compas.geometry import Polygon
from compas_viewer import Viewer

from compas_cgal.straight_skeleton_2 import create_interior_straight_skeleton
from compas_viewer import Viewer

points = [
(-1.91, 3.59, 0.0),
Expand All @@ -25,7 +24,6 @@
# ==============================================================================

viewer = Viewer(width=1600, height=900)
viewer.renderer_config.show_grid = False
viewer.scene.add(graph, edgecolor=(1.0, 0.0, 0.0))
viewer.scene.add(polygon)
viewer.show()
4 changes: 2 additions & 2 deletions docs/examples/subd.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

viewer = Viewer(width=1600, height=900)

# viewer.view.camera.position = [5, -2, 0.5]
# viewer.view.camera.look_at([3, 1, 0.5])
viewer.renderer.camera.target = [3, 1, 0.5]
viewer.renderer.camera.position = [5, -2, 0.5]

viewer.scene.add(box.to_mesh(), show_points=False)
viewer.scene.add(S2.to_mesh(), show_points=False)
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@

viewer = Viewer(width=1600, height=900)

# viewer.view.camera.position = [0, -1, 13]
# viewer.view.camera.look_at([0, 0, 0])
viewer.renderer.camera.target = [0, 0, 0]
viewer.renderer.camera.position = [0, -1, 13]

viewer.scene.add(cdt.transformed(Translation.from_vector([-5, 0, 0])))
viewer.scene.add(rdm.transformed(Translation.from_vector([+5, 0, 0])))
Expand Down

0 comments on commit 30fadd6

Please sign in to comment.