[{"name":"Camera3d","comment":" A `Camera3d` is a perspective or orthographic camera in 3D, encapsulating\r\nthe camera's viewpoint and projection matrix as well as the dimensions of the\r\nscreen the camera renders to. This module contains functions for:\r\n\r\n  - Defining perspective and orthographic cameras\r\n  - Obtaining view and projection matrices for a given camera, which can then be\r\n    used for WebGL rendering\r\n  - Using cameras to project 3D geometry to 2D screen space\r\n\r\n@docs Camera3d\r\n\r\n\r\n# Constructors\r\n\r\nCameras have a couple of commmon properties regardless of how they are\r\nconstructed:\r\n\r\n  - `viewpoint` defines the position and orientation of the camera in 3D space.\r\n  - `clipDepth` specifies the standard near clipping plane used when rendering.\r\n    The far clipping plane is assumed to be at infinity.\r\n\r\n@docs perspective, orthographic\r\n\r\n\r\n# Properties\r\n\r\n@docs viewpoint, clipDepth, clipPlane\r\n\r\n\r\n# Ray casting\r\n\r\n@docs ray\r\n\r\n\r\n# WebGL rendering\r\n\r\n@docs viewMatrix, modelViewMatrix, projectionParameters\r\n\r\n","unions":[],"aliases":[{"name":"Camera3d","comment":" ","args":["units","coordinates"],"type":"Camera3d.Types.Camera3d units coordinates"}],"values":[{"name":"clipDepth","comment":" Get the clip depth of a camera.\r\n","type":"Camera3d.Camera3d units coordinates -> Quantity.Quantity Basics.Float units"},{"name":"clipPlane","comment":" Get the clip plane of a camera.\r\n","type":"Camera3d.Camera3d units coordinates -> Plane3d.Plane3d units coordinates"},{"name":"modelViewMatrix","comment":" Construct a WebGL model-view matrix given a camera and a `Frame3d` that\r\ndefines the position and orientation of an object;\r\n\r\n    Camera3d.modelViewMatrix modelFrame camera\r\n\r\nis shorthand for\r\n\r\n    Viewpoint3d.modelViewMatrix\r\n        modelFrame\r\n        (Camera3d.viewpoint camera)\r\n\r\n","type":"Frame3d.Frame3d units coordinates defines -> Camera3d.Camera3d units coordinates -> Math.Matrix4.Mat4"},{"name":"orthographic","comment":" Create an orthographic camera from a viewpoint, a clip depth and the height\r\nof the orthographic viewport: this is the height in 3D world units of the\r\nsection of the model to be rendered.\r\n\r\n    orthographicCamera =\r\n        Camera3d.orthographic\r\n            { viewpoint = cameraViewpoint\r\n            , viewportHeight = Length.meters 5\r\n            , clipDepth = Length.meters 0.1\r\n            }\r\n\r\n","type":"{ viewpoint : Viewpoint3d.Viewpoint3d units coordinates, clipDepth : Quantity.Quantity Basics.Float units, viewportHeight : Quantity.Quantity Basics.Float units } -> Camera3d.Camera3d units coordinates"},{"name":"perspective","comment":" Create a perspective camera from a viewpoint, a vertical field of view and a\r\nclip depth.\r\n\r\n    perspectiveCamera =\r\n        Camera3d.perspective\r\n            { viewpoint = cameraViewpoint\r\n            , verticalFieldOfView = Angle.degrees 30\r\n            , clipDepth = Length.meters 0.1\r\n            }\r\n\r\n","type":"{ viewpoint : Viewpoint3d.Viewpoint3d units coordinates, clipDepth : Quantity.Quantity Basics.Float units, verticalFieldOfView : Angle.Angle } -> Camera3d.Camera3d units coordinates"},{"name":"projectionParameters","comment":" Construct a special `Vec4` containing values useful for settting up\r\nperspective and orthographic projection in WebGL. For a perspective camera,\r\nthe entries are\r\n\r\n```\r\nclip depth\r\nscreen aspect ratio\r\n1 / camera frustum slope\r\n0\r\n```\r\n\r\nFor an orthographic camera, the entries are\r\n\r\n```\r\nclip depth\r\nscreen aspect ratio\r\n0\r\n-2 / camera viewport height\r\n```\r\n\r\nCurrently used internally by `elm-3d-scene`.\r\n\r\n","type":"{ screenAspectRatio : Basics.Float } -> Camera3d.Camera3d units coordinates -> Math.Vector4.Vec4"},{"name":"ray","comment":" Given a camera and a 2D screen point, calculate the corresponding 3D ray as\r\nan `Axis3d`. Conceptually, the ray will pass through the given point on the\r\nscreen and will have direction equal to the viewing direction at that point.\r\n\r\nFor a perspective camera, the origin of the ray will be constant (always equal\r\nto the camera's eye point) and the direction will vary depending on the 2D\r\nscreen point. For an orthographic camera, the direction of the ray will be\r\nconstant (the view direction of the camera) but the origin will vary depending\r\non the 2D screen point.\r\n\r\n","type":"Camera3d.Camera3d units coordinates -> Rectangle2d.Rectangle2d screenUnits screenCoordinates -> Point2d.Point2d screenUnits screenCoordinates -> Axis3d.Axis3d units coordinates"},{"name":"viewMatrix","comment":" Get the [view matrix](http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/#the-view-matrix)\r\nof a camera;\r\n\r\n    Camera3d.viewMatrix camera\r\n\r\nis shorthand for\r\n\r\n    Viewpoint3d.viewMatrix (Camera3d.viewpoint camera)\r\n\r\n","type":"Camera3d.Camera3d units coordinates -> Math.Matrix4.Mat4"},{"name":"viewpoint","comment":" Get the viewpoint defining the position and orientation of a camera.\r\n","type":"Camera3d.Camera3d units coordinates -> Viewpoint3d.Viewpoint3d units coordinates"}],"binops":[]},{"name":"LineSegment3d.Projection","comment":"\r\n\r\n@docs toScreenSpace\r\n\r\n","unions":[],"aliases":[],"values":[{"name":"toScreenSpace","comment":" Convert a line segment from 3D world to 2D screen coordinates.\r\n","type":"Camera3d.Camera3d worldUnits worldCoordinates -> Rectangle2d.Rectangle2d screenUnits screenCoordinates -> LineSegment3d.LineSegment3d worldUnits worldCoordinates -> Maybe.Maybe (LineSegment2d.LineSegment2d screenUnits screenCoordinates)"}],"binops":[]},{"name":"Point3d.Projection","comment":"\r\n\r\n@docs toScreenSpace\r\n\r\n","unions":[],"aliases":[],"values":[{"name":"toScreenSpace","comment":" Convert a point from 3D world to 2D screen coordinates.\r\n","type":"Camera3d.Camera3d worldUnits worldCoordinates -> Rectangle2d.Rectangle2d screenUnits screenCoordinates -> Point3d.Point3d worldUnits worldCoordinates -> Maybe.Maybe (Point2d.Point2d screenUnits screenCoordinates)"}],"binops":[]},{"name":"Triangle3d.Projection","comment":"\r\n\r\n@docs toScreenSpace, isFrontFacing\r\n\r\n","unions":[],"aliases":[],"values":[{"name":"isFrontFacing","comment":" Check if a given triangle is front facing with respect to the given camera.\r\n","type":"Camera3d.Camera3d units coordinates -> Triangle3d.Triangle3d units coordinates -> Basics.Bool"},{"name":"toScreenSpace","comment":" Convert a triangle from 3D world to 2D screen coordinates.\r\n","type":"Camera3d.Camera3d worldUnits worldCoordinates -> Rectangle2d.Rectangle2d screenUnits screenCoordinates -> Triangle3d.Triangle3d worldUnits worldCoordinates -> Maybe.Maybe (Polygon2d.Polygon2d screenUnits screenCoordinates)"}],"binops":[]},{"name":"Viewpoint3d","comment":" A `Viewpoint3d` represents the position and orientation of a camera in 3D.\r\n\r\n@docs Viewpoint3d\r\n\r\n\r\n# Constructors\r\n\r\n@docs lookAt, orbit\r\n\r\n\r\n# Properties\r\n\r\n@docs eyePoint, viewDirection, viewPlane, xDirection, yDirection\r\n\r\n\r\n# Matrices\r\n\r\n@docs viewMatrix, modelViewMatrix\r\n\r\n","unions":[],"aliases":[{"name":"Viewpoint3d","comment":" ","args":["units","coordinates"],"type":"Camera3d.Types.Viewpoint3d units coordinates"}],"values":[{"name":"eyePoint","comment":" Get the actual eye point of a viewpoint.\r\n","type":"Viewpoint3d.Viewpoint3d units coordinates -> Point3d.Point3d units coordinates"},{"name":"lookAt","comment":" Construct a `Viewpoint3d` at the given eye point looking towards the given\r\nfocal point, with the given global up direction (which will typically be\r\n`Direction3d.positiveZ` or `Direction3d.positiveY`). For example, to construct a\r\nviewpoint at the point (10, 0, 5) looking towards the origin:\r\n\r\n    viewpoint =\r\n        Viewpoint3d.lookAt\r\n            { eyePoint = Point3d.meters 10 0 5\r\n            , focalPoint = Point3d.origin\r\n            , upDirection = Direction3d.positiveZ\r\n            }\r\n\r\n    Viewpoint3d.eyePoint viewpoint\r\n    --> Point3d.meters 10 0 5\r\n\r\n    Viewpoint3d.xDirection viewpoint\r\n    --> Direction3d.positiveY\r\n\r\n    Viewpoint3d.yDirection viewpoint\r\n    --> Direction3d.xz (Angle.degrees 116.57)\r\n\r\n    Viewpoint3d.viewDirection viewpoint\r\n    --> Direction3d.xz (Angle.degrees -153.43)\r\n\r\nThat is likely all you need to know but if you are interested in the details and\r\ncorner cases, read on!\r\n\r\nThe view direction of the returned viewpoint will point from the eye point to\r\nthe focal point. The Y direction will be chosen to be as close to the global up\r\ndirection as possible (the viewpoint will not have any 'roll') and the X\r\ndirection will point to the right.\r\n\r\nIf the direction from the eye point to the focal point is parallel to the global\r\nup direction (that is, the viewpoint represents looking straight up or straight\r\ndown) then the X and Y directions will be chosen arbitrarily.\r\n\r\nIf the given eye point and focal point are coincident (so that there is no well-\r\ndefined view direction), then the returned frame will have its Y direction set\r\nto the global up direction and its X and view directions will be chosen\r\narbitrarily.\r\n\r\n","type":"{ focalPoint : Point3d.Point3d units coordinates, eyePoint : Point3d.Point3d units coordinates, upDirection : Direction3d.Direction3d coordinates } -> Viewpoint3d.Viewpoint3d units coordinates"},{"name":"modelViewMatrix","comment":" Construct a WebGL model-view matrix given a viewpoint and a `Frame3d` that\r\ndefines the position and orientation of an object;\r\n\r\n    Viewpoint3d.modelViewMatrix modelFrame viewpoint\r\n\r\nis equivalent to\r\n\r\n    Matrix4.mul\r\n        (Viewpoint3d.viewMatrix viewpoint)\r\n        (Frame3d.toMat4 modelFrame)\r\n\r\nMultiplying by this matrix transforms from object coordinates to eye\r\ncoordinates.\r\n\r\n","type":"Frame3d.Frame3d units coordinates defines -> Viewpoint3d.Viewpoint3d units coordinates -> Math.Matrix4.Mat4"},{"name":"orbit","comment":" Construct a `Viewpoint3d` looking at the given focal point, the given\r\ndistance away. The direction from the focal point to the eye point is defined by\r\nthe given azimuth and elevation angles, which are with respect to the given\r\nground plane (the position of the ground plane does not matter, only its\r\norientation). For example,\r\n\r\n    Viewpoint3d.orbit\r\n        { focalPoint = Point3d.meters 0 0 1\r\n        , groundPlane = SketchPlane3d.xy\r\n        , azimuth = Angle.degrees 0\r\n        , elevation = Angle.degrees 45\r\n        , distance = Length.meters 10\r\n        }\r\n\r\nis equivalent to\r\n\r\n    Viewpoint3d.lookAt\r\n        { focalPoint = Point3d.meters 0 0 1\r\n        , eyePoint = Point3d.meters 7.071 0 8.071\r\n        , upDirection = Direction3d.z\r\n        }\r\n\r\nAs the name suggests, `Viewpoint3d.orbit` is useful for making orbiting cameras;\r\nyou can orbit around the focal point by changing just the azimuth, and rotate\r\nup and down by changing just the elevation.\r\n\r\n","type":"{ focalPoint : Point3d.Point3d units coordinates, groundPlane : SketchPlane3d.SketchPlane3d units coordinates defines, azimuth : Angle.Angle, elevation : Angle.Angle, distance : Quantity.Quantity Basics.Float units } -> Viewpoint3d.Viewpoint3d units coordinates"},{"name":"viewDirection","comment":" Get the viewing direction of a viewpoint.\r\n","type":"Viewpoint3d.Viewpoint3d units coordinates -> Direction3d.Direction3d coordinates"},{"name":"viewMatrix","comment":" Get the [view matrix](http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/#the-view-matrix)\r\nof a viewpoint. Multiplying by this matrix transforms from world coordinates to\r\neye coordinates.\r\n","type":"Viewpoint3d.Viewpoint3d units coordinates -> Math.Matrix4.Mat4"},{"name":"viewPlane","comment":" The view plane of a viewpoint is a `SketchPlane3d` perpendicular to the view\r\ndirection, with origin point equal to the eye point. For an observer looking\r\nstraight down the view direction, the X direction of the view plane points to\r\nthe right and the Y direction points up; this means that the view plane's normal\r\ndirection is the _opposite_ of the view direction. (Note that the Y direction\r\nwill _not_ be equal to the global up direction unless the view direction is\r\nhorizontal).\r\n","type":"Viewpoint3d.Viewpoint3d units coordinates -> SketchPlane3d.SketchPlane3d units coordinates defines"},{"name":"xDirection","comment":" Get the X (right) direction of a viewpoint's view plane.\r\n","type":"Viewpoint3d.Viewpoint3d units coordinates -> Direction3d.Direction3d coordinates"},{"name":"yDirection","comment":" Get the Y (local up) direction of a viewpoint's view plane.\r\n","type":"Viewpoint3d.Viewpoint3d units coordinates -> Direction3d.Direction3d coordinates"}],"binops":[]}]