next up previous contents index
Next: 3.8.1.3 Lines Up: Basic constructions Previous: 3.8.1.1 Points   Contents   Index


3.8.1.2 Vectors

Vectors are defined using the command vector :


 - funct -> vector U


creates a vector whose name is U. The default coordinates of this vector are (0,0). The command coord can then be used to change them :


 - funct -> coord U 2.2 3.1


will change the coordinates to (2.2,3.1). The numerical parameters can be expressions understood by the expression evaluator of the command interpreter. For example


 - funct -> coord U x+sin(t) 3*y


The command show is used to print the coordinates of a vector :


 - funct -> show U


will print something like


x = 2.2
y = 3.1


and the variables vector_x and vector_y will contain the coordinates of the point. They can be used in arguments of subsequent commands.

Addition, substraction, multiplication by a scalar can be used for vectors as for usual numerical objects (see the documentation of interpcom). For example, if U, V, W are vectors,


 - funct -> add U V W


will add U to V and put the result in W. It is possible to define the vector from one point to another :


 - funct -> vector_p A B U


Here A, B are points and U a vector, previously defined. This command puts in U the vector from A to B. Conversely, given a point and a vector, there is a command to compute the point obtained by adding the vector to the point :


 - funct -> point_v A U B


will add U to A and put the result in B.

Vectors can be acted on by linear transforms (cf. 3.8.2). The scalar and exterior product of two vectors can be computed using the commands int_prod and ext_prod respectively (cf. 3.9).


next up previous contents index
Next: 3.8.1.3 Lines Up: Basic constructions Previous: 3.8.1.1 Points   Contents   Index
2009-11-12