HELP VEC                                     Jocelyn Paine November 1992


This module exports some predicates for handling vectors. These are
useful in Eden when calculating how the bug has to turn, and so on. You
load them by doing
    library(vec).


Introduction
------------

The module defines predicates for adding, subtracting, and scalar
multiplying. It also exports two predicates, turn2 and turn3, which can
be used if you know successive points or forwardvectors along Bug's
path, and you want to calculate what action it must take.

Vectors are represented as lists, [X,Y].


Procedures exported
-------------------


PUBLIC vec_add( V1+, V2+, V- ):
PUBLIC vec_sub( V1+, V2+, V- ):

Return vectors corresponding to V1+V2 and V1-V2.


PUBLIC vec_smult( S+, V+, SV- ):

Returns the vector SV, where S is a scalar.


PUBLIC turn2( V1+, V2+, T- ):

Indicates how V1 must be rotated to get V2. It returns an atom in T
which is
    'forward' if V1 and V2 are colinear and point in the same
        direction;
    'back' if colinear and in opposite directions;
    'right' if V2 is the result of rotating V1 to the right;
    'left' if V2 is the result of rotating V1 to the left.

This predicate is useful when calculating how a bug must turn, given
an existing bearing (forwardvector) V1 and a new one V2.


PUBLIC turn3( P0+, P1+, P2+, T- ):

This is equivalent to
    turn2( <P1-P0>, <P2-P1>, T )

This predicate is useful when calculating how a bug must turn, given
three successive points P0, P1, P2 on its path.
