|
1 | | -import { Clamp } from "./math.scalar.functions"; |
2 | 1 | import type { DeepImmutable } from "../types"; |
3 | | -import type { IQuaternionLike, IVector2Like, IVector3Like, IVector4Like } from "./math.like"; |
4 | | -import { Quaternion, Vector3 } from "./math.vector"; |
| 2 | +import type { IVector2Like, IVector3Like, IVector4Like } from "./math.like"; |
5 | 3 |
|
6 | 4 | /** |
7 | 5 | * Creates a string representation of the IVector2Like |
@@ -170,39 +168,3 @@ export function Vector4Dot(a: DeepImmutable<IVector4Like>, b: DeepImmutable<IVec |
170 | 168 | export function Vector4ToFixed(vector: DeepImmutable<IVector4Like>, decimalCount: number): string { |
171 | 169 | return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`; |
172 | 170 | } |
173 | | - |
174 | | -/** |
175 | | - * Returns the angle in radians between two quaternions |
176 | | - * @param q1 defines the first quaternion |
177 | | - * @param q2 defines the second quaternion |
178 | | - * @returns the angle in radians between the two quaternions |
179 | | - */ |
180 | | -export function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number { |
181 | | - return Math.acos(Clamp(Vector4Dot(q1, q2))) * 2; |
182 | | -} |
183 | | - |
184 | | -/** |
185 | | - * Creates a quaternion from two direction vectors |
186 | | - * @param a defines the first direction vector |
187 | | - * @param b defines the second direction vector |
188 | | - * @returns the target quaternion |
189 | | - */ |
190 | | -export function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion { |
191 | | - const result = new Quaternion(); |
192 | | - GetQuaternionFromDirectionsToRef(a, b, result); |
193 | | - return result; |
194 | | -} |
195 | | - |
196 | | -/** |
197 | | - * Creates a quaternion from two direction vectors |
198 | | - * @param a defines the first direction vector |
199 | | - * @param b defines the second direction vector |
200 | | - * @param result defines the target quaternion |
201 | | - * @returns the target quaternion |
202 | | - */ |
203 | | -export function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT { |
204 | | - const axis = Vector3.Cross(a, b); |
205 | | - const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1)); |
206 | | - Quaternion.RotationAxisToRef(axis, angle, result); |
207 | | - return result; |
208 | | -} |
0 commit comments