swiss-ephemeris-1.4.2.0: Haskell bindings for the Swiss Ephemeris C library
LicenseAGPL-3
Maintainerswiss-ephemeris@lfborjas.com
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

SwissEphemeris.ChartUtils

Description

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

Documentation

data GlyphInfo a Source #

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.

Constructors

GlyphInfo 

Fields

Instances

Instances details
Eq a => Eq (GlyphInfo a) Source # 
Instance details

Defined in SwissEphemeris.ChartUtils

Methods

(==) :: GlyphInfo a -> GlyphInfo a -> Bool #

(/=) :: GlyphInfo a -> GlyphInfo a -> Bool #

Show a => Show (GlyphInfo a) Source # 
Instance details

Defined in SwissEphemeris.ChartUtils

type PlanetGlyphInfo = GlyphInfo Planet Source #

GlyphInfo specialized to carry Planet names as its extraData.

glyphPlanet :: PlanetGlyphInfo -> Planet Source #

Convenience alias for the extraData accessor, get the Planet conveyed along a glyph info.

gravGroup Source #

Arguments

:: 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.

gravGroup2 Source #

Arguments

:: 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