@lakuna/umath 1.5.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/linalg/DualQuaternion.d.ts +23 -46
- package/dist/linalg/DualQuaternion.d.ts.map +1 -1
- package/dist/linalg/DualQuaternion.js +47 -70
- package/dist/linalg/DualQuaternion.js.map +1 -1
- package/dist/linalg/Matrix2.d.ts +14 -28
- package/dist/linalg/Matrix2.d.ts.map +1 -1
- package/dist/linalg/Matrix2.js +28 -42
- package/dist/linalg/Matrix2.js.map +1 -1
- package/dist/linalg/Matrix3.d.ts +21 -42
- package/dist/linalg/Matrix3.d.ts.map +1 -1
- package/dist/linalg/Matrix3.js +43 -84
- package/dist/linalg/Matrix3.js.map +1 -1
- package/dist/linalg/Matrix4.d.ts +39 -78
- package/dist/linalg/Matrix4.d.ts.map +1 -1
- package/dist/linalg/Matrix4.js +85 -170
- package/dist/linalg/Matrix4.js.map +1 -1
- package/dist/linalg/Quaternion.d.ts +27 -58
- package/dist/linalg/Quaternion.d.ts.map +1 -1
- package/dist/linalg/Quaternion.js +54 -85
- package/dist/linalg/Quaternion.js.map +1 -1
- package/dist/linalg/SlowMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowMatrix.js +52 -78
- package/dist/linalg/SlowMatrix.js.map +1 -1
- package/dist/linalg/SlowVector.d.ts +165 -0
- package/dist/linalg/SlowVector.d.ts.map +1 -0
- package/dist/linalg/SlowVector.js +369 -0
- package/dist/linalg/SlowVector.js.map +1 -0
- package/dist/linalg/Vector.d.ts +14 -15
- package/dist/linalg/Vector.d.ts.map +1 -1
- package/dist/linalg/Vector2.d.ts +28 -50
- package/dist/linalg/Vector2.d.ts.map +1 -1
- package/dist/linalg/Vector2.js +59 -85
- package/dist/linalg/Vector2.js.map +1 -1
- package/dist/linalg/Vector3.d.ts +32 -58
- package/dist/linalg/Vector3.d.ts.map +1 -1
- package/dist/linalg/Vector3.js +67 -107
- package/dist/linalg/Vector3.js.map +1 -1
- package/dist/linalg/Vector4.d.ts +26 -46
- package/dist/linalg/Vector4.d.ts.map +1 -1
- package/dist/linalg/Vector4.js +54 -82
- package/dist/linalg/Vector4.js.map +1 -1
- package/dist/utility/MatrixSizeError.d.ts +1 -1
- package/dist/utility/MatrixSizeError.d.ts.map +1 -1
- package/dist/utility/MatrixSizeError.js +1 -1
- package/dist/utility/MatrixSizeError.js.map +1 -1
- package/dist/utility/VectorSizeError.d.ts +12 -0
- package/dist/utility/VectorSizeError.d.ts.map +1 -0
- package/dist/utility/VectorSizeError.js +15 -0
- package/dist/utility/VectorSizeError.js.map +1 -0
- package/dist/utility/createAxisAngleLike.d.ts +10 -0
- package/dist/utility/createAxisAngleLike.d.ts.map +1 -0
- package/dist/utility/createAxisAngleLike.js +10 -0
- package/dist/utility/createAxisAngleLike.js.map +1 -0
- package/package.json +1 -3
- package/src/index.ts +7 -0
- package/src/linalg/DualQuaternion.ts +51 -134
- package/src/linalg/Matrix2.ts +30 -81
- package/src/linalg/Matrix3.ts +55 -149
- package/src/linalg/Matrix4.ts +135 -291
- package/src/linalg/Quaternion.ts +60 -151
- package/src/linalg/SlowMatrix.ts +82 -81
- package/src/linalg/SlowVector.ts +449 -0
- package/src/linalg/Vector.ts +14 -16
- package/src/linalg/Vector2.ts +63 -153
- package/src/linalg/Vector3.ts +75 -194
- package/src/linalg/Vector4.ts +60 -143
- package/src/utility/MatrixSizeError.ts +1 -1
- package/src/utility/VectorSizeError.ts +14 -0
- package/src/utility/createAxisAngleLike.ts +13 -0
package/src/linalg/Vector4.ts
CHANGED
|
@@ -322,13 +322,8 @@ export const scaleAndAdd = <T extends Vector4Like>(
|
|
|
322
322
|
* @see {@link https://en.wikipedia.org/wiki/Euclidean_distance | Euclidean distance}
|
|
323
323
|
* @public
|
|
324
324
|
*/
|
|
325
|
-
export const distance = (a: Vector4Like, b: Vector4Like): number =>
|
|
326
|
-
|
|
327
|
-
const y = a[1] - b[1];
|
|
328
|
-
const z = a[2] - b[2];
|
|
329
|
-
const w = a[3] - b[3];
|
|
330
|
-
return Math.sqrt(x * x + y * y + z * z + w * w); // `Math.hypot` is slower.
|
|
331
|
-
};
|
|
325
|
+
export const distance = (a: Vector4Like, b: Vector4Like): number =>
|
|
326
|
+
Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2], a[3] - b[3]);
|
|
332
327
|
|
|
333
328
|
/**
|
|
334
329
|
* Calculate the squared Euclidean distance between two vectors.
|
|
@@ -352,13 +347,8 @@ export const squaredDistance = (a: Vector4Like, b: Vector4Like): number => {
|
|
|
352
347
|
* @returns The magnitude.
|
|
353
348
|
* @public
|
|
354
349
|
*/
|
|
355
|
-
export const getMagnitude = (vector: Vector4Like): number =>
|
|
356
|
-
|
|
357
|
-
const y = vector[1];
|
|
358
|
-
const z = vector[2];
|
|
359
|
-
const w = vector[3];
|
|
360
|
-
return Math.sqrt(x * x + y * y + z * z + w * w); // `Math.hypot` is slower.
|
|
361
|
-
};
|
|
350
|
+
export const getMagnitude = (vector: Vector4Like): number =>
|
|
351
|
+
Math.hypot(vector[0], vector[1], vector[2], vector[3]);
|
|
362
352
|
|
|
363
353
|
/**
|
|
364
354
|
* Calculate the squared magnitude (length) of a vector.
|
|
@@ -624,17 +614,15 @@ export default class Vector4
|
|
|
624
614
|
* @param y - The second component.
|
|
625
615
|
* @param z - The third component.
|
|
626
616
|
* @param w - The fourth component.
|
|
627
|
-
* @param out - The vector to store the result in.
|
|
628
617
|
* @returns A new vector.
|
|
629
618
|
*/
|
|
630
|
-
public static fromValues
|
|
619
|
+
public static fromValues(
|
|
631
620
|
x: number,
|
|
632
621
|
y: number,
|
|
633
622
|
z: number,
|
|
634
|
-
w: number
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
return fromValues(x, y, z, w, out);
|
|
623
|
+
w: number
|
|
624
|
+
): Vector4 {
|
|
625
|
+
return fromValues(x, y, z, w, new Vector4());
|
|
638
626
|
}
|
|
639
627
|
|
|
640
628
|
/**
|
|
@@ -678,25 +666,18 @@ export default class Vector4
|
|
|
678
666
|
/**
|
|
679
667
|
* Add two vectors of the same size.
|
|
680
668
|
* @param vector - The other vector.
|
|
681
|
-
* @param out - The vector to store the result in.
|
|
682
669
|
* @returns The sum of the vectors.
|
|
683
670
|
*/
|
|
684
|
-
public add
|
|
685
|
-
vector
|
|
686
|
-
out: T = new Vector4() as Vector4 & T
|
|
687
|
-
): T {
|
|
688
|
-
return add(this, vector, out);
|
|
671
|
+
public add(vector: Vector4Like): Vector4 {
|
|
672
|
+
return add(this, vector, new Vector4());
|
|
689
673
|
}
|
|
690
674
|
|
|
691
675
|
/**
|
|
692
676
|
* Copy the values from this vector to another one.
|
|
693
|
-
* @param out - The vector to store the result in.
|
|
694
677
|
* @returns The copy.
|
|
695
678
|
*/
|
|
696
|
-
public clone
|
|
697
|
-
|
|
698
|
-
): T {
|
|
699
|
-
return copy(this, out);
|
|
679
|
+
public clone(): Vector4 {
|
|
680
|
+
return copy(this, new Vector4());
|
|
700
681
|
}
|
|
701
682
|
|
|
702
683
|
/**
|
|
@@ -711,151 +692,106 @@ export default class Vector4
|
|
|
711
692
|
/**
|
|
712
693
|
* Multiply this vector by another.
|
|
713
694
|
* @param vector - The other vector.
|
|
714
|
-
* @param out - The vector to store the result in.
|
|
715
695
|
* @returns The product of the vectors.
|
|
716
696
|
*/
|
|
717
|
-
public multiply
|
|
718
|
-
vector
|
|
719
|
-
out: T = new Vector4() as Vector4 & T
|
|
720
|
-
): T {
|
|
721
|
-
return multiply(this, vector, out);
|
|
697
|
+
public multiply(vector: Vector4Like): Vector4 {
|
|
698
|
+
return multiply(this, vector, new Vector4());
|
|
722
699
|
}
|
|
723
700
|
|
|
724
701
|
/**
|
|
725
702
|
* Divide this vector by another.
|
|
726
703
|
* @param vector - The other vector.
|
|
727
|
-
* @param out - The vector to store the result in.
|
|
728
704
|
* @returns The quotient of the vectors.
|
|
729
705
|
*/
|
|
730
|
-
public divide
|
|
731
|
-
vector
|
|
732
|
-
out: T = new Vector4() as Vector4 & T
|
|
733
|
-
): T {
|
|
734
|
-
return divide(this, vector, out);
|
|
706
|
+
public divide(vector: Vector4Like): Vector4 {
|
|
707
|
+
return divide(this, vector, new Vector4());
|
|
735
708
|
}
|
|
736
709
|
|
|
737
710
|
/**
|
|
738
711
|
* Subtract another vector from this one.
|
|
739
712
|
* @param vector - The other vector.
|
|
740
|
-
* @param out - The vector to store the result in.
|
|
741
713
|
* @returns The difference between the vectors.
|
|
742
714
|
*/
|
|
743
|
-
public subtract
|
|
744
|
-
vector
|
|
745
|
-
out: T = new Vector4() as Vector4 & T
|
|
746
|
-
): T {
|
|
747
|
-
return subtract(this, vector, out);
|
|
715
|
+
public subtract(vector: Vector4Like): Vector4 {
|
|
716
|
+
return subtract(this, vector, new Vector4());
|
|
748
717
|
}
|
|
749
718
|
|
|
750
719
|
/**
|
|
751
720
|
* Absolutize the components of this vector.
|
|
752
|
-
* @param out - The vector to store the result in.
|
|
753
721
|
* @returns The absolutized vector.
|
|
754
722
|
*/
|
|
755
|
-
public abs
|
|
756
|
-
|
|
757
|
-
): T {
|
|
758
|
-
return abs(this, out);
|
|
723
|
+
public abs(): Vector4 {
|
|
724
|
+
return abs(this, new Vector4());
|
|
759
725
|
}
|
|
760
726
|
|
|
761
727
|
/**
|
|
762
728
|
* Round up the components of this vector.
|
|
763
|
-
* @param out - The vector to store the result in.
|
|
764
729
|
* @returns The rounded vector.
|
|
765
730
|
*/
|
|
766
|
-
public ceil
|
|
767
|
-
|
|
768
|
-
): T {
|
|
769
|
-
return ceil(this, out);
|
|
731
|
+
public ceil(): Vector4 {
|
|
732
|
+
return ceil(this, new Vector4());
|
|
770
733
|
}
|
|
771
734
|
|
|
772
735
|
/**
|
|
773
736
|
* Round down the components of this vector.
|
|
774
|
-
* @param out - The vector to store the result in.
|
|
775
737
|
* @returns The rounded vector.
|
|
776
738
|
*/
|
|
777
|
-
public floor
|
|
778
|
-
|
|
779
|
-
): T {
|
|
780
|
-
return floor(this, out);
|
|
739
|
+
public floor(): Vector4 {
|
|
740
|
+
return floor(this, new Vector4());
|
|
781
741
|
}
|
|
782
742
|
|
|
783
743
|
/**
|
|
784
744
|
* Round the components of this vector.
|
|
785
|
-
* @param out - The vector to store the result in.
|
|
786
745
|
* @returns The rounded vector.
|
|
787
746
|
*/
|
|
788
|
-
public round
|
|
789
|
-
|
|
790
|
-
): T {
|
|
791
|
-
return round(this, out);
|
|
747
|
+
public round(): Vector4 {
|
|
748
|
+
return round(this, new Vector4());
|
|
792
749
|
}
|
|
793
750
|
|
|
794
751
|
/**
|
|
795
752
|
* Return the minimum of this and another vector.
|
|
796
753
|
* @param vector - The other vector.
|
|
797
|
-
* @param out - The vector to store the result in.
|
|
798
754
|
* @returns The minimum.
|
|
799
755
|
*/
|
|
800
|
-
public min
|
|
801
|
-
vector
|
|
802
|
-
out: T = new Vector4() as Vector4 & T
|
|
803
|
-
): T {
|
|
804
|
-
return min(this, vector, out);
|
|
756
|
+
public min(vector: Vector4Like): Vector4 {
|
|
757
|
+
return min(this, vector, new Vector4());
|
|
805
758
|
}
|
|
806
759
|
|
|
807
760
|
/**
|
|
808
761
|
* Return the maximum of this and another vector.
|
|
809
762
|
* @param vector - The other vector.
|
|
810
|
-
* @param out - The vector to store the result in.
|
|
811
763
|
* @returns The maximum.
|
|
812
764
|
*/
|
|
813
|
-
public max
|
|
814
|
-
vector
|
|
815
|
-
out: T = new Vector4() as Vector4 & T
|
|
816
|
-
): T {
|
|
817
|
-
return max(this, vector, out);
|
|
765
|
+
public max(vector: Vector4Like): Vector4 {
|
|
766
|
+
return max(this, vector, new Vector4());
|
|
818
767
|
}
|
|
819
768
|
|
|
820
769
|
/**
|
|
821
770
|
* Raise each component of this vector to the given power.
|
|
822
771
|
* @param scalar - The exponent (power) to raise each component to.
|
|
823
|
-
* @param out - The vector to store the result in.
|
|
824
772
|
* @returns The power (result of the exponentiation).
|
|
825
773
|
*/
|
|
826
|
-
public pow
|
|
827
|
-
scalar
|
|
828
|
-
out: T = new Vector4() as Vector4 & T
|
|
829
|
-
): T {
|
|
830
|
-
return pow(this, scalar, out);
|
|
774
|
+
public pow(scalar: number): Vector4 {
|
|
775
|
+
return pow(this, scalar, new Vector4());
|
|
831
776
|
}
|
|
832
777
|
|
|
833
778
|
/**
|
|
834
779
|
* Scale this vector by a scalar.
|
|
835
780
|
* @param scalar - The scalar.
|
|
836
|
-
* @param out - The vector to store the result in.
|
|
837
781
|
* @returns The scaled vector.
|
|
838
782
|
*/
|
|
839
|
-
public scale
|
|
840
|
-
scalar
|
|
841
|
-
out: T = new Vector4() as Vector4 & T
|
|
842
|
-
): T {
|
|
843
|
-
return scale(this, scalar, out);
|
|
783
|
+
public scale(scalar: number): Vector4 {
|
|
784
|
+
return scale(this, scalar, new Vector4());
|
|
844
785
|
}
|
|
845
786
|
|
|
846
787
|
/**
|
|
847
788
|
* Add another vector to this one after scaling the other by a scalar.
|
|
848
789
|
* @param vector - The other vector.
|
|
849
790
|
* @param scalar - The scalar.
|
|
850
|
-
* @param out - The vector to store the result in.
|
|
851
791
|
* @returns The sum.
|
|
852
792
|
*/
|
|
853
|
-
public scaleAndAdd
|
|
854
|
-
vector
|
|
855
|
-
scalar: number,
|
|
856
|
-
out: T = new Vector4() as Vector4 & T
|
|
857
|
-
): T {
|
|
858
|
-
return scaleAndAdd(this, vector, scalar, out);
|
|
793
|
+
public scaleAndAdd(vector: Vector4Like, scalar: number): Vector4 {
|
|
794
|
+
return scaleAndAdd(this, vector, scalar, new Vector4());
|
|
859
795
|
}
|
|
860
796
|
|
|
861
797
|
/**
|
|
@@ -878,48 +814,47 @@ export default class Vector4
|
|
|
878
814
|
return squaredDistance(this, vector);
|
|
879
815
|
}
|
|
880
816
|
|
|
881
|
-
/**
|
|
817
|
+
/** The magnitude (length) of this vector. */
|
|
882
818
|
public get magnitude(): number {
|
|
883
819
|
return getMagnitude(this);
|
|
884
820
|
}
|
|
885
821
|
|
|
886
|
-
|
|
822
|
+
public set magnitude(value: number) {
|
|
823
|
+
scale(normalize(this, this), value, this);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/** The squared magnitude (length) of this vector. */
|
|
887
827
|
public get squaredMagnitude(): number {
|
|
888
828
|
return getSquaredMagnitude(this);
|
|
889
829
|
}
|
|
890
830
|
|
|
831
|
+
public set squaredMagnitude(value: number) {
|
|
832
|
+
this.magnitude = Math.sqrt(value);
|
|
833
|
+
}
|
|
834
|
+
|
|
891
835
|
/**
|
|
892
836
|
* Negate this vector.
|
|
893
|
-
* @param out - The vector to store the result in.
|
|
894
837
|
* @returns The negated vector.
|
|
895
838
|
*/
|
|
896
|
-
public negate
|
|
897
|
-
|
|
898
|
-
): T {
|
|
899
|
-
return negate(this, out);
|
|
839
|
+
public negate(): Vector4 {
|
|
840
|
+
return negate(this, new Vector4());
|
|
900
841
|
}
|
|
901
842
|
|
|
902
843
|
/**
|
|
903
844
|
* Calculate the multiplicative inverse of the components of this vector.
|
|
904
|
-
* @param out - The vector to store the result in.
|
|
905
845
|
* @returns The inverted vector.
|
|
906
846
|
*/
|
|
907
|
-
public invert
|
|
908
|
-
|
|
909
|
-
): T {
|
|
910
|
-
return invert(this, out);
|
|
847
|
+
public invert(): Vector4 {
|
|
848
|
+
return invert(this, new Vector4());
|
|
911
849
|
}
|
|
912
850
|
|
|
913
851
|
/**
|
|
914
852
|
* Normalize this vector.
|
|
915
|
-
* @param out - The vector to store the result in.
|
|
916
853
|
* @returns The normalized vector.
|
|
917
854
|
* @see {@link https://en.wikipedia.org/wiki/Unit_vector | Unit vector}
|
|
918
855
|
*/
|
|
919
|
-
public normalize
|
|
920
|
-
|
|
921
|
-
): T {
|
|
922
|
-
return normalize(this, out);
|
|
856
|
+
public normalize(): Vector4 {
|
|
857
|
+
return normalize(this, new Vector4());
|
|
923
858
|
}
|
|
924
859
|
|
|
925
860
|
/**
|
|
@@ -936,32 +871,22 @@ export default class Vector4
|
|
|
936
871
|
* Calculate the cross product of this and two other vectors in a four-dimensional space.
|
|
937
872
|
* @param a - One other vector.
|
|
938
873
|
* @param b - The other other vector.
|
|
939
|
-
* @param out - The vector to store the result in.
|
|
940
874
|
* @returns The cross product.
|
|
941
875
|
* @see {@link https://en.wikipedia.org/wiki/Cross_product | Cross product}
|
|
942
876
|
*/
|
|
943
|
-
public cross
|
|
944
|
-
a
|
|
945
|
-
b: Vector4Like,
|
|
946
|
-
out: T = new Vector4() as Vector4 & T
|
|
947
|
-
): T {
|
|
948
|
-
return cross(this, a, b, out);
|
|
877
|
+
public cross(a: Vector4Like, b: Vector4Like): Vector4 {
|
|
878
|
+
return cross(this, a, b, new Vector4());
|
|
949
879
|
}
|
|
950
880
|
|
|
951
881
|
/**
|
|
952
882
|
* Perform a linear interpolation between this and another vector.
|
|
953
883
|
* @param vector - The other vector.
|
|
954
884
|
* @param t - The interpolation amount (in `[0,1]`).
|
|
955
|
-
* @param out - The vector to store the result in.
|
|
956
885
|
* @returns The interpolated vector.
|
|
957
886
|
* @see {@link https://en.wikipedia.org/wiki/Linear_interpolation | Linear interpolation}
|
|
958
887
|
*/
|
|
959
|
-
public lerp
|
|
960
|
-
vector
|
|
961
|
-
t: number,
|
|
962
|
-
out: T = new Vector4() as Vector4 & T
|
|
963
|
-
): T {
|
|
964
|
-
return lerp(this, vector, t, out);
|
|
888
|
+
public lerp(vector: Vector4Like, t: number): Vector4 {
|
|
889
|
+
return lerp(this, vector, t, new Vector4());
|
|
965
890
|
}
|
|
966
891
|
|
|
967
892
|
/**
|
|
@@ -976,15 +901,11 @@ export default class Vector4
|
|
|
976
901
|
/**
|
|
977
902
|
* Transform this vector by a four-by-four matrix.
|
|
978
903
|
* @param matrix - The matrix.
|
|
979
|
-
* @param out - The vector to store the result in.
|
|
980
904
|
* @returns The transformed vector.
|
|
981
905
|
* @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
|
|
982
906
|
*/
|
|
983
|
-
public transformMatrix4
|
|
984
|
-
matrix
|
|
985
|
-
out: T = new Vector4() as Vector4 & T
|
|
986
|
-
): T {
|
|
987
|
-
return transformMatrix4(this, matrix, out);
|
|
907
|
+
public transformMatrix4(matrix: Matrix4Like): Vector4 {
|
|
908
|
+
return transformMatrix4(this, matrix, new Vector4());
|
|
988
909
|
}
|
|
989
910
|
|
|
990
911
|
/**
|
|
@@ -998,14 +919,10 @@ export default class Vector4
|
|
|
998
919
|
/**
|
|
999
920
|
* Transform this vector by a quaternion.
|
|
1000
921
|
* @param quaternion - The quaternion.
|
|
1001
|
-
* @param out - The vector to store the result in.
|
|
1002
922
|
* @returns The transformed vector.
|
|
1003
923
|
* @see {@link https://en.wikipedia.org/wiki/Quaternion | Quaternion}
|
|
1004
924
|
*/
|
|
1005
|
-
public transformQuaternion
|
|
1006
|
-
quaternion
|
|
1007
|
-
out: T = new Vector4() as Vector4 & T
|
|
1008
|
-
): T {
|
|
1009
|
-
return transformQuaternion(this, quaternion, out);
|
|
925
|
+
public transformQuaternion(quaternion: QuaternionLike): Vector4 {
|
|
926
|
+
return transformQuaternion(this, quaternion, new Vector4());
|
|
1010
927
|
}
|
|
1011
928
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* An error resulting from trying to use a matrix that is the wrong size.
|
|
3
3
|
* @public
|
|
4
4
|
*/
|
|
5
|
-
export default class
|
|
5
|
+
export default class MatrixSizeError extends Error {
|
|
6
6
|
/**
|
|
7
7
|
* Create an error resulting from trying to use a matrix that is the wrong size.
|
|
8
8
|
* @param message - The message of the error.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An error resulting from trying to use a vector that is the wrong size.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export default class VectorSizeError extends Error {
|
|
6
|
+
/**
|
|
7
|
+
* Create an error resulting from trying to use a vector that is the wrong size.
|
|
8
|
+
* @param message - The message of the error.
|
|
9
|
+
*/
|
|
10
|
+
public constructor(message = "Invalid vector dimensions.") {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "VectorSizeError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type AxisAngle from "../types/AxisAngle.js";
|
|
2
|
+
import { createVector3Like } from "../linalg/Vector3.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create an empty axis-angle pair.
|
|
6
|
+
* @returns An empty axis-angle pair.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export default function createAxisAngleLike(): AxisAngle & {
|
|
10
|
+
axis: Float32Array;
|
|
11
|
+
} {
|
|
12
|
+
return { angle: 0, axis: createVector3Like() };
|
|
13
|
+
}
|