Module

Hylograph.Isometric.Painter

Package
purescript-hylograph-isometric
Repository
afcondon/purescript-hylograph-isometric

The painter's order: what to draw first so that nearer things overpaint farther ones.

Marks are compared by their footprints on the floor. For things standing on one floor (prisms of any heights, discs, spikes), one can hide another only if a line running horizontally towards the camera crosses both, and then whichever that line meets first is behind. That relation is acyclic for disjoint convex footprints, so a topological sort of it is a correct order, from any azimuth: not only the four isometric viewpoints. A plain sort by distance is not, as soon as footprints differ in size.

Footprints that overlap can make a cycle; one is then broken at the farthest mark left, so the order is always total.

#paintersOrder Source

paintersOrder :: forall a. Camera -> (a -> Outline) -> Array a -> Array a

The items in an order to draw them in, back to front.

#behind Source

behind :: Camera -> Outline -> Outline -> Boolean

behind camera a b: the footprint a is behind b and must be drawn before it (a horizontal line towards the camera meets a, then b).