You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dstoeckel edited this page Mar 16, 2015
·
2 revisions
How can I create a simple geometric object in BALLView?
The following example creates a simple box with given color:
# specify dimensions of the new boxsize=3v1=Vector3(0.)
v2=Vector3(size, 0, 0)
v3=Vector3(0, size, 0)
v4=Vector3(0, 0, size)
# create a red boxcolored_box=Box(v1, v2, v3, v4)
colored_box.setColor(ColorRGBA(1, 0, 0, 0.8))
# create a representation for the boxr=Representation()
r.insert(colored_box)
# add the representation to the main controlgetMainControl().insert(r)
# update the representationgetMainControl().update(r)
Here a sphere is created:
# specify radius and position (center) of the spherer=4pos=Vector3(0.)
# create a sphere with given radius and centers=Sphere()
s.setRadius(r)
s.setPosition(pos)
color=ColorRGBA(1, 0, 0, 0.8)
s.setColor(color)
# create/update the representation for the boxr=Representation()
r.insert(s)
getMainControl().insert(r)
getMainControl().update(r)
NOTE:
The examples are intended for usage within BALLView.