import * as THREE from "three"; declare class SensorSample { sample: THREE.Vector3; timestampS: number; constructor(sample?: THREE.Vector3, timestampS?: number); set(sample: THREE.Vector3, timestampS: number): void; copy(sensorSample: SensorSample): void; } /** * An implementation of a simple complementary filter, which fuses gyroscope and * accelerometer data from the 'devicemotion' event. * * Accelerometer data is very noisy, but stable over the long term. * Gyroscope data is smooth, but tends to drift over the long term. * * This fusion is relatively simple: * 1. Get orientation estimates from accelerometer by applying a low-pass filter * on that data. * 2. Get orientation estimates from gyroscope by integrating over time. * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the * short term. */ declare class ComplementaryFilter { kFilter: number; isDebug: boolean; currentAccelMeasurement: SensorSample; currentGyroMeasurement: SensorSample; previousGyroMeasurement: SensorSample; filterQ: THREE.Quaternion; previousFilterQ: THREE.Quaternion; accelQ: THREE.Quaternion; isOrientationInitialized: boolean; estimatedGravity: THREE.Vector3; measuredGravity: THREE.Vector3; gyroIntegralQ: THREE.Quaternion; constructor(kFilter: number, isDebug: boolean); addAccelMeasurement(vector: THREE.Vector3, timestampS: number): void; addGyroMeasurement(vector: THREE.Vector3, timestampS: number): void; getOrientation(): THREE.Quaternion; private run_; private accelToQuaternion_; private gyroToQuaternionDelta_; } /** * Given an orientation and the gyroscope data, predicts the future orientation * of the head. This makes rendering appear faster. * * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf * * @param predictionTimeS - time from head movement to the appearance of * the corresponding image. */ declare class PosePredictor { predictionTimeS: number; isDebug: boolean; previousQ: THREE.Quaternion; previousTimestampS: number | null; deltaQ: THREE.Quaternion; outQ: THREE.Quaternion; constructor(predictionTimeS: number, isDebug: boolean); getPrediction(currentQ: THREE.Quaternion, gyro: THREE.Vector3, timestampS: number): THREE.Quaternion; } declare class Pose { angularAcceleration: Float32Array | null; angularVelocity: Float32Array | null; linearAcceleration: Float32Array | null; linearVelocity: Float32Array | null; orientation: Float32Array | null; position: Float32Array | null; constructor(); } declare class FrameData { leftProjectionMatrix: Float32Array; leftViewMatrix: Float32Array; pose: Pose; rightProjectionMatrix: Float32Array; rightViewMatrix: Float32Array; timestamp: number; constructor(); } declare class FieldOfView { leftDegrees: number; rightDegrees: number; upDegrees: number; downDegrees: number; constructor(); } /** * The pose sensor, implemented using DeviceMotion APIs. */ declare class Sensor { viewer: { id?: string; label?: string; fov: number; interLensDistance: number; baselineLensDistance: number; screenLensDistance: number; distortionCoefficients: [number, number]; inverseCoefficients: number[]; }; device: { widthMeters: number; heightMeters: number; bevelMeters: number; }; depthNear: number; depthFar: number; yawOnly: boolean; accelerometer: THREE.Vector3; gyroscope: THREE.Vector3; filter: ComplementaryFilter; posePredictor: PosePredictor; isFirefoxAndroid: boolean; isIOS: boolean; isDeviceMotionInRadians: boolean; isWithoutDeviceMotion: boolean; filterToWorldQ: THREE.Quaternion; inverseWorldToScreenQ: THREE.Quaternion; worldToScreenQ: THREE.Quaternion; originalPoseAdjustQ: THREE.Quaternion; resetQ: THREE.Quaternion; private previousTimestampS; private orientationOut_; private _deviceOrientationQ?; private deviceOrientationFixQ?; private deviceOrientationFilterToWorldQ?; constructor(kFilter: number, predictionTime: number, yawOnly: boolean, isDebug: boolean); getPosition(): any; getOrientation(): Float32Array; getPose(): Pose; resetPose(): void; getFrameData(frameData: FrameData): FrameData; start(): () => void; getEyeOffset(): { left: number[]; right: number[]; }; getEyeProjectionMatrix(): { left: number[]; right: number[]; }; getEyeFieldOfView(): { left: FieldOfView; right: FieldOfView; }; private onDeviceOrientation_; private onDeviceMotion_; private updateDeviceMotion_; private onOrientationChange_; /** * This is only needed if we are in an cross origin iframe on iOS to work around * this issue: https://bugs.webkit.org/show_bug.cgi?id=152299. */ private onMessage_; private setScreenTransform_; } export { Sensor, Pose, FrameData, FieldOfView };