Constructor
new NavigatorState(modelViewMatrix, projectionMatrix, viewport, heading, tilt)
Parameters:
Name | Type | Description |
---|---|---|
modelViewMatrix |
Matrix | The navigator's model-view matrix. |
projectionMatrix |
Matrix | The navigator's projection matrix. |
viewport |
Rectangle | The navigator's viewport. |
heading |
Number | The navigator's heading. |
tilt |
Number | The navigator's tilt. |
- Source:
Members
(readonly) eyePoint :Vec3
Type:
- Source:
(readonly) frustumInModelCoordinates :Frustum
Type:
- Source:
(readonly) heading :Number
Type:
- Number
- Source:
(readonly) modelview :Matrix
Type:
- Source:
(readonly) modelviewNormalTransform :Matrix
Type:
- Source:
(readonly) modelviewProjection :Matrix
Type:
- Source:
(readonly) projection :Matrix
Type:
- Source:
(readonly) tilt :Number
Type:
- Number
- Source:
(readonly) viewport :Rectangle
Type:
- Source:
Methods
convertPointToViewport(point, result) → {Vec2}
The specified point is understood to be in the window coordinate system of the WorldWindow, with the origin in the top-left corner and axes that extend down and to the right from the origin point.
The returned point is in WebGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin point.
Parameters:
Name | Type | Description |
---|---|---|
point |
Vec2 | The window-coordinate point to convert. |
result |
Vec2 | A pre-allocated Vec2 in which to return the computed point. |
- Source:
Throws:
-
If either argument is null or undefined.
- Type
- ArgumentError
Returns:
- Type
- Vec2
convertPointToWindow(screenPoint, result) → {Vec2}
The specified point is understood to be in WebGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin point.
The returned point is in the window coordinate system of the WorldWindow, with the origin in the top-left corner and axes that extend down and to the right from the origin point.
Parameters:
Name | Type | Description |
---|---|---|
screenPoint |
Vec2 | The screen point to convert. |
result |
Vec2 | A pre-allocated Vec2 in which to return the computed point. |
- Source:
Throws:
-
If either argument is null or undefined.
- Type
- ArgumentError
Returns:
- Type
- Vec2
pixelSizeAtDistance(distance) → {Number}
This method assumes rectangular pixels, where pixel coordinates denote infinitely thin spaces between pixels. The units of the returned size are in model coordinates per pixel (usually meters per pixel). This returns 0 if the specified distance is zero. The returned size is undefined if the distance is less than zero.
Parameters:
Name | Type | Description |
---|---|---|
distance |
Number | The distance from the eye point at which to determine pixel size, in model coordinates. |
- Source:
Returns:
- Type
- Number
project(modelPoint, result) → {boolean}
The resultant screen point is in WebGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin.
This function stores the transformed point in the result argument, and returns true or false to indicate whether or not the transformation is successful. It returns false if this navigator state's modelview or projection matrices are malformed, or if the specified model point is clipped by the near clipping plane or the far clipping plane.
Parameters:
Name | Type | Description |
---|---|---|
modelPoint |
Vec3 | The model coordinate point to project. |
result |
Vec3 | A pre-allocated vector in which to return the projected point. |
- Source:
Throws:
-
If either the specified point or result argument is null or undefined.
- Type
- ArgumentError
Returns:
- Type
- boolean
projectWithDepth(modelPoint, depthOffset, result) → {boolean}
The resultant screen point is in WebGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin.
This function stores the transformed point in the result argument, and returns true or false to indicate whether or not the transformation is successful. It returns false if this navigator state's modelview or projection matrices are malformed, or if the modelPoint is clipped by the near clipping plane or the far clipping plane, ignoring the depth offset.
The depth offset may be any real number and is typically used to move the screenPoint slightly closer to the user's eye in order to give it visual priority over nearby objects or terrain. An offset of zero has no effect. An offset less than zero brings the screenPoint closer to the eye, while an offset greater than zero pushes the projected screen point away from the eye.
Applying a non-zero depth offset has no effect on whether the model point is clipped by this method or by WebGL. Clipping is performed on the original model point, ignoring the depth offset. The final depth value after applying the offset is clamped to the range [0,1].
Parameters:
Name | Type | Description |
---|---|---|
modelPoint |
Vec3 | The model coordinate point to project. |
depthOffset |
Number | The amount of offset to apply. |
result |
Vec3 | A pre-allocated vector in which to return the projected point. |
- Source:
Throws:
-
If either the specified point or result argument is null or undefined.
- Type
- ArgumentError
Returns:
- Type
- boolean
rayFromScreenPoint(point) → {Line}
The specified point is understood to be in the window coordinate system of the WorldWindow, with the origin in the top-left corner and axes that extend down and to the right from the origin point.
The results of this method are undefined if the specified point is outside of the WorldWindow's bounds.
Parameters:
Name | Type | Description |
---|---|---|
point |
Vec2 | The window coordinates point to compute a ray for. |
- Source:
Returns:
- Type
- Line
unProject(screenPoint, result) → {boolean}
The screen point is understood to be in WebGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin.
This function stores the transformed point in the result argument, and returns true or false to indicate whether the transformation is successful. It returns false if this navigator state's modelview or projection matrices are malformed, or if the screenPoint is clipped by the near clipping plane or the far clipping plane.
Parameters:
Name | Type | Description |
---|---|---|
screenPoint |
Vec3 | The screen coordinate point to un-project. |
result |
Vec3 | A pre-allocated vector in which to return the unprojected point. |
- Source:
Throws:
-
If either the specified point or result argument is null or undefined.
- Type
- ArgumentError
Returns:
- Type
- boolean