Hylograph.Isometric.Camera
- Package
- purescript-hylograph-isometric
- Repository
- afcondon/purescript-hylograph-isometric
An orthographic camera: two angles and a scale.
The world is the coordinate system of a 2D layout with height added:
x and y are the layout's own (so y grows "down the page", which on
the floor means towards the south), and z is up. A layout placed on the
floor keeps its coordinates and gains a z.
The camera looks at the world from a horizontal direction, its
azimuth (measured in the floor from +x towards +y), and from an
elevation above the floor. Isometric is one setting: azimuth 45° and
elevation asin (1 / √3) ≈ 35.26°, from which the three axes are drawn at
equal length, x and y at ±30° below the horizontal and z straight up.
There is no perspective, deliberately: an orthographic view keeps lengths along an axis comparable wherever they are in the picture.
#Camera Source
newtype Camerascale is screen units per world unit along the line of sight's
perpendicular plane (a true orthographic scale): a unit along an axis is
drawn shorter than scale by the cosine of its angle to that plane.
Constructors
Instances
#isometricFrom Source
isometricFrom :: Viewpoint -> Camera#isometricUnit Source
isometricUnit :: Number -> CameraThe isometric camera (from the south-east) at the scale that draws a
unit along any axis length screen units long.
#nextViewpoint Source
nextViewpoint :: Viewpoint -> ViewpointA quarter turn of the camera, anticlockwise seen from above (azimuth + 90°).
#viewpointAzimuth Source
viewpointAzimuth :: Viewpoint -> Degrees#towardsCamera Source
towardsCamera :: Camera -> Point3The unit vector from the scene towards the camera.
#floorTowardsCamera Source
floorTowardsCamera :: Camera -> PointThe horizontal direction towards the camera, as a unit vector in the floor.
#screenRight Source
screenRight :: Camera -> PointThe horizontal unit vector that the camera draws pointing right.