License | AGPL-3 |
---|---|
Maintainer | swiss-ephemeris@lfborjas.com |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Utility functions for chart drawing functionality. Uses the C code shared by the swiss ephemeris authors in the official mailing list: https://groups.io/g/swisseph/message/5568
Synopsis
- data GlyphInfo a = GlyphInfo {
- originalPosition :: Double
- glyphSize :: (Double, Double)
- placedPosition :: Double
- sectorNumber :: Int
- sequenceNumber :: Int
- levelNumber :: Int
- glyphScale :: Double
- extraData :: a
- type PlanetGlyphInfo = GlyphInfo Planet
- glyphPlanet :: PlanetGlyphInfo -> Planet
- gravGroup :: HasEclipticLongitude a => (Double, Double) -> [(Planet, a)] -> [Double] -> Either String [PlanetGlyphInfo]
- gravGroupEasy :: HasEclipticLongitude a => Double -> [(Planet, a)] -> [HouseCusp] -> Either String [PlanetGlyphInfo]
- gravGroup2 :: HasEclipticLongitude a => (Double, Double) -> [(Planet, a)] -> [Double] -> Bool -> Either String [PlanetGlyphInfo]
- gravGroup2Easy :: HasEclipticLongitude a => Double -> [(Planet, a)] -> [HouseCusp] -> Bool -> Either String [PlanetGlyphInfo]
Documentation
Information about a glyph
(planet or some other object
one intends to render within a circular chart) indicating
suggested position and scale as decided by gravGroup
or gravGroup2
to minimize collisions without affecting
the sequence of a list of objects, or the sectors
within which they may be grouped.
GlyphInfo | |
|
type PlanetGlyphInfo = GlyphInfo Planet Source #
GlyphInfo
specialized to carry Planet
names
as its extraData
.
glyphPlanet :: PlanetGlyphInfo -> Planet Source #
:: HasEclipticLongitude a | |
=> (Double, Double) | lwidth, rwidth |
-> [(Planet, a)] | list of pre-calculated positions |
-> [Double] | list of "sectors" (e.g. house cusps + end of last cusp) |
-> Either String [PlanetGlyphInfo] |
Given dimensions, planet positions and "sectors" within which
the planets are meant to be drawn as glyphs, return a list
pairing each position with a PlanetGlyphInfo
that not only
remembers the position's planet, it's guaranteed to place it
in the same sector and sequence it started in, but moved as to
avoid colliding with other nearby planets or sector boundaries.
Note that "sectors" are usually cusps, but one must take that they're
sorted or "linearized": no sector should jump over 0/360, and the
last sector should mark the "end" of the circle.
See gravGroupEasy
for an approach
that incorporates the advice of Alois, from astro.com: https://groups.io/g/swisseph/message/5568
(in short: make all positions, planets and sectors, relative to the first sector,
to ensure there's no "jumping" the 360 degree mark.)
gravGroupEasy :: HasEclipticLongitude a => Double -> [(Planet, a)] -> [HouseCusp] -> Either String [PlanetGlyphInfo] Source #
Easy version of gravGroup
that:
- Assums glyphs are square/symmetrical, so the left and right widths are just half of the provided width, each.
- Will "linearize" all positions before processing by setting them to be relative to the first cusp/sector, and correct them afterwards.
:: HasEclipticLongitude a | |
=> (Double, Double) | lwidth, rwidth |
-> [(Planet, a)] | list of pre-calculated positions |
-> [Double] | list of "sectors" (e.g. house cusps + end of last cusp) (can be empty, indicating that we're working in a non-subdivided circle.) |
-> Bool | allow planets to be moved up or down a level? |
-> Either String [PlanetGlyphInfo] |
Same semantics and warnings as gravGroup
, but allows a couple of things for
more advanced (or crowded) applications:
- Can send an empty list of sectors, to indicate that there's no subdivisions in the circle.
- Can specify if planets can be pushed to an "inner" level if they're too crowded in their assigned sector. Useful when drawing several objects in a chart with many/tight sectors.
With a non-empty list of sectors, and not allowing shifting, this is essentially
a slightly slower version of gravGroup
.
gravGroup2Easy :: HasEclipticLongitude a => Double -> [(Planet, a)] -> [HouseCusp] -> Bool -> Either String [PlanetGlyphInfo] Source #
Easy version of gravGroup2
, same provisions as gravGroupEasy