3D Objects
create 3 balls with vectors sticked on it and pointing toward a certain direction
from visual import*
##3 balls
sphere(pos=vector(0,-5,0),raduis=1,color=color.green)
arrow(pos=vector(0,-5,0),axis=vector(+3,+3,0),color=color.red)
sphere(pos=vector(5,5,0),raduis=1,color=color.green)
arrow(pos=vector(5,5,0),axis=vector(-5,0,0),color=color.red)
sphere(pos=vector(-5,5,0),raduis=1,color=color.green)
arrow(pos=vector(-5,5,0),axis=vector(0,-3,0),color=color.red)
4. after watching variable assignment, create 3 balls with vectors connecting balls
from visual import*
##vectors2
b=sphere(pos=vector(0,-10,0),raduis=3,color=color.green)
c=sphere(pos=vector(5,5,0),raduis=3,color=color.green)
a=sphere(pos=vector(-5,5,0),raduis=3,color=color.green)
arrow(pos=b.pos,axis=c.pos-b.pos,color=color.red)
arrow(pos=c.pos,axis=a.pos-c.pos,color=color.red)
arrow(pos=a.pos,axis=b.pos-a.pos,color=color.red)
4.1 Print command
from visual import*
b=sphere(pos=vector(0,-10,0),raduis=5,color=color.green)
c=sphere(pos=vector(5,5,0),raduis=5,color=color.green)
a=sphere(pos=vector(-5,5,0),raduis=5,color=color.green)
arrow(pos=b.pos,axis=c.pos-b.pos,color=color.red)
arrow(pos=c.pos,axis=a.pos-c.pos,color=color.red)
arrow(pos=a.pos,axis=b.pos-a.pos,color=color.red)
print(a.pos)
The following lines show in the shell:
Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
>>> ================================ RESTART ================================
>>>
>>> ================================ RESTART ================================
>>>
<-5, 5, 0>
No comments:
Post a Comment