@itwin/core-frontend
Version:
iTwin.js frontend components
154 lines • 7.43 kB
TypeScript
/** @packageDocumentation
* @module Views
*/
import { Map4d, Matrix3d, Point3d, Point4d, Range1d, Range3d, Transform, Vector3d, XYAndZ, XYZ } from "@itwin/core-geometry";
import { AxisAlignedBox3d, Frustum } from "@itwin/core-common";
import { CoordSystem } from "./CoordSystem";
import { Viewport } from "./Viewport";
import { ViewState } from "./ViewState";
/** Describes a [[Viewport]]'s viewing volume, plus its size on the screen. A new
* instance of ViewingSpace is created every time the Viewport's frustum changes.
* @see [[Viewport.viewingSpace]].
* @public
* @extensions
*/
export declare class ViewingSpace {
private readonly _viewRange;
private readonly _viewCorners;
/** @internal */
frustFraction: number;
/** Maximum ratio of frontplane to backplane distance for 24 bit non-logarithmic zbuffer
* @internal
*/
static nearScaleNonLog24: number;
/** Maximum fraction of frontplane to backplane distance for 24 bit logarithmic zbuffer
* @internal
*/
static nearScaleLog24: number;
/** View origin, potentially expanded */
readonly viewOrigin: Point3d;
/** View delta, potentially expanded */
readonly viewDelta: Vector3d;
/** View origin (from ViewState, unexpanded) */
readonly viewOriginUnexpanded: Point3d;
/** View delta (from ViewState, unexpanded) */
readonly viewDeltaUnexpanded: Vector3d;
/** View rotation matrix (copied from ViewState) */
readonly rotation: Matrix3d;
/** Provides conversions between world and view coordinates. */
readonly worldToViewMap: Map4d;
/** Providers conversions between world and Npc (non-dimensional perspective) coordinates. */
readonly worldToNpcMap: Map4d;
/** @internal */
readonly zClipAdjusted: boolean;
/** Eye point - undefined if not a perspective projection. */
readonly eyePoint: Point3d | undefined;
private _view;
/** The ViewState for this Viewport */
get view(): ViewState;
set view(view: ViewState);
private readonly _clientWidth;
private readonly _clientHeight;
/** Get the rectangle of this Viewport in ViewCoordinates. */
private get _viewRect();
private static _copyOutput;
/** @internal */
toViewOrientation(from: XYZ, to?: XYZ): void;
/** @internal */
fromViewOrientation(from: XYZ, to?: XYZ): void;
/** Ensure the rotation matrix for this view is aligns the root z with the view out (i.e. a "2d view"). */
private alignWithRootZ;
private validateCamera;
/** @internal */
getTerrainHeightRange(): Range1d | undefined;
private static _minDepth;
/** Compute the bounding box of this viewing space in [[CoordSystem.World]] coordinates, including the extents of any [[TiledGraphicsProvider]]s registered with the [[Viewport]]. */
readonly getViewedExtents: () => AxisAlignedBox3d;
/** Adjust the front and back planes to encompass the entire viewed volume */
private adjustZPlanes;
calcNpcToView(): Map4d;
getViewCorners(): Range3d;
private constructor();
/** Create from a Viewport. */
static createFromViewport(vp: Viewport): ViewingSpace | undefined;
/** Convert an array of points from CoordSystem.View to CoordSystem.Npc */
viewToNpcArray(pts: Point3d[]): void;
/** Convert an array of points from CoordSystem.Npc to CoordSystem.View */
npcToViewArray(pts: Point3d[]): void;
/** Convert a point from CoordSystem.View to CoordSystem.Npc
* @param pt the point to convert
* @param out optional location for result. If undefined, a new Point3d is created.
*/
viewToNpc(pt: Point3d, out?: Point3d): Point3d;
/** Convert a point from CoordSystem.Npc to CoordSystem.View
* @param pt the point to convert
* @param out optional location for result. If undefined, a new Point3d is created.
*/
npcToView(pt: Point3d, out?: Point3d): Point3d;
/** Convert an array of points from CoordSystem.World to CoordSystem.Npc */
worldToNpcArray(pts: Point3d[]): void;
/** Convert an array of points from CoordSystem.Npc to CoordSystem.World */
npcToWorldArray(pts: Point3d[]): void;
/** Convert an array of points from CoordSystem.World to CoordSystem.View */
worldToViewArray(pts: Point3d[]): void;
/** Convert an array of points from CoordSystem.World to CoordSystem.View, as Point4ds */
worldToView4dArray(worldPts: Point3d[], viewPts: Point4d[]): void;
/** Convert an array of points from CoordSystem.View to CoordSystem.World */
viewToWorldArray(pts: Point3d[]): void;
/** Convert an array of points from CoordSystem.View as Point4ds to CoordSystem.World */
view4dToWorldArray(viewPts: Point4d[], worldPts: Point3d[]): void;
/**
* Convert a point from CoordSystem.World to CoordSystem.Npc
* @param pt the point to convert
* @param out optional location for result. If undefined, a new Point3d is created.
*/
worldToNpc(pt: XYAndZ, out?: Point3d): Point3d;
/**
* Convert a point from CoordSystem.Npc to CoordSystem.World
* @param pt the point to convert
* @param out optional location for result. If undefined, a new Point3d is created.
*/
npcToWorld(pt: XYAndZ, out?: Point3d): Point3d;
/**
* Convert a point from CoordSystem.World to CoordSystem.View
* @param pt the point to convert
* @param out optional location for result. If undefined, a new Point3d is created.
*/
worldToView(input: XYAndZ, out?: Point3d): Point3d;
/**
* Convert a point from CoordSystem.World to CoordSystem.View as Point4d
* @param input the point to convert
* @param out optional location for result. If undefined, a new Point4d is created.
*/
worldToView4d(input: XYAndZ, out?: Point4d): Point4d;
/**
* Convert a point from CoordSystem.View to CoordSystem.World
* @param pt the point to convert
* @param out optional location for result. If undefined, a new Point3d is created.
*/
viewToWorld(input: XYAndZ, out?: Point3d): Point3d;
/**
* Convert a point from CoordSystem.View as a Point4d to CoordSystem.View
* @param input the point to convert
* @param out optional location for result. If undefined, a new Point3d is created.
*/
view4dToWorld(input: Point4d, out?: Point3d): Point3d;
/** Get an 8-point Frustum corresponding to the 8 corners of the Viewport in the specified coordinate system.
*
* There are two sets of corners that may be of interest.
* The "adjusted" box is the one that is computed by examining the "viewed extents" and moving
* the front and back planes to enclose everything in the view.
* The "unadjusted" box is the one that is stored in the ViewState.
* @param sys Coordinate system for points
* @param adjustedBox If true, retrieve the adjusted box. Otherwise retrieve the box that came from the view definition.
* @param box optional Frustum for return value
* @return the view frustum
* @note The "adjusted" box may be either larger or smaller than the "unadjusted" box.
*/
getFrustum(sys?: CoordSystem, adjustedBox?: boolean, box?: Frustum): Frustum;
/** @internal */
getPixelSizeAtPoint(inPoint?: Point3d): number;
/** @internal */
getPreloadFrustum(transformOrScale?: Transform | number, result?: Frustum): Frustum;
}
//# sourceMappingURL=ViewingSpace.d.ts.map