# generative-toolbelt.point

A set of function to create, manipulate, and draw Points and also Vector structures. Points are structured as maps like this: {:x 100 :y 100}. Vectors are strucutred as maps like this: {:len 100 :dir 60}

### draw-line

`(draw-line l & [drawOptions])`

Draws a Line into the current graphics canvas.

### draw-point

`(draw-point p)`

`(draw-point p size)`

Draws a Point into the current graphics canvas.

### flip-dir

`(flip-dir vect)`

Flip the direction of a by 180 degrees vector. Returns a Vector structure.

### make-line

`(make-line a b)`

Creates a Line with absolutes coordinates. Returns a Line.

### make-point

`(make-point x y)`

Creates a Point with absolutes coordinates. Returns a Point.

### make-vec

`(make-vec l d)`

Creates a Vector structure with length `l` and direction `d` in radians.

### mkln

`(mkln ax ay bx by)`

Creates a Line with canvas-relative coordinates. Returns a Line.

### mkpt

`(mkpt x y)`

Creates a Point with canvas-relative coordinates. Returns a Point.

### point-angle

`(point-angle a b)`

Calculate the angle between two Points. Returns a number.

### point-between

`(point-between a b pos)`

Creates a new intermediate point between two Points `pos` is a floating number between 0 and 1 that defines the distance between the two points. 0 returns point `a`, 1 returns point `b`, 0.5 returns the middle point between `a` and `b`, etc... Returns a Point.

### point-distance

`(point-distance a b)`

Calculate the distance between two Points. Returns a number.

### point-mirror

`(point-mirror points mode)`

**NEEDS UPDATE** Mirror a sequence of points vertically, horizontally, or both. `mode`

can be `:h`

for horizontal only, `:v`

for vertical only, or `:hv`

for both horizontal and vertical. Returns a sequence of Points.

### point-move-by-vector

`(point-move-by-vector point vect)`

Creates a new Point which is moved by a certain ammount in a certain direction defined by a Vector structure. Returns a Point.

### point-to-vector

`(point-to-vector p)`

Converts a Point structure to a Vector structure. Returns a Vector.

### reverse-line

`(reverse-line {:keys [a b]})`

Reverse a Line swapping its Points. Returns a Line.

### tweak-len

`(tweak-len vect value)`

Changes the length of the vector multiplicating its length by `value`. Returns a Vector structure.

### vector-to-point

`(vector-to-point v)`

Converts a Vector structure to a Point structure. Returns a Point.