Richard Davey
a2f47d65c1
Modified RandomDataGenerator.weightedPick
method to avoid sampling past the last element. Fix #6701
2024-01-31 21:33:47 +00:00
Richard Davey
45f553d8af
x and y are non-optional. Fix #6518
2024-01-31 21:22:39 +00:00
Richard Davey
f844e966bc
The RandomDataGenerator#weightedPick
method will no longer under-sample the first and last elements in the given array, leading to better distribution of results. Fix #6562
2023-11-08 16:44:27 +00:00
Richard Davey
b4849cf4f1
Math.Wrap` has been reverted to the previous version. Fix #6479
2023-07-21 18:32:45 +01:00
Richard Davey
3f045086d3
Typo
2023-04-04 17:55:37 +01:00
Richard Davey
4b1d3430b7
Update const.js
2023-03-01 15:19:37 +00:00
Richard Davey
5d75d771f8
Wrap shouldn't adjust a value already in the range
2023-01-24 13:43:15 +00:00
Richard Davey
468bf7821d
Updated copyright year
2023-01-02 17:36:27 +00:00
Flávio Silva
b2a0fe79ed
fix: Wrap documentation
2022-07-28 15:42:18 +01:00
samme
df9f4a63b1
Add Phaser.Math.Vector2#project()
2022-05-03 11:05:55 -07:00
Richard Davey
59fbcc5ca3
Updated copyright year
2022-02-28 14:29:51 +00:00
Richard Davey
bf0b3b1601
Correct version number
2021-11-04 16:39:36 +00:00
GregDevProjects
0c04102731
rename function, move it to Math class
2021-10-10 10:49:54 -03:00
Greg
1d009f8a68
Add static Lerp method on Vector2
2021-10-06 21:56:02 -03:00
Richard Davey
32209baf39
Updated jsdocs
2021-09-22 11:24:35 +01:00
Trissolo
8ae19dee83
Fixed - Math#ToXY: now the existing vector passed as 'out' is setted even if 'index' is 0.
2021-04-05 10:31:21 +02:00
Richard Davey
dc980a6a49
Merge pull request #5621 from vforsh/master
...
Add Phaser.Math.Median method
2021-03-26 09:46:17 +00:00
samme
77d14af82a
Docs: Vector2Like args for Vector2
2021-03-25 11:54:15 -07:00
Vladislav Forsh
953dd93e9a
Add Phaser.Math.Median method
2021-03-25 17:42:22 +03:00
Christian Aistleitner
cbf3957a33
Allow non-zero min
in FromPercent
...
`FromPercent` silently assumed `min` to be 0. Shifting the result by
`min` makes it work as documented and gives a value between `min` and
`max`.
Our uses of `FromPercent` only have `min` at 0, so there is no
regression in our code. This is merely a fix for 3rd party users.
2021-01-31 21:08:46 +01:00
Richard Davey
cbe1a3219a
JSDoc improvements
2020-12-14 13:33:42 +00:00
Richard Davey
02c34cd64e
Replace integer with number
2020-11-23 10:22:13 +00:00
Richard Davey
c3fe480905
Finished all docs and added some missing methods and made use of setValues
2020-10-07 17:42:19 +01:00
Richard Davey
ee7804f515
Matrix4.getInverse
is a new method that takes a Matrix4, copies it to the current matrix, then returns the inverse of it.
2020-09-30 17:07:32 +01:00
Richard Davey
f8d7e823d7
Quaternion.setFromRotationMatrix
is a new method that will set the rotation of the quaternion from the given Matrix4.
2020-09-30 15:09:35 +01:00
Richard Davey
7f3e6798e4
Added multiplyMatrices
and premultiply
methods and removed unused method.
2020-09-30 14:02:16 +01:00
Richard Davey
06d359dc25
Matrix4.transform
is a new method that will generate a transform matrix from the given position and scale vectors and a rotation quaternion.
...
Removed un-used methods.
2020-09-30 13:48:59 +01:00
Richard Davey
d3e318a51c
Added projectViewMatrix
and unprojectViewMatrix
.
2020-09-30 13:39:48 +01:00
Richard Davey
40a808cb50
Matrix4.lookAtRH
is a new method that will generate a right-handed look-at matrix from the given eye, target and up positions.
2020-09-30 13:36:14 +01:00
Richard Davey
51ab68573f
Matrix4.getMaxScaleOnAxis
is a new method that will return the maximum axis scale from the Matrix4.
2020-09-30 13:19:20 +01:00
Richard Davey
7896bb4157
Added new methods.
...
* `Vector3.setFromMatrixPosition` is a new method that will set the components of the Vector3 based on the position of the given Matrix4.
* `Vector3.setFromMatrixColumn` is a new method that will set the components of the Vector3 based on the specified Matrix4 column.
* `Vector3.fromArray` is a new method that will set the components of the Vector3 based on the values in the given array, at the given offset.
* `Vector3.min` is a new method that will set the components of the Vector3 based on the `Main.min` between it and the given Vector3.
* `Vector3.max` is a new method that will set the components of the Vector3 based on the `Main.max` between it and the given Vector3.
* `Vector3.addVectors` is a new method that will set the components of the Vector3 based on the addition of the two Vector3s given.
* `Vector3.addScalar` is a new method that will multiply the components of the Vector3 by the scale value given.
* `Vector3.applyMatrix3` is a new method that will take a Matrix3 and apply it to the Vector3.
* `Vector3.applyMatrix4` is a new method that will take a Matrix4 and apply it to the Vector3.
2020-09-30 13:18:45 +01:00
Richard Davey
c299c9e108
Renamed method to setFromEuler
2020-09-30 11:23:01 +01:00
Richard Davey
3b8c78cca2
Quaternion.fromEuler
is a new method that will set the quaternion from the given Euler
object, optionally calling the onChangeCallback
in the process.
...
The `Quaternion.set` method has a new optional boolean parameter `update` (defaults to `true`), which will call the `onChangeCallback` if set.
2020-09-30 11:21:28 +01:00
Richard Davey
11e6101f8d
Added Math.Euler class
2020-09-30 11:02:54 +01:00
Richard Davey
368df2acef
Quaternion
now has a new property onChangeCallback
which, if set, will be invoked each time the quaternion is updated. This allows you to link change events to other objects.
...
Internally, the `Quaternion` class now has 4 new private properties: `_x`, `_y`, `_z` and `_w` and 4 new getters and setters for the public versions. It also now passes most methods via `set` to allow for the onChange callback to be invoked. This does not change the public-facing API.
2020-09-30 11:02:33 +01:00
Richard Davey
1b4af32ec2
The Quaternion
class constructor will now default the values to 0,0,0,1
if they're not provided, making it an identity quaternion, rather than the 0,0,0,0
it was before.
2020-09-21 10:13:50 +01:00
Richard Davey
0e2911c4a5
Added fromRotation and mult methods
2020-09-18 17:50:40 +01:00
Richard Davey
d40f99c332
Vertor3.addScale
is a new method that will add the given vector and multiply it in the process.
2020-09-17 18:07:54 +01:00
Richard Davey
4baa0522b9
Bumping to 3.50
2020-07-31 13:41:29 +01:00
Richard Davey
771509d6c2
Phaser.Types.Math.Vector4Like
is a new data type representing as Vector 4 like object.
2020-07-29 17:42:12 +01:00
Richard Davey
23c00d148d
Phaser.Types.Math.Vector3Like
is a new data type representing as Vector 3 like object.
2020-07-29 17:41:59 +01:00
Richard Davey
bbdf9b9853
Fixed data type
2020-07-14 09:45:30 +01:00
samme
a626ba2777
Add Math#RotateTo
2020-07-03 11:08:04 -07:00
Richard Davey
4d190470f3
Fixed Vector2Like types
2020-04-27 16:13:17 +01:00
Richard Davey
a03b6e6592
Lint fixes
2020-04-27 12:59:28 +01:00
Richard Davey
43670b1abc
Merge pull request #5032 from jcyuan/master
...
TS def improvements
2020-04-27 11:56:59 +01:00
Richard Davey
8733847842
Should be between -180, 180 #5075
2020-04-27 10:23:55 +01:00
Richard Davey
92e4345c0e
Should be between -pi, pi #5075
2020-04-27 10:23:44 +01:00
Richard Davey
18d5767e14
Merge pull request #5075 from samme/feature/math-angle-random
...
Add Phaser.Math.Angle.Random() and Phaser.Math.Angle.RandomDegrees()
2020-04-27 10:18:59 +01:00
Richard Davey
fbceacf387
Merge pull request #5092 from samme/feature/Vector2-methods
...
Add Phaser.Math.Vector2 methods
2020-04-27 10:17:42 +01:00