@iiif/3d-manifesto-dev
Version:
IIIF Presentation API utility library for client and server with 3D extension
73 lines (69 loc) • 2.88 kB
TypeScript
import { Vector3, Euler, Matrix4 } from "threejs-math";
import { RotateTransform, Transform } from "./internal";
/**
* performs the calculation required for the lookAt
* property of a camera resource. Determines the
* required angles of two rotations, the first about
* the x axis and the second about the y axis, which will
* rotate the default camera direction (0,0,-1) into the
* direction of the input arguments
*
* Result of calculation is returned as a instance of EulerAngle from the
* threejs-math library. The "axes order" of the EulerAngle is "YXZ": The
* three-js library uses body-fixed axes to represent EulerAngles, which reverse
* the ordering of the "relative rotation" algorithm described in the
* draft 3d api.
* @param direction A vector interpreted as a direction. Client code
* responsible for not passing a 0-length vector, else a
*
* @returns threejs-math.EulerAngle instance
**/
export declare function cameraRelativeRotation(direction: Vector3): Euler;
/**
* Evaluates the rotation required to transform a directional light
* or spot ling, which in iiif 3D spec
* have an initial direction in the -Y direction, to a direction
* along the input argument
*
* TODO : expand on this documentation taking into account the
* implied specification that RotateTransform instances
* are to be interpreted as an Euler angle definition of
* the rotation
*
* @param direction A vector interpreted as a direction. Client code
* responsible for not passing a 0-length vector, else a
*
* @returns threejs-math.EulerAngle instance
**/
export declare function lightRelativeRotation(direction: Vector3): Euler;
/**
* Implements the convention that the 3 component values for the RotateTranform
* cass (properties x,y,z) are to be interpreted as Euler angles in the intrinsic XYZ
* order
* @param transform : A object with a Rotation member object, properties x,y,z
*
* @returns threejs-math.EulerAngle instance. From this threejs-math functionsa
* allow conversion to other rotation representations.
**/
export declare function eulerFromRotateTransform(transform: RotateTransform): Euler;
/**
* Given an array of Transform instances, returns a single Matrix4
* instance that represents the cumulative effect of the transforms
* in the order they appear in the array.
*
* @param transforms An array of Transform instances
*
* @returns A Matrix4 instance representing the cumulative effect of the transforms
**/
export declare function combineTransformsToMatrix(transforms: Transform[]): Matrix4;
export type TransformSet = {
translation: Vector3;
rotation: Euler;
scale: Vector3;
};
export declare function combineTransformsToTRS(transforms: Transform[]): TransformSet;
export declare function decomposeMatrix(matrix: Matrix4): {
translation: Vector3;
rotation: Euler;
scale: Vector3;
};