Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
Quadrants and trigonometric calculations.
** - WARNING ** - in progress.
- data Quadrant
- quadrant :: Radian -> Quadrant
- type RadialIntersect u = Radian -> Vec2 u
- data QuadrantAlg u = QuadrantAlg {}
- runQuadrantAlg :: Radian -> QuadrantAlg u -> Vec2 u
- hypotenuseQI :: (Real u, Floating u) => u -> u -> RadialIntersect u
- rectangleQI :: (Real u, Floating u) => u -> u -> Radian -> Vec2 u
- hquadrilAcuteQI :: (Real u, Floating u) => u -> u -> Radian -> RadialIntersect u
- hquadrilObtusQI :: (Real u, Floating u) => u -> u -> Radian -> RadialIntersect u
- rectangleQuadrantAlg :: (Real u, Floating u) => u -> u -> QuadrantAlg u
- diamondQuadrantAlg :: (Real u, Floating u) => u -> u -> QuadrantAlg u
- isoscelesTriQuadrantAlg :: (Real u, Floating u) => u -> u -> QuadrantAlg u
- rectRadialVector :: (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
type RadialIntersect u = Radian -> Vec2 uSource
data QuadrantAlg u Source
A Quadrant algorithm.
QuadrantAlg | |
|
runQuadrantAlg :: Radian -> QuadrantAlg u -> Vec2 uSource
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.
hquadrilAcuteQI :: (Real u, Floating u) => u -> u -> Radian -> RadialIntersect uSource
hquadrilAcuteQI
: dx * dy * ang -> RadialIntersect
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
hquadrilObtusQI :: (Real u, Floating u) => u -> u -> Radian -> RadialIntersect uSource
hquadrilObtusQI
: dx * dy * ang -> RadialIntersect
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
rectangleQuadrantAlg
: width * height -> QuadrantAlg
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
diamondQuadrantAlg
: width * height -> QuadrantAlg
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
isoscelesTriQuadrantAlg
: base_width * height -> QuadrantAlg
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