Over the weekend, Professor Mason had us learn VPyhton from some YouTube videos, and complete the challenge at the end of two videos.
The Vectors1 final output
The Vectors2 final output
The console from the program using the "print" command.
The programming was, overall, very simple in nature and easy to follow. The code for the programs can be found below.
Vectors1:
from __future__ import division
from visual import *
sphere(pos = vector(0,0,0), radius = 1, color = color.red)
arrow(pos = vector(0,0,0), axis = vector(-3,0,0), color = color.blue)
sphere(pos = vector(0,-6,0), radius = 1, color = color.red)
arrow(pos = vector(0,-6,0), axis = vector(3,3,0), color = color.blue)
sphere(pos = vector(-3,-3,0), radius = 1, color = color.red)
arrow(pos = vector(-3,-3,0), axis = vector(0,-3,0), color = color.blue)
Vector2:
from __future__ import division
from visual import *
s1 = sphere(pos = vector(-3,0,0), radius = 1, color = color.red)
s2 = sphere(pos = vector(3,3,0), radius = 1, color = color.red)
s3 = sphere(pos = vector(3,-3,0), radius = 1, color = color.red)
arrow(pos=s2.pos, axis = s1.pos - s2.pos, color = color.blue)
arrow(pos=s1.pos, axis = s3.pos - s1.pos, color = color.blue)
arrow(pos=s3.pos, axis = s2.pos - s3.pos, color = color.blue)
print(s2.color)



No comments:
Post a Comment