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

Stability | highly unstable |

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

Anchor points on shapes, bounding boxes, etc.

Anchors are addressable positions, an examplary use is taking anchors on node shapes to get the start and end points for connectors in a network (graph) diagram.

- class CenterAnchor t where
- class CardinalAnchor t where
- class CardinalAnchor2 t where
- class RadialAnchor t where
- radialAnchor :: DUnit t ~ u => Radian -> t -> Point2 u

- northwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor t, u ~ DUnit t) => u -> t -> Point2 u
- southwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor t, u ~ DUnit t) => u -> t -> Point2 u
- eastwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor t, u ~ DUnit t) => u -> t -> Point2 u
- westwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor t, u ~ DUnit t) => u -> t -> Point2 u
- northeastwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor2 t, u ~ DUnit t) => u -> t -> Point2 u
- southeastwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor2 t, u ~ DUnit t) => u -> t -> Point2 u
- southwestwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor2 t, u ~ DUnit t) => u -> t -> Point2 u
- northwestwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor2 t, u ~ DUnit t) => u -> t -> Point2 u
- radialConnectorPoints :: (Real u, Floating u, CenterAnchor t1, RadialAnchor t1, CenterAnchor t2, RadialAnchor t2, u ~ DUnit t1, DUnit t1 ~ DUnit t2) => t1 -> t2 -> (Point2 u, Point2 u)

# Anchors

class CardinalAnchor t whereSource

Cardinal (compass) positions on an object.

Note - in TikZ cardinal anchors are not necessarily at the equivalent radial position, for instance reactangle north-east is the top-right corner whether or not this is incident at 45deg.

Wumpus generally follows the TikZ convention.

north :: DUnit t ~ u => t -> Point2 uSource

south :: DUnit t ~ u => t -> Point2 uSource

Fractional u => CardinalAnchor (BoundingBox u) |

class CardinalAnchor2 t whereSource

Secondary group of cardinal (compass) positions on an object.

It seems possible that for some objects defining the primary compass points (north, south,...) will be straight-forward whereas defining the secondary compass points may be problemmatic, hence the compass points are split into two classes.

northeast :: DUnit t ~ u => t -> Point2 uSource

southeast :: DUnit t ~ u => t -> Point2 uSource

Fractional u => CardinalAnchor2 (BoundingBox u) |

class RadialAnchor t whereSource

Anchor on a border that can be addressed by an angle.

The angle is counter-clockwise from the right-horizontal, i.e.
0 is *east*.

radialAnchor :: DUnit t ~ u => Radian -> t -> Point2 uSource

# Extended anchor points

northwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor t, u ~ DUnit t) => u -> t -> Point2 uSource

`northwards`

: ` dist * object -> Point `

Project the anchor along a line from the center that goes through the north anchor.

If the distance is zero the answer with be the north anchor.

If the distance is negative the answer within the object before the north anchor.

If the distance is positive the anchor outside the object.

southwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor t, u ~ DUnit t) => u -> t -> Point2 uSource

`southwards`

: ` dist * object -> Point `

Variant of the function `northwards`

, but projecting the line
southwards from the center of the object.

eastwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor t, u ~ DUnit t) => u -> t -> Point2 uSource

`eastwards`

: ` dist * object -> Point `

Variant of the function `northwards`

, but projecting the line
eastwards from the center of the object.

westwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor t, u ~ DUnit t) => u -> t -> Point2 uSource

`westwards`

: ` dist * object -> Point `

Variant of the function `northwards`

, but projecting the line
westwards from the center of the object.

northeastwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor2 t, u ~ DUnit t) => u -> t -> Point2 uSource

`northeastwards`

: ` dist * object -> Point `

Variant of the function `northwards`

, but projecting the line
northeastwards from the center of the object.

southeastwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor2 t, u ~ DUnit t) => u -> t -> Point2 uSource

`southeastwards`

: ` dist * object -> Point `

Variant of the function `northwards`

, but projecting the line
southeastwards from the center of the object.

southwestwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor2 t, u ~ DUnit t) => u -> t -> Point2 uSource

`southwestwards`

: ` dist * object -> Point `

Variant of the function `northwards`

, but projecting the line
southwestwards from the center of the object.

northwestwards :: (Real u, Floating u, CenterAnchor t, CardinalAnchor2 t, u ~ DUnit t) => u -> t -> Point2 uSource

`northwestwards`

: ` dist * object -> Point `

Variant of the function `northwards`

, but projecting the line
northwestwards from the center of the object.

radialConnectorPoints :: (Real u, Floating u, CenterAnchor t1, RadialAnchor t1, CenterAnchor t2, RadialAnchor t2, u ~ DUnit t1, DUnit t1 ~ DUnit t2) => t1 -> t2 -> (Point2 u, Point2 u)Source

`radialConnectorPoints`

: ` object_a * object_b -> (Point_a, Point_b) `

Find the radial connectors points for objects `a`

and `b`

along
the line joining their centers.