UNPKG

@ue-too/board

Version:
76 lines (75 loc) 3.87 kB
import { Point } from "@ue-too/math"; import { TransformationMatrix } from "./matrix"; /** * @description Finds the world space coordinate of the interest point if the camera is at target position. * The target position is the "would be" position of the camera in world space. * The interest point is the point in view port space where the "bottom left" corner is the origin. * * @category Camera */ export declare function convert2WorldSpaceWRT(targetPosition: Point, interestPoint: Point, viewPortWidth: number, viewPortHeight: number, cameraZoomLevel: number, cameraRotation: number): Point; /** * @description Converts the point to world space. * The point is in the viewport space where the "bottom left" corner is the origin. * Camera position is the position of the camera in world space. * * @category Camera */ export declare function convert2WorldSpace(point: Point, viewPortWidth: number, viewPortHeight: number, cameraPosition: Point, cameraZoomLevel: number, cameraRotation: number): Point; /** * @description Converts the point to world space. * The point is in the viewport space where the origin is at the center of the viewport. * Camera position is the position of the camera in world space. * * @category Camera */ export declare function convert2WorldSpaceAnchorAtCenter(point: Point, cameraPosition: Point, cameraZoomLevel: number, cameraRotation: number): Point; /** * @description Converts a point in "stage/context/world" space to view port space. * The origin of the viewport is at the center of the viewport. * The point is in world space. * The camera position is the position of the camera in world space. * * @category Camera */ export declare function convert2ViewPortSpaceAnchorAtCenter(point: Point, cameraPosition: Point, cameraZoomLevel: number, cameraRotation: number): Point; /** * @description Converts a point in "stage/context/world" space to view port space. * The origin of the view port is at the bottom left corner. * The point is in world space. * The camera position is the position of the camera in world space. * * @category Camera */ export declare function invertFromWorldSpace(point: Point, viewPortWidth: number, viewPortHeight: number, cameraPosition: Point, cameraZoomLevel: number, cameraRotation: number): Point; /** * @description Checks if a point is in the view port. * The point is in world space. * The camera position is the position of the camera in world space. * * @category Camera */ export declare function pointIsInViewPort(point: Point, viewPortWidth: number, viewPortHeight: number, cameraPosition: Point, cameraZoomLevel: number, cameraRotation: number): boolean; /** * @description Converts a delta in view port space to world space. * The delta is in view port space. * * @category Camera */ export declare function convertDeltaInViewPortToWorldSpace(delta: Point, cameraZoomLevel: number, cameraRotation: number): Point; /** * @description Converts a delta in world space to view port space. * The delta is in world space. * * @category Camera */ export declare function convertDeltaInWorldToViewPortSpace(delta: Point, cameraZoomLevel: number, cameraRotation: number): Point; /** * @description Calculates the camera position to get a point in "stage/context/world" space to be at a certain point in view port space. * This is useful to coordinate camera pan and zoom at the same time. * * @category Camera */ export declare function cameraPositionToGet(pointInWorld: Point, toPointInViewPort: Point, cameraZoomLevel: number, cameraRotation: number): Point; export declare function transformationMatrixFromCamera(cameraPosition: Point, cameraZoomLevel: number, cameraRotation: number): TransformationMatrix; export declare function convert2WorldSpaceWithTransformationMatrix(point: Point, transformationMatrix: TransformationMatrix): Point;