File: align6.py

package info (click to toggle)
vedo 2025.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,404 kB
  • sloc: python: 64,792; javascript: 1,932; xml: 437; sh: 139; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 894 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

"""Align to bounding boxes. Force the Mesh into the empty box."""
from vedo import *

# Load a mesh and color it silver
msh1 = Mesh(dataurl + "cessna.vtk").color("silver")

# Create axes for the original mesh
axes1 = Axes(msh1)

# Create a wireframe cube at a specified position
cube = Cube().pos(2, 1, 0).wireframe()

# Clone the mesh and align it to the bounding box of the cube
msh2 = msh1.clone().align_to_bounding_box(cube)

# Create axes for the aligned mesh
axes2 = Axes(msh2)

# Set up a Plotter object with 2 subrenderers
plt = Plotter(N=2)

# Add the original mesh, axes, and cube in the left renderer with the script description
plt.at(0).add(msh1, axes1, cube, __doc__)

# Add the aligned mesh and axes in the right renderer, viewing from the top
plt.at(1).add(msh2, axes2, cube)

# Show all and close the plotter when done
plt.show(viewup='z', zoom=0.6)
plt.interactive().close()