File: shadow3.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 (15 lines) | stat: -rw-r--r-- 505 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""Project a shadow of a mesh in a specified direction"""
from vedo import *

settings.use_depth_peeling = False # depending on your system

msh = Mesh(dataurl+"man.vtk").c("k5")

plane = Plane(pos=(0,0,-1.6), normal=(0,0,1), s=[6,7]).alpha(0.2)

shad = msh.clone().project_on_plane(plane, direction=(0.5,1,-1))
shad.c("k7").alpha(1).lighting("off").use_bounds(False)

plane.shift(0,-0,0.001) # a small tolerance to avoid coplanarity with shad

show(msh, plane, shad, __doc__, viewup='z', axes=7).close()