Portability | GHC |
---|---|

Stability | highly unstable |

Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |

Quadrants and trigonometric calculations.

** - WARNING ** - in progress.

- data Quadrant
- quadrant :: Radian -> Quadrant
- qiModulo :: Radian -> Radian
- rectRadialVector :: (Real u, Floating u) => u -> u -> Radian -> Vec2 u
- rectangleQI :: (Real u, Floating u) => u -> u -> Radian -> Vec2 u
- diamondRadialVector :: (Real u, Floating u) => u -> u -> Radian -> Vec2 u
- triangleRadialVector :: (Real u, Floating u) => u -> u -> u -> Radian -> Vec2 u
- triangleQI :: (Real u, Floating u) => u -> u -> Radian -> Vec2 u
- rightTrapezoidQI :: (Real u, Floating u) => u -> u -> Radian -> Radian -> Vec2 u
- rightTrapeziumBaseWidth :: Fractional u => u -> u -> Radian -> u

# Documentation

qiModulo :: Radian -> RadianSource

`qiModulo`

: ` ang -> Radian `

Modulo an angle so it lies in quadrant I (north east),
i.e. modulo into the range `0..(pi/2)`

.

rectRadialVector :: (Real u, Floating u) => u -> u -> Radian -> Vec2 uSource

`rectRadialVector`

: ` half_width * half_height * ang -> Vec `

Find where a radial line extended from (0,0) with the elevation
`ang`

intersects with an enclosing rectangle. The rectangle is
centered at (0,0).

Internally the calculation is made in quadrant I (north east), symmetry is used to translate result to the other quadrants.

rectangleQI :: (Real u, Floating u) => u -> u -> Radian -> Vec2 uSource

`rectangleQI`

: ` width * height * ang -> Vec `

Find where a line from (0,0) in direction `ang`

intersects the
top or right side of a rectangle in QI (left side is the
y-axis, bottom is the x-axis).

ang must be in the @range 0 < ang <= 90 deg@. width and height must be positive.

diamondRadialVector :: (Real u, Floating u) => u -> u -> Radian -> Vec2 uSource

`diamondRadialVector`

: ` half_width * half_height * ang -> Vec `

Find where a radial line extended from (0,0) with the elevation
`ang`

intersects with an enclosing diamond. The diamond is
centered at (0,0).

Internally the calculation is made in quadrant I (north east), symmetry is used to translate result to the other quadrants.

triangleRadialVector :: (Real u, Floating u) => u -> u -> u -> Radian -> Vec2 uSource

`triangleRadialVector`

: ```
half_base_width * height_minor *
height_minor * ang -> Vec
```

Find where a radial line extended from (0,0) with the elevation
`ang`

intersects with an enclosing triangle. The triangle has
the centroid at (0,0), so solutions in quadrants I and II are
intersections with a simple line. Intersections in quadrants
III and IV can intersect either the respective side or the
base.

triangleQI :: (Real u, Floating u) => u -> u -> Radian -> Vec2 uSource

`triangleQI`

: ` width * height * ang -> Vec `

Find where a line from (0,0) with elevation `ang`

intersects
the hypotenuse a right triangle in QI (the legs of the triangle
take the x and y-axes).

ang must be in the @range 0 < ang <= 90@. width and height must be positive.

rightTrapezoidQI :: (Real u, Floating u) => u -> u -> Radian -> Radian -> Vec2 uSource

`rightTrapezoidQI`

: ` top_width * height * top_right_ang -> Vec `

Find where a line from (0,0) with elevation `ang`

intersects
the either the lines A_B or B_D in a right trapezoid in QI.

The right trapezoid has a variable right side. Left side is the y-axis (C_A), bottom side is the x-axis (C_D), top side is parallel to the x-axis (A_B).

A B ----- | \ | \ ------- C D

A B ------- | / | / ----- C D

ang must be in the range 0 < ang <= 90. top_width and height must be positive.

rightTrapeziumBaseWidth :: Fractional u => u -> u -> Radian -> uSource

`rightTrapeziumBaseWidth`

: ` top_width * height * top_right_ang -> Length `

Find the length of the line C_D:

A B ----- | \ | \ ------- C D

A B ------- | / | / ----- C D