Composite of Clipped CopiesΒΆ
The Composite of Copies example surface.
import copy
import numpy as np
import s3dlib.surface as s3d
#.. Composite of Clipped Copies
# 2. Setup and map surface .........................................
rez = 6
top = s3d.PlanarSurface(rez, basetype='oct1')
top.map_geom_from_image('data/python_elevation.png',0.05)
top.clip(lambda c : c[2] > 0.005)
front = copy.copy(top)
side = copy.copy(top)
bottom = copy.copy(top)
backside = copy.copy(top)
top.transform(translate=[0,0,1])
backfront = copy.copy(top)
bottom.transform(rotate=s3d.eulerRot(0,180), translate=[0,0,-1])
front.transform(rotate=s3d.eulerRot(0,90), translate=[0,-1,0])
backfront.transform(rotate=s3d.eulerRot(180,90), translate=[0,0,0])
side.transform(rotate=s3d.eulerRot(90,90), translate=[1,0,0])
backside.transform(rotate=s3d.eulerRot(-90,90), translate=[-1,0,0])
cube = (top+front+side+bottom+backfront+backside)
s3d.save_surfgeom_to_obj('obj_files/pycube_surface.obj',cube)