UNPKG

view360-canex

Version:

360 integrated viewing solution from inside-out view to outside-in view. It provides user-friendly service by rotating 360 degrees through various user interaction such as motion sensor and touch.

29 lines (23 loc) 791 B
import { quat } from "gl-matrix"; import { util as mathUtil, ROTATE_CONSTANT, } from "../utils/math-util"; export function toAxis(source, offset) { return offset.reduce((acc, v, i) => { if (source[i]) { acc[source[i]] = v; } return acc; }, {}); } export function getDeltaYaw(prvQ: quat, curQ: quat) { const yawDeltaByYaw = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW); const yawDeltaByRoll = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) * Math.sin(mathUtil.extractPitchFromQuat(curQ)); return yawDeltaByRoll + yawDeltaByYaw; } export function getDeltaPitch(prvQ: quat, curQ: quat) { const pitchDelta = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA); return pitchDelta; }