[{"name":"Camera3d","comment":" A `Camera3d` is a perspective or orthographic camera in 3D, encapsulating\nthe camera's viewpoint and projection matrix as well as the dimensions of the\nscreen the camera renders to. This module contains functions for:\n\n  - Defining perspective and orthographic cameras\n  - Obtaining view and projection matrices for a given camera, which can then be\n    used for WebGL rendering\n  - Using cameras to project 3D geometry to 2D screen space\n\n@docs Camera3d\n\n\n# Constructors\n\nCameras have some commmon properties regardless of how they are constructed:\n\n  - `viewpoint` defines the position and orientation of the camera in 3D space.\n  - `nearClipDistance` and `farClipDistance` specify the standard near and far\n    clipping planes used when rendering.\n  - `screenWidth` and `screenHeight` specify the dimensions in pixels of the\n    screen that will be rendered to (the dimensions of an actual WebGl element,\n    for example). This is used to determine aspect ratio when constructing the\n    camera's projection matrix, but also by functions such as `Camera3d.point2d`\n    which convert from 3D world space to 2D screen space for a given camera.\n\n@docs perspective, orthographic\n\n\n# Properties\n\n@docs viewpoint, screenWidth, screenHeight\n\n\n# Ray casting\n\n@docs ray\n\n\n# Matrices\n\n@docs viewMatrix, modelViewMatrix, projectionMatrix, modelViewProjectionMatrix\n\n","unions":[],"aliases":[{"name":"Camera3d","comment":" ","args":[],"type":"Camera3d.Types.Camera3d"}],"values":[{"name":"modelViewMatrix","comment":" Construct a WebGL model-view matrix given a camera and a `Frame3d` that\ndefines the position and orientation of an object;\n\n    Camera3d.modelViewMatrix modelFrame camera\n\nis shorthand for\n\n    Viewpoint3d.modelViewMatrix\n        modelFrame\n        (Camera3d.viewpoint camera)\n\n","type":"Frame3d.Frame3d -> Camera3d.Camera3d -> Math.Matrix4.Mat4"},{"name":"modelViewProjectionMatrix","comment":" Get the full model-view-projection matrix given a camera and a `Frame3d`\nthat defines the position and orientation of an object;\n\n    Camera3d.modelViewProjectionMatrix modelFrame camera\n\nis equivalent to\n\n    Matrix4.mul (Camera3d.projectionMatrix camera)\n        (Camera3d.modelViewMatrix modelFrame camera)\n\n","type":"Frame3d.Frame3d -> Camera3d.Camera3d -> Math.Matrix4.Mat4"},{"name":"orthographic","comment":" Create an orthographic camera with the common camera properties plus the\nheight of the orthographic viewport: this is the height in 3D world units of the\nsection of the model to be rendered. (The width will be chosen to match the\naspect ratio of the screen given by `screenWidth` and `screenHeight`.)\n\n    orthographicCamera =\n        Camera3d.orthographic\n            { viewpoint = cameraViewpoint\n            , viewportHeight = 5\n            , nearClipDistance = 0.1\n            , farClipDistance = 1000\n            , screenWidth = 1024\n            , screenHeight = 768\n            }\n\n","type":"{ viewpoint : Viewpoint3d.Viewpoint3d, screenWidth : Basics.Float, screenHeight : Basics.Float, viewportHeight : Basics.Float, nearClipDistance : Basics.Float, farClipDistance : Basics.Float } -> Camera3d.Camera3d"},{"name":"perspective","comment":" Create a perspective camera with the common camera properties plus vertical\nfield of view given in radians. The horizontal field of view will be chosen to\nmatch the aspect ratio of the screen given by `screenWidth` and `screenHeight`.\n\n    perspectiveCamera =\n        Camera3d.perspective\n            { viewpoint = cameraViewpoint\n            , verticalFieldOfView = degrees 30\n            , nearClipDistance = 0.1\n            , farClipDistance = 1000\n            , screenWidth = 1024\n            , screenHeight = 768\n            }\n\n","type":"{ viewpoint : Viewpoint3d.Viewpoint3d, screenWidth : Basics.Float, screenHeight : Basics.Float, verticalFieldOfView : Basics.Float, nearClipDistance : Basics.Float, farClipDistance : Basics.Float } -> Camera3d.Camera3d"},{"name":"projectionMatrix","comment":" Get the [projection matrix](http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/#the-projection-matrix)\nof a camera. Multiplying by this matrix converts from eye coordinates to WebGL\nnormalized device coordinates.\n","type":"Camera3d.Camera3d -> Math.Matrix4.Mat4"},{"name":"ray","comment":" Given a camera and a 2D screen point, calculate the corresponding 3D ray as\nan `Axis3d`. Conceptually, the ray will pass through the given point on the\nscreen and will have direction equal to the viewing direction at that point.\n\nFor a perspective camera, the origin of the ray will be constant (always equal\nto the camera's eye point) and the direction will vary depending on the 2D\nscreen point. For an orthographic camera, the direction of the ray will be\nconstant (the view direction of the camera) but the origin will vary depending\non the 2D screen point.\n\n","type":"Camera3d.Camera3d -> Point2d.Point2d -> Axis3d.Axis3d"},{"name":"screenHeight","comment":" Get the height of the screen rendered to by a camera.\n","type":"Camera3d.Camera3d -> Basics.Float"},{"name":"screenWidth","comment":" Get the width of the screen rendered to by a camera.\n","type":"Camera3d.Camera3d -> Basics.Float"},{"name":"viewMatrix","comment":" Get the [view matrix](http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/#the-view-matrix)\nof a camera;\n\n    Camera3d.viewMatrix camera\n\nis shorthand for\n\n    Viewpoint3d.viewMatrix (Camera3d.viewpoint camera)\n\n","type":"Camera3d.Camera3d -> Math.Matrix4.Mat4"},{"name":"viewpoint","comment":" Get the viewpoint defining the position and orientation of a camera.\n","type":"Camera3d.Camera3d -> Viewpoint3d.Viewpoint3d"}],"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 space to 2D screen (pixel) coordinates. The\r\nresult will be in a coordinate system where (0,0) is the bottom left of the\r\nscreen.\r\n","type":"Camera3d.Camera3d -> LineSegment3d.LineSegment3d -> LineSegment2d.LineSegment2d"}],"binops":[]},{"name":"Point3d.Projection","comment":"\n\n@docs toScreenSpace\n\n","unions":[],"aliases":[],"values":[{"name":"toScreenSpace","comment":" Convert a point from 3D world space to 2D screen (pixel) coordinates. The\nresult will be in a coordinate system where (0,0) is the bottom left of the\nscreen.\n","type":"Camera3d.Camera3d -> Point3d.Point3d -> Point2d.Point2d"}],"binops":[]},{"name":"Polyline3d.Projection","comment":"\r\n\r\n@docs toScreenSpace\r\n\r\n","unions":[],"aliases":[],"values":[{"name":"toScreenSpace","comment":" Convert a polyline from 3D space to 2D screen (pixel) coordinates. The\r\nresult will be in a coordinate system where (0,0) is the bottom left of the\r\nscreen.\r\n","type":"Camera3d.Camera3d -> Polyline3d.Polyline3d -> Polyline2d.Polyline2d"}],"binops":[]},{"name":"Triangle3d.Projection","comment":"\r\n\r\n@docs toScreenSpace\r\n\r\n","unions":[],"aliases":[],"values":[{"name":"toScreenSpace","comment":" Convert a triangle from 3D space to 2D screen (pixel) coordinates. The\r\nresult will be in a coordinate system where (0,0) is the bottom left of the\r\nscreen.\r\n","type":"Camera3d.Camera3d -> Triangle3d.Triangle3d -> Triangle2d.Triangle2d"}],"binops":[]},{"name":"Viewpoint3d","comment":" A `Viewpoint3d` represents the position and orientation of a camera in 3D.\n\n@docs Viewpoint3d\n\n\n# Constructors\n\n@docs lookAt\n\n\n# Properties\n\n@docs eyePoint, viewDirection, viewPlane, xDirection, yDirection\n\n\n# Matrices\n\n@docs viewMatrix, modelViewMatrix\n\n","unions":[],"aliases":[{"name":"Viewpoint3d","comment":" ","args":[],"type":"Camera3d.Types.Viewpoint3d"}],"values":[{"name":"eyePoint","comment":" Get the actual eye point of a viewpoint.\n","type":"Viewpoint3d.Viewpoint3d -> Point3d.Point3d"},{"name":"lookAt","comment":" Construct a `Viewpoint3d` at the given eye point looking towards the given\nfocal point, with the given global up direction (which will typically be\n`Direction3d.positiveZ` or `Direction3d.positiveY`). For example, to construct a\nviewpoint at the point (10, 0, 5) looking towards the origin:\n\n    viewpoint =\n        Viewpoint3d.lookAt\n            { eyePoint =\n                Point3d.fromCoordinates ( 10, 0, 5 )\n            , focalPoint = Point3d.origin\n            , upDirection = Direction3d.positiveZ\n            }\n\n    Viewpoint3d.eyePoint viewpoint\n    --> Point3d.fromCoordinates ( 10, 0, 5 )\n\n    Viewpoint3d.xDirection viewpoint\n    --> Direction3d.positiveY\n\n    Viewpoint3d.yDirection viewpoint\n    --> Direction3d.fromAzimuthAndElevation\n    -->     (degrees 180)\n    -->     (degrees 63.43)\n\n    Viewpoint3d.viewDirection viewpoint\n    --> Direction3d.fromAzimuthAndElevation\n    -->     (degrees 180)\n    -->     (degrees -26.57)\n\nThat is likely all you need to know but if you are interested in the details and\ncorner cases, read on!\n\nThe view direction of the returned viewpoint will point from the eye point to\nthe focal point. The Y direction will be chosen to be as close to the global up\ndirection as possible (the viewpoint will not have any 'roll') and the X\ndirection will point to the right.\n\nIf the direction from the eye point to the focal point is parallel to the global\nup direction (that is, the viewpoint represents looking straight up or straight\ndown) then the X and Y directions will be chosen arbitrarily.\n\nIf the given eye point and focal point are coincident (so that there is no well-\ndefined view direction), then the returned frame will have its Y direction set\nto the global up direction and its X and view directions will be chosen\narbitrarily.\n\n","type":"{ focalPoint : Point3d.Point3d, eyePoint : Point3d.Point3d, upDirection : Direction3d.Direction3d } -> Viewpoint3d.Viewpoint3d"},{"name":"modelViewMatrix","comment":" Construct a WebGL model-view matrix given a viewpoint and a `Frame3d` that\ndefines the position and orientation of an object;\n\n    Viewpoint3d.modelViewMatrix modelFrame viewpoint\n\nis equivalent to\n\n    Matrix4.mul\n        (Viewpoint3d.viewMatrix viewpoint)\n        (Frame3d.toMat4 modelFrame)\n\nMultiplying by this matrix transforms from object coordinates to eye\ncoordinates.\n\n","type":"Frame3d.Frame3d -> Viewpoint3d.Viewpoint3d -> Math.Matrix4.Mat4"},{"name":"viewDirection","comment":" Get the viewing direction of a viewpoint.\n","type":"Viewpoint3d.Viewpoint3d -> Direction3d.Direction3d"},{"name":"viewMatrix","comment":" Get the [view matrix](http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/#the-view-matrix)\nof a viewpoint. Multiplying by this matrix transforms from world coordinates to\neye coordinates.\n","type":"Viewpoint3d.Viewpoint3d -> Math.Matrix4.Mat4"},{"name":"viewPlane","comment":" The view plane of a viewpoint is a `SketchPlane3d` perpendicular to the view\ndirection, with origin point equal to the eye point. For an observer looking\nstraight down the view direction, the X direction of the view plane points to\nthe right and the Y direction points up; this means that the view plane's normal\ndirection is the _opposite_ of the view direction. (Note that the Y direction\nwill _not_ be equal to the global up direction unless the view direction is\nhorizontal).\n","type":"Viewpoint3d.Viewpoint3d -> SketchPlane3d.SketchPlane3d"},{"name":"xDirection","comment":" Get the X (right) direction of a viewpoint's view plane.\n","type":"Viewpoint3d.Viewpoint3d -> Direction3d.Direction3d"},{"name":"yDirection","comment":" Get the Y (local up) direction of a viewpoint's view plane.\n","type":"Viewpoint3d.Viewpoint3d -> Direction3d.Direction3d"}],"binops":[]}]