wumpus-basic-0.18.0: Basic objects and system code built on Wumpus-Core.

Portability GHC highly unstable Stephen Tetley

Description

** - WARNING ** - in progress.

Synopsis

# Documentation

Constructors

Instances

Get the quadrant of an angle.

Constructors

hypotenuseQI :: (Real u, Floating u) => u -> u -> RadialIntersect uSource

triangleQI : dx * dy -> RadialIntersect

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.

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.

Find where a line from (0,0) with elevation ang intersects a quadrilateral in H acute form in QI.

ang must be in the @range 0 < ang <= 90@.

dx (top width @bc@) and dy (height @ab) must be positive.

Horizontal acute quadrilateral (H because one of the two "sides of interest" is horizontal, acute because the angle of interest bcd is acute:

b---*----c
|       /
|      %
|     /
a----d

Find where a line from (0,0) with elevation ang intersects a quadrilateral in H obtus form in QI.

ang must be in the @range 0 < ang <= 90@.

dx (top width @bc@) and dy (height @ab) must be positive.

H Obtus quadrilateral (H because one of the two "sides of interest" is horizontal, obtus because the angle interest bcd is obtuse:

b---*----c
|         \
|          %
|           \
a------------d

rectangleQuadrantAlg :: (Real u, Floating u) => u -> u -> QuadrantAlg uSource

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.

diamondQuadrantAlg :: (Real u, Floating u) => u -> u -> QuadrantAlg uSource

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.

isoscelesTriQuadrantAlg :: (Real u, Floating u) => u -> u -> QuadrantAlg uSource

Find where a radial line extended from (0,0) with the elevation ang intersects with an enclosing isosceles triangle.

Note the center of the triangle (0,0) is the centroid not the incenter.

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

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.

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