@lakuna/umath 1.3.6 → 1.3.8
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/linalg/DualQuaternion.d.ts +26 -26
- package/dist/linalg/DualQuaternion.d.ts.map +1 -1
- package/dist/linalg/DualQuaternion.js.map +1 -1
- package/dist/linalg/Matrix2.d.ts +15 -15
- package/dist/linalg/Matrix2.d.ts.map +1 -1
- package/dist/linalg/Matrix2.js.map +1 -1
- package/dist/linalg/Matrix3.d.ts +21 -21
- package/dist/linalg/Matrix3.d.ts.map +1 -1
- package/dist/linalg/Matrix3.js.map +1 -1
- package/dist/linalg/Matrix4.d.ts +39 -39
- package/dist/linalg/Matrix4.d.ts.map +1 -1
- package/dist/linalg/Matrix4.js.map +1 -1
- package/dist/linalg/Quaternion.d.ts +22 -22
- package/dist/linalg/Quaternion.d.ts.map +1 -1
- package/dist/linalg/Quaternion.js.map +1 -1
- package/dist/linalg/Vector2.d.ts +24 -24
- package/dist/linalg/Vector2.d.ts.map +1 -1
- package/dist/linalg/Vector2.js.map +1 -1
- package/dist/linalg/Vector3.d.ts +29 -29
- package/dist/linalg/Vector3.d.ts.map +1 -1
- package/dist/linalg/Vector3.js.map +1 -1
- package/dist/linalg/Vector4.d.ts +21 -21
- package/dist/linalg/Vector4.d.ts.map +1 -1
- package/dist/linalg/Vector4.js.map +1 -1
- package/package.json +1 -1
- package/src/linalg/DualQuaternion.ts +51 -51
- package/src/linalg/Matrix2.ts +31 -27
- package/src/linalg/Matrix3.ts +43 -39
- package/src/linalg/Matrix4.ts +77 -71
- package/src/linalg/Quaternion.ts +43 -43
- package/src/linalg/Vector2.ts +51 -39
- package/src/linalg/Vector3.ts +61 -49
- package/src/linalg/Vector4.ts +47 -35
package/src/linalg/Vector3.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface Vector3Like extends VectorLike {
|
|
|
22
22
|
* @returns A 3x1 vector-like object.
|
|
23
23
|
*/
|
|
24
24
|
export const createVector3Like = () => {
|
|
25
|
-
return new Float32Array(3) as
|
|
25
|
+
return new Float32Array(3) as Float32Array & Vector3Like;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -816,11 +816,11 @@ export default class Vector3
|
|
|
816
816
|
* @param out - The vector to store the result in.
|
|
817
817
|
* @returns A new vector.
|
|
818
818
|
*/
|
|
819
|
-
public static fromValues<T extends Vector3Like>(
|
|
819
|
+
public static fromValues<T extends Vector3Like = Vector3>(
|
|
820
820
|
x: number,
|
|
821
821
|
y: number,
|
|
822
822
|
z: number,
|
|
823
|
-
out = new Vector3() as
|
|
823
|
+
out: T = new Vector3() as Vector3 & T
|
|
824
824
|
): T {
|
|
825
825
|
return fromValues(x, y, z, out);
|
|
826
826
|
}
|
|
@@ -866,9 +866,9 @@ export default class Vector3
|
|
|
866
866
|
* @param out - The vector to store the result in.
|
|
867
867
|
* @returns The sum of the vectors.
|
|
868
868
|
*/
|
|
869
|
-
public add<T extends Vector3Like>(
|
|
869
|
+
public add<T extends Vector3Like = Vector3>(
|
|
870
870
|
vector: Vector3Like,
|
|
871
|
-
out: T = new Vector3() as
|
|
871
|
+
out: T = new Vector3() as Vector3 & T
|
|
872
872
|
): T {
|
|
873
873
|
return add(this, vector, out);
|
|
874
874
|
}
|
|
@@ -878,7 +878,9 @@ export default class Vector3
|
|
|
878
878
|
* @param out - The vector to store the result in.
|
|
879
879
|
* @returns The copy.
|
|
880
880
|
*/
|
|
881
|
-
public clone<T extends Vector3Like
|
|
881
|
+
public clone<T extends Vector3Like = Vector3>(
|
|
882
|
+
out: T = new Vector3() as Vector3 & T
|
|
883
|
+
): T {
|
|
882
884
|
return copy(this, out);
|
|
883
885
|
}
|
|
884
886
|
|
|
@@ -897,9 +899,9 @@ export default class Vector3
|
|
|
897
899
|
* @param out - The vector to store the result in.
|
|
898
900
|
* @returns The product of the vectors.
|
|
899
901
|
*/
|
|
900
|
-
public multiply<T extends Vector3Like>(
|
|
902
|
+
public multiply<T extends Vector3Like = Vector3>(
|
|
901
903
|
vector: Vector3Like,
|
|
902
|
-
out = new Vector3() as
|
|
904
|
+
out: T = new Vector3() as Vector3 & T
|
|
903
905
|
): T {
|
|
904
906
|
return multiply(this, vector, out);
|
|
905
907
|
}
|
|
@@ -910,9 +912,9 @@ export default class Vector3
|
|
|
910
912
|
* @param out - The vector to store the result in.
|
|
911
913
|
* @returns The quotient of the vectors.
|
|
912
914
|
*/
|
|
913
|
-
public divide<T extends Vector3Like>(
|
|
915
|
+
public divide<T extends Vector3Like = Vector3>(
|
|
914
916
|
vector: Vector3Like,
|
|
915
|
-
out = new Vector3() as
|
|
917
|
+
out: T = new Vector3() as Vector3 & T
|
|
916
918
|
): T {
|
|
917
919
|
return divide(this, vector, out);
|
|
918
920
|
}
|
|
@@ -923,9 +925,9 @@ export default class Vector3
|
|
|
923
925
|
* @param out - The vector to store the result in.
|
|
924
926
|
* @returns The difference between the vectors.
|
|
925
927
|
*/
|
|
926
|
-
public subtract<T extends Vector3Like>(
|
|
928
|
+
public subtract<T extends Vector3Like = Vector3>(
|
|
927
929
|
vector: Vector3Like,
|
|
928
|
-
out = new Vector3() as
|
|
930
|
+
out: T = new Vector3() as Vector3 & T
|
|
929
931
|
): T {
|
|
930
932
|
return subtract(this, vector, out);
|
|
931
933
|
}
|
|
@@ -935,7 +937,9 @@ export default class Vector3
|
|
|
935
937
|
* @param out - The vector to store the result in.
|
|
936
938
|
* @returns The rounded vector.
|
|
937
939
|
*/
|
|
938
|
-
public ceil<T extends Vector3Like
|
|
940
|
+
public ceil<T extends Vector3Like = Vector3>(
|
|
941
|
+
out: T = new Vector3() as Vector3 & T
|
|
942
|
+
): T {
|
|
939
943
|
return ceil(this, out);
|
|
940
944
|
}
|
|
941
945
|
|
|
@@ -944,7 +948,9 @@ export default class Vector3
|
|
|
944
948
|
* @param out - The vector to store the result in.
|
|
945
949
|
* @returns The rounded vector.
|
|
946
950
|
*/
|
|
947
|
-
public floor<T extends Vector3Like
|
|
951
|
+
public floor<T extends Vector3Like = Vector3>(
|
|
952
|
+
out: T = new Vector3() as Vector3 & T
|
|
953
|
+
): T {
|
|
948
954
|
return floor(this, out);
|
|
949
955
|
}
|
|
950
956
|
|
|
@@ -953,7 +959,9 @@ export default class Vector3
|
|
|
953
959
|
* @param out - The vector to store the result in.
|
|
954
960
|
* @returns The rounded vector.
|
|
955
961
|
*/
|
|
956
|
-
public round<T extends Vector3Like
|
|
962
|
+
public round<T extends Vector3Like = Vector3>(
|
|
963
|
+
out: T = new Vector3() as Vector3 & T
|
|
964
|
+
): T {
|
|
957
965
|
return round(this, out);
|
|
958
966
|
}
|
|
959
967
|
|
|
@@ -963,9 +971,9 @@ export default class Vector3
|
|
|
963
971
|
* @param out - The vector to store the result in.
|
|
964
972
|
* @returns The minimum.
|
|
965
973
|
*/
|
|
966
|
-
public min<T extends Vector3Like>(
|
|
974
|
+
public min<T extends Vector3Like = Vector3>(
|
|
967
975
|
vector: Vector3Like,
|
|
968
|
-
out: T = new Vector3() as
|
|
976
|
+
out: T = new Vector3() as Vector3 & T
|
|
969
977
|
): T {
|
|
970
978
|
return min(this, vector, out);
|
|
971
979
|
}
|
|
@@ -976,9 +984,9 @@ export default class Vector3
|
|
|
976
984
|
* @param out - The vector to store the result in.
|
|
977
985
|
* @returns The maximum.
|
|
978
986
|
*/
|
|
979
|
-
public max<T extends Vector3Like>(
|
|
987
|
+
public max<T extends Vector3Like = Vector3>(
|
|
980
988
|
vector: Vector3Like,
|
|
981
|
-
out = new Vector3() as
|
|
989
|
+
out: T = new Vector3() as Vector3 & T
|
|
982
990
|
): T {
|
|
983
991
|
return max(this, vector, out);
|
|
984
992
|
}
|
|
@@ -989,9 +997,9 @@ export default class Vector3
|
|
|
989
997
|
* @param out - The vector to store the result in.
|
|
990
998
|
* @returns The scaled vector.
|
|
991
999
|
*/
|
|
992
|
-
public scale<T extends Vector3Like>(
|
|
1000
|
+
public scale<T extends Vector3Like = Vector3>(
|
|
993
1001
|
scalar: number,
|
|
994
|
-
out = new Vector3() as
|
|
1002
|
+
out: T = new Vector3() as Vector3 & T
|
|
995
1003
|
): T {
|
|
996
1004
|
return scale(this, scalar, out);
|
|
997
1005
|
}
|
|
@@ -1003,10 +1011,10 @@ export default class Vector3
|
|
|
1003
1011
|
* @param out - The vector to store the result in.
|
|
1004
1012
|
* @returns The sum.
|
|
1005
1013
|
*/
|
|
1006
|
-
public scaleAndAdd<T extends Vector3Like>(
|
|
1014
|
+
public scaleAndAdd<T extends Vector3Like = Vector3>(
|
|
1007
1015
|
vector: Vector3Like,
|
|
1008
1016
|
scalar: number,
|
|
1009
|
-
out = new Vector3() as
|
|
1017
|
+
out: T = new Vector3() as Vector3 & T
|
|
1010
1018
|
): T {
|
|
1011
1019
|
return scaleAndAdd(this, vector, scalar, out);
|
|
1012
1020
|
}
|
|
@@ -1046,7 +1054,9 @@ export default class Vector3
|
|
|
1046
1054
|
* @param out - The vector to store the result in.
|
|
1047
1055
|
* @returns The negated vector.
|
|
1048
1056
|
*/
|
|
1049
|
-
public negate<T extends Vector3Like
|
|
1057
|
+
public negate<T extends Vector3Like = Vector3>(
|
|
1058
|
+
out: T = new Vector3() as Vector3 & T
|
|
1059
|
+
): T {
|
|
1050
1060
|
return negate(this, out);
|
|
1051
1061
|
}
|
|
1052
1062
|
|
|
@@ -1055,7 +1065,9 @@ export default class Vector3
|
|
|
1055
1065
|
* @param out - The vector to store the result in.
|
|
1056
1066
|
* @returns The inverted vector.
|
|
1057
1067
|
*/
|
|
1058
|
-
public invert<T extends Vector3Like
|
|
1068
|
+
public invert<T extends Vector3Like = Vector3>(
|
|
1069
|
+
out: T = new Vector3() as Vector3 & T
|
|
1070
|
+
): T {
|
|
1059
1071
|
return invert(this, out);
|
|
1060
1072
|
}
|
|
1061
1073
|
|
|
@@ -1065,8 +1077,8 @@ export default class Vector3
|
|
|
1065
1077
|
* @returns The normalized vector.
|
|
1066
1078
|
* @see [Unit vector](https://en.wikipedia.org/wiki/Unit_vector)
|
|
1067
1079
|
*/
|
|
1068
|
-
public normalize<T extends Vector3Like>(
|
|
1069
|
-
out = new Vector3() as
|
|
1080
|
+
public normalize<T extends Vector3Like = Vector3>(
|
|
1081
|
+
out: T = new Vector3() as Vector3 & T
|
|
1070
1082
|
): T {
|
|
1071
1083
|
return normalize(this, out);
|
|
1072
1084
|
}
|
|
@@ -1088,9 +1100,9 @@ export default class Vector3
|
|
|
1088
1100
|
* @returns The cross product.
|
|
1089
1101
|
* @see [Cross product](https://en.wikipedia.org/wiki/Cross_product)
|
|
1090
1102
|
*/
|
|
1091
|
-
public cross<T extends Vector3Like>(
|
|
1103
|
+
public cross<T extends Vector3Like = Vector3>(
|
|
1092
1104
|
vector: Vector3Like,
|
|
1093
|
-
out = new Vector3() as
|
|
1105
|
+
out: T = new Vector3() as Vector3 & T
|
|
1094
1106
|
): T {
|
|
1095
1107
|
return cross(this, vector, out);
|
|
1096
1108
|
}
|
|
@@ -1103,10 +1115,10 @@ export default class Vector3
|
|
|
1103
1115
|
* @returns The interpolated vector.
|
|
1104
1116
|
* @see [Linear interpolation](https://en.wikipedia.org/wiki/Linear_interpolation)
|
|
1105
1117
|
*/
|
|
1106
|
-
public lerp<T extends Vector3Like>(
|
|
1118
|
+
public lerp<T extends Vector3Like = Vector3>(
|
|
1107
1119
|
vector: Vector3Like,
|
|
1108
1120
|
t: number,
|
|
1109
|
-
out = new Vector3() as
|
|
1121
|
+
out: T = new Vector3() as Vector3 & T
|
|
1110
1122
|
): T {
|
|
1111
1123
|
return lerp(this, vector, t, out);
|
|
1112
1124
|
}
|
|
@@ -1126,9 +1138,9 @@ export default class Vector3
|
|
|
1126
1138
|
* @param out - The vector to store the result in.
|
|
1127
1139
|
* @returns The transformed vector.
|
|
1128
1140
|
*/
|
|
1129
|
-
public transformMatrix3<T extends Vector3Like>(
|
|
1141
|
+
public transformMatrix3<T extends Vector3Like = Vector3>(
|
|
1130
1142
|
matrix: Matrix3Like,
|
|
1131
|
-
out = new Vector3() as
|
|
1143
|
+
out: T = new Vector3() as Vector3 & T
|
|
1132
1144
|
): T {
|
|
1133
1145
|
return transformMatrix3(this, matrix, out);
|
|
1134
1146
|
}
|
|
@@ -1139,9 +1151,9 @@ export default class Vector3
|
|
|
1139
1151
|
* @param out - The vector to store the result in.
|
|
1140
1152
|
* @returns The transformed vector.
|
|
1141
1153
|
*/
|
|
1142
|
-
public transformMatrix4<T extends Vector3Like>(
|
|
1154
|
+
public transformMatrix4<T extends Vector3Like = Vector3>(
|
|
1143
1155
|
matrix: Matrix4Like,
|
|
1144
|
-
out = new Vector3() as
|
|
1156
|
+
out: T = new Vector3() as Vector3 & T
|
|
1145
1157
|
): T {
|
|
1146
1158
|
return transformMatrix4(this, matrix, out);
|
|
1147
1159
|
}
|
|
@@ -1153,10 +1165,10 @@ export default class Vector3
|
|
|
1153
1165
|
* @param out - The vector to store the result in.
|
|
1154
1166
|
* @returns The rotated vector.
|
|
1155
1167
|
*/
|
|
1156
|
-
public rotateX<T extends Vector3Like>(
|
|
1168
|
+
public rotateX<T extends Vector3Like = Vector3>(
|
|
1157
1169
|
origin: Vector3Like,
|
|
1158
1170
|
r: number,
|
|
1159
|
-
out = new Vector3() as
|
|
1171
|
+
out: T = new Vector3() as Vector3 & T
|
|
1160
1172
|
): T {
|
|
1161
1173
|
return rotateX(this, origin, r, out);
|
|
1162
1174
|
}
|
|
@@ -1168,10 +1180,10 @@ export default class Vector3
|
|
|
1168
1180
|
* @param out - The vector to store the result in.
|
|
1169
1181
|
* @returns The rotated vector.
|
|
1170
1182
|
*/
|
|
1171
|
-
public rotateY<T extends Vector3Like>(
|
|
1183
|
+
public rotateY<T extends Vector3Like = Vector3>(
|
|
1172
1184
|
origin: Vector3Like,
|
|
1173
1185
|
r: number,
|
|
1174
|
-
out = new Vector3() as
|
|
1186
|
+
out: T = new Vector3() as Vector3 & T
|
|
1175
1187
|
): T {
|
|
1176
1188
|
return rotateY(this, origin, r, out);
|
|
1177
1189
|
}
|
|
@@ -1183,10 +1195,10 @@ export default class Vector3
|
|
|
1183
1195
|
* @param out - The vector to store the result in.
|
|
1184
1196
|
* @returns The rotated vector.
|
|
1185
1197
|
*/
|
|
1186
|
-
public rotateZ<T extends Vector3Like>(
|
|
1198
|
+
public rotateZ<T extends Vector3Like = Vector3>(
|
|
1187
1199
|
origin: Vector3Like,
|
|
1188
1200
|
r: number,
|
|
1189
|
-
out = new Vector3() as
|
|
1201
|
+
out: T = new Vector3() as Vector3 & T
|
|
1190
1202
|
): T {
|
|
1191
1203
|
return rotateZ(this, origin, r, out);
|
|
1192
1204
|
}
|
|
@@ -1218,12 +1230,12 @@ export default class Vector3
|
|
|
1218
1230
|
* @returns The interpolated vector.
|
|
1219
1231
|
* @see [Hermite interpolation](https://en.wikipedia.org/wiki/Hermite_interpolation)
|
|
1220
1232
|
*/
|
|
1221
|
-
public hermite<T extends Vector3Like>(
|
|
1233
|
+
public hermite<T extends Vector3Like = Vector3>(
|
|
1222
1234
|
a: Vector3Like,
|
|
1223
1235
|
b: Vector3Like,
|
|
1224
1236
|
end: Vector3Like,
|
|
1225
1237
|
t: number,
|
|
1226
|
-
out = new Vector3() as
|
|
1238
|
+
out: T = new Vector3() as Vector3 & T
|
|
1227
1239
|
): T {
|
|
1228
1240
|
return hermite(this, a, b, end, t, out);
|
|
1229
1241
|
}
|
|
@@ -1238,12 +1250,12 @@ export default class Vector3
|
|
|
1238
1250
|
* @returns The interpolated vector.
|
|
1239
1251
|
* @see [Bézier curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve)
|
|
1240
1252
|
*/
|
|
1241
|
-
public bezier<T extends Vector3Like>(
|
|
1253
|
+
public bezier<T extends Vector3Like = Vector3>(
|
|
1242
1254
|
a: Vector3Like,
|
|
1243
1255
|
b: Vector3Like,
|
|
1244
1256
|
end: Vector3Like,
|
|
1245
1257
|
t: number,
|
|
1246
|
-
out = new Vector3() as
|
|
1258
|
+
out: T = new Vector3() as Vector3 & T
|
|
1247
1259
|
): T {
|
|
1248
1260
|
return bezier(this, a, b, end, t, out);
|
|
1249
1261
|
}
|
|
@@ -1255,9 +1267,9 @@ export default class Vector3
|
|
|
1255
1267
|
* @returns The transformed vector.
|
|
1256
1268
|
* @see [Quaternion](https://en.wikipedia.org/wiki/Quaternion)
|
|
1257
1269
|
*/
|
|
1258
|
-
public transformQuaternion<T extends Vector3Like>(
|
|
1270
|
+
public transformQuaternion<T extends Vector3Like = Vector3>(
|
|
1259
1271
|
quaternion: QuaternionLike,
|
|
1260
|
-
out = new Vector3() as
|
|
1272
|
+
out: T = new Vector3() as Vector3 & T
|
|
1261
1273
|
): T {
|
|
1262
1274
|
return transformQuaternion(this, quaternion, out);
|
|
1263
1275
|
}
|
|
@@ -1268,9 +1280,9 @@ export default class Vector3
|
|
|
1268
1280
|
* @param out - The quaternion to store the result in.
|
|
1269
1281
|
* @returns The quaternion.
|
|
1270
1282
|
*/
|
|
1271
|
-
public rotationTo<T extends QuaternionLike>(
|
|
1283
|
+
public rotationTo<T extends QuaternionLike = Quaternion>(
|
|
1272
1284
|
vector: Vector3Like,
|
|
1273
|
-
out = new Quaternion() as
|
|
1285
|
+
out: T = new Quaternion() as Quaternion & T
|
|
1274
1286
|
): T {
|
|
1275
1287
|
return rotationTo(this, vector, out);
|
|
1276
1288
|
}
|
package/src/linalg/Vector4.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface Vector4Like extends VectorLike {
|
|
|
23
23
|
* @returns A 4x1 vector-like object.
|
|
24
24
|
*/
|
|
25
25
|
export const createVector4Like = () => {
|
|
26
|
-
return new Float32Array(4) as
|
|
26
|
+
return new Float32Array(4) as Float32Array & Vector4Like;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -605,12 +605,12 @@ export default class Vector4
|
|
|
605
605
|
* @param out - The vector to store the result in.
|
|
606
606
|
* @returns A new vector.
|
|
607
607
|
*/
|
|
608
|
-
public static fromValues<T extends Vector4Like>(
|
|
608
|
+
public static fromValues<T extends Vector4Like = Vector4>(
|
|
609
609
|
x: number,
|
|
610
610
|
y: number,
|
|
611
611
|
z: number,
|
|
612
612
|
w: number,
|
|
613
|
-
out = new Vector4() as
|
|
613
|
+
out: T = new Vector4() as Vector4 & T
|
|
614
614
|
): T {
|
|
615
615
|
return fromValues(x, y, z, w, out);
|
|
616
616
|
}
|
|
@@ -659,9 +659,9 @@ export default class Vector4
|
|
|
659
659
|
* @param out - The vector to store the result in.
|
|
660
660
|
* @returns The sum of the vectors.
|
|
661
661
|
*/
|
|
662
|
-
public add<T extends Vector4Like>(
|
|
662
|
+
public add<T extends Vector4Like = Vector4>(
|
|
663
663
|
vector: Vector4Like,
|
|
664
|
-
out = new Vector4() as
|
|
664
|
+
out: T = new Vector4() as Vector4 & T
|
|
665
665
|
): T {
|
|
666
666
|
return add(this, vector, out);
|
|
667
667
|
}
|
|
@@ -671,7 +671,9 @@ export default class Vector4
|
|
|
671
671
|
* @param out - The vector to store the result in.
|
|
672
672
|
* @returns The copy.
|
|
673
673
|
*/
|
|
674
|
-
public clone<T extends Vector4Like
|
|
674
|
+
public clone<T extends Vector4Like = Vector4>(
|
|
675
|
+
out: T = new Vector4() as Vector4 & T
|
|
676
|
+
): T {
|
|
675
677
|
return copy(this, out);
|
|
676
678
|
}
|
|
677
679
|
|
|
@@ -690,9 +692,9 @@ export default class Vector4
|
|
|
690
692
|
* @param out - The vector to store the result in.
|
|
691
693
|
* @returns The product of the vectors.
|
|
692
694
|
*/
|
|
693
|
-
public multiply<T extends Vector4Like>(
|
|
695
|
+
public multiply<T extends Vector4Like = Vector4>(
|
|
694
696
|
vector: Vector4Like,
|
|
695
|
-
out = new Vector4() as
|
|
697
|
+
out: T = new Vector4() as Vector4 & T
|
|
696
698
|
): T {
|
|
697
699
|
return multiply(this, vector, out);
|
|
698
700
|
}
|
|
@@ -703,9 +705,9 @@ export default class Vector4
|
|
|
703
705
|
* @param out - The vector to store the result in.
|
|
704
706
|
* @returns The quotient of the vectors.
|
|
705
707
|
*/
|
|
706
|
-
public divide<T extends Vector4Like>(
|
|
708
|
+
public divide<T extends Vector4Like = Vector4>(
|
|
707
709
|
vector: Vector4Like,
|
|
708
|
-
out = new Vector4() as
|
|
710
|
+
out: T = new Vector4() as Vector4 & T
|
|
709
711
|
): T {
|
|
710
712
|
return divide(this, vector, out);
|
|
711
713
|
}
|
|
@@ -716,9 +718,9 @@ export default class Vector4
|
|
|
716
718
|
* @param out - The vector to store the result in.
|
|
717
719
|
* @returns The difference between the vectors.
|
|
718
720
|
*/
|
|
719
|
-
public subtract<T extends Vector4Like>(
|
|
721
|
+
public subtract<T extends Vector4Like = Vector4>(
|
|
720
722
|
vector: Vector4Like,
|
|
721
|
-
out = new Vector4() as
|
|
723
|
+
out: T = new Vector4() as Vector4 & T
|
|
722
724
|
): T {
|
|
723
725
|
return subtract(this, vector, out);
|
|
724
726
|
}
|
|
@@ -728,7 +730,9 @@ export default class Vector4
|
|
|
728
730
|
* @param out - The vector to store the result in.
|
|
729
731
|
* @returns The rounded vector.
|
|
730
732
|
*/
|
|
731
|
-
public ceil<T extends Vector4Like
|
|
733
|
+
public ceil<T extends Vector4Like = Vector4>(
|
|
734
|
+
out: T = new Vector4() as Vector4 & T
|
|
735
|
+
): T {
|
|
732
736
|
return ceil(this, out);
|
|
733
737
|
}
|
|
734
738
|
|
|
@@ -737,7 +741,9 @@ export default class Vector4
|
|
|
737
741
|
* @param out - The vector to store the result in.
|
|
738
742
|
* @returns The rounded vector.
|
|
739
743
|
*/
|
|
740
|
-
public floor<T extends Vector4Like
|
|
744
|
+
public floor<T extends Vector4Like = Vector4>(
|
|
745
|
+
out: T = new Vector4() as Vector4 & T
|
|
746
|
+
): T {
|
|
741
747
|
return floor(this, out);
|
|
742
748
|
}
|
|
743
749
|
|
|
@@ -746,7 +752,9 @@ export default class Vector4
|
|
|
746
752
|
* @param out - The vector to store the result in.
|
|
747
753
|
* @returns The rounded vector.
|
|
748
754
|
*/
|
|
749
|
-
public round<T extends Vector4Like
|
|
755
|
+
public round<T extends Vector4Like = Vector4>(
|
|
756
|
+
out: T = new Vector4() as Vector4 & T
|
|
757
|
+
): T {
|
|
750
758
|
return round(this, out);
|
|
751
759
|
}
|
|
752
760
|
|
|
@@ -756,9 +764,9 @@ export default class Vector4
|
|
|
756
764
|
* @param out - The vector to store the result in.
|
|
757
765
|
* @returns The minimum.
|
|
758
766
|
*/
|
|
759
|
-
public min<T extends Vector4Like>(
|
|
767
|
+
public min<T extends Vector4Like = Vector4>(
|
|
760
768
|
vector: Vector4Like,
|
|
761
|
-
out = new Vector4() as
|
|
769
|
+
out: T = new Vector4() as Vector4 & T
|
|
762
770
|
): T {
|
|
763
771
|
return min(this, vector, out);
|
|
764
772
|
}
|
|
@@ -769,9 +777,9 @@ export default class Vector4
|
|
|
769
777
|
* @param out - The vector to store the result in.
|
|
770
778
|
* @returns The maximum.
|
|
771
779
|
*/
|
|
772
|
-
public max<T extends Vector4Like>(
|
|
780
|
+
public max<T extends Vector4Like = Vector4>(
|
|
773
781
|
vector: Vector4Like,
|
|
774
|
-
out = new Vector4() as
|
|
782
|
+
out: T = new Vector4() as Vector4 & T
|
|
775
783
|
): T {
|
|
776
784
|
return max(this, vector, out);
|
|
777
785
|
}
|
|
@@ -782,9 +790,9 @@ export default class Vector4
|
|
|
782
790
|
* @param out - The vector to store the result in.
|
|
783
791
|
* @returns The scaled vector.
|
|
784
792
|
*/
|
|
785
|
-
public scale<T extends Vector4Like>(
|
|
793
|
+
public scale<T extends Vector4Like = Vector4>(
|
|
786
794
|
scalar: number,
|
|
787
|
-
out = new Vector4() as
|
|
795
|
+
out: T = new Vector4() as Vector4 & T
|
|
788
796
|
): T {
|
|
789
797
|
return scale(this, scalar, out);
|
|
790
798
|
}
|
|
@@ -796,10 +804,10 @@ export default class Vector4
|
|
|
796
804
|
* @param out - The vector to store the result in.
|
|
797
805
|
* @returns The sum.
|
|
798
806
|
*/
|
|
799
|
-
public scaleAndAdd<T extends Vector4Like>(
|
|
807
|
+
public scaleAndAdd<T extends Vector4Like = Vector4>(
|
|
800
808
|
vector: Vector4Like,
|
|
801
809
|
scalar: number,
|
|
802
|
-
out = new Vector4() as
|
|
810
|
+
out: T = new Vector4() as Vector4 & T
|
|
803
811
|
): T {
|
|
804
812
|
return scaleAndAdd(this, vector, scalar, out);
|
|
805
813
|
}
|
|
@@ -839,7 +847,9 @@ export default class Vector4
|
|
|
839
847
|
* @param out - The vector to store the result in.
|
|
840
848
|
* @returns The negated vector.
|
|
841
849
|
*/
|
|
842
|
-
public negate<T extends Vector4Like
|
|
850
|
+
public negate<T extends Vector4Like = Vector4>(
|
|
851
|
+
out: T = new Vector4() as Vector4 & T
|
|
852
|
+
): T {
|
|
843
853
|
return negate(this, out);
|
|
844
854
|
}
|
|
845
855
|
|
|
@@ -848,7 +858,9 @@ export default class Vector4
|
|
|
848
858
|
* @param out - The vector to store the result in.
|
|
849
859
|
* @returns The inverted vector.
|
|
850
860
|
*/
|
|
851
|
-
public invert<T extends Vector4Like
|
|
861
|
+
public invert<T extends Vector4Like = Vector4>(
|
|
862
|
+
out: T = new Vector4() as Vector4 & T
|
|
863
|
+
): T {
|
|
852
864
|
return invert(this, out);
|
|
853
865
|
}
|
|
854
866
|
|
|
@@ -858,8 +870,8 @@ export default class Vector4
|
|
|
858
870
|
* @returns The normalized vector.
|
|
859
871
|
* @see [Unit vector](https://en.wikipedia.org/wiki/Unit_vector)
|
|
860
872
|
*/
|
|
861
|
-
public normalize<T extends Vector4Like>(
|
|
862
|
-
out = new Vector4() as
|
|
873
|
+
public normalize<T extends Vector4Like = Vector4>(
|
|
874
|
+
out: T = new Vector4() as Vector4 & T
|
|
863
875
|
): T {
|
|
864
876
|
return normalize(this, out);
|
|
865
877
|
}
|
|
@@ -882,10 +894,10 @@ export default class Vector4
|
|
|
882
894
|
* @returns The cross product.
|
|
883
895
|
* @see [Cross product](https://en.wikipedia.org/wiki/Cross_product)
|
|
884
896
|
*/
|
|
885
|
-
public cross<T extends Vector4Like>(
|
|
897
|
+
public cross<T extends Vector4Like = Vector4>(
|
|
886
898
|
a: Vector4Like,
|
|
887
899
|
b: Vector4Like,
|
|
888
|
-
out = new Vector4() as
|
|
900
|
+
out: T = new Vector4() as Vector4 & T
|
|
889
901
|
): T {
|
|
890
902
|
return cross(this, a, b, out);
|
|
891
903
|
}
|
|
@@ -898,10 +910,10 @@ export default class Vector4
|
|
|
898
910
|
* @returns The interpolated vector.
|
|
899
911
|
* @see [Linear interpolation](https://en.wikipedia.org/wiki/Linear_interpolation)
|
|
900
912
|
*/
|
|
901
|
-
public lerp<T extends Vector4Like>(
|
|
913
|
+
public lerp<T extends Vector4Like = Vector4>(
|
|
902
914
|
vector: Vector4Like,
|
|
903
915
|
t: number,
|
|
904
|
-
out = new Vector4() as
|
|
916
|
+
out: T = new Vector4() as Vector4 & T
|
|
905
917
|
): T {
|
|
906
918
|
return lerp(this, vector, t, out);
|
|
907
919
|
}
|
|
@@ -922,9 +934,9 @@ export default class Vector4
|
|
|
922
934
|
* @returns The transformed vector.
|
|
923
935
|
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
924
936
|
*/
|
|
925
|
-
public transformMatrix4<T extends Vector4Like>(
|
|
937
|
+
public transformMatrix4<T extends Vector4Like = Vector4>(
|
|
926
938
|
matrix: Matrix4Like,
|
|
927
|
-
out = new Vector4() as
|
|
939
|
+
out: T = new Vector4() as Vector4 & T
|
|
928
940
|
): T {
|
|
929
941
|
return transformMatrix4(this, matrix, out);
|
|
930
942
|
}
|
|
@@ -944,9 +956,9 @@ export default class Vector4
|
|
|
944
956
|
* @returns The transformed vector.
|
|
945
957
|
* @see [Quaternion](https://en.wikipedia.org/wiki/Quaternion)
|
|
946
958
|
*/
|
|
947
|
-
public transformQuaternion<T extends Vector4Like>(
|
|
959
|
+
public transformQuaternion<T extends Vector4Like = Vector4>(
|
|
948
960
|
quaternion: QuaternionLike,
|
|
949
|
-
out = new Vector4() as
|
|
961
|
+
out: T = new Vector4() as Vector4 & T
|
|
950
962
|
): T {
|
|
951
963
|
return transformQuaternion(this, quaternion, out);
|
|
952
964
|
}
|