Adding two vectors¶
Adding two vectors¶
1# This example adds the values of one vector to another and outputs
2# the values of the modified vector to the output toolbox.
3
4# Create a local variable for the impact.creator object
5c = impact.creator
6
7# Create two vectors
8v1 = c.vector(10,20)
9v2 = c.vector(30,40)
10
11# Add v2 to v1
12v1.add(v2)
13
14# Create a local variable for the output toolbox
15ot = impact.gui.output_toolbox
16
17# Display the result of the addition in the output toolbox
18ot.add(v1.x)
19ot.add(v1.y)
20