Module

Hylograph.Isometric.Outline

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

Outlines in a plane: a convex polygon or a circle. A prism is an outline extruded upwards, and an outline on the floor is what the painter's order compares.

#Outline Source

data Outline

Polygon must be convex; its winding does not matter.

Constructors

Instances

#Rectangle Source

type Rectangle = { x0 :: Number, x1 :: Number, y0 :: Number, y1 :: Number }

#rectangle Source

rectangle :: Rectangle -> Outline

An axis-aligned rectangle.

#signedArea Source

signedArea :: Array Point -> Number

The shoelace area, positive when the points turn from +x towards +y.

#counterClockwise Source

counterClockwise :: Array Point -> Array Point

The points wound from +x towards +y (anticlockwise about +z).

#span Source

span :: Point -> Outline -> { high :: Number, low :: Number }

The interval the outline covers along a unit direction.

#chordCentre Source

chordCentre :: Point -> Point -> Number -> Outline -> Maybe Number

Where the line { p | p · across = offset } crosses the outline, as the middle of that chord measured along along (which should be perpendicular to across); Nothing if the line misses it.

#circlePoints Source

circlePoints :: { centre :: Point, radius :: Number } -> { count :: Int, from :: Number, sweep :: Number } -> Array Point

count points round a circle, anticlockwise about +z, starting at angle from (radians, from +x towards +y) and sweeping sweep.