Previous Up Next

11.7.4  Vectors: segment vector

The segment and vector commands return and draw vectors. (The segment command can also draw line segments, see section 11.7.3.)

segment takes as arguments a point and a vector. The point indicates the beginning of the result and the vector (given as a list of coordinates) the direction.

segment returns and draws the corresponding vector as a line segment. If the arguments are P and V, then command draws the segment from P to P+V.
Input:

segment([-1,0],[1,1])

Output:

vector takes as arguments two points (or a list with two points) or a point and a vector.

vector returns and draws the corresponding vector. If the arguments are two points, the vector goes from the first to the second point; if the arguments are a point and a vector, then the vector starts at the given point.
Input:

vector([-1,0],[1,i])

or:

vector(-1,i)

or:

V := vector(1,2+i):; vector(-1,V)

Output:


Previous Up Next