Vector2¶
-
php\gdx\math\Vector2
Class Vector2
Methods
__construct
($x, $y)¶
Параметры:
- $x –
float
, php\gdx\math\Vector2 - (optional)- $y –
float
- (optional)
x
()¶
Результат: float
y
()¶
Результат: float
len
()¶
Результат: float
The euclidean length
len2
()¶
Результат: float
The squared euclidean length
set
($x, $y)¶Sets this vector from the given vector or x, y
Параметры:
- $x –
float
, php\gdx\math\Vector2- $y –
float
- (optional)Результат:
sub
($x, $y)¶Subtracts the given vector from this vector.
Параметры:
- $x –
float
, php\gdx\math\Vector2- $y –
float
- (optional)Результат:
nor
()¶Normalizes this vector. Does nothing if it is zero.
Результат: php\gdx\math\Vector2
add
($x, $y)¶Adds the given vector to this vector
Параметры:
- $x –
float
, php\gdx\math\Vector2- $y –
float
- (optional)
dot
($ox, $oy)¶
Параметры:
- $ox –
float
, php\gdx\math\Vector2- $oy –
float
- (optional)Результат:
float
The dot product between this and the other vector
scl
($x, $y)¶Scales this vector by a scalar
Параметры:
- $x –
float
- $y –
float
- (optional)Результат:
mulAdd
($vec, $scalar)¶First scale a supplied vector, then add it to this vector.
Параметры:
- $vec – php\gdx\math\Vector2
- $scalar –
float
Результат:
dst
($x, $y)¶
Параметры:
- $x –
float
, php\gdx\math\Vector2- $y –
float
- (optional)Результат:
float
the distance between this and the other vector
dst2
($x, $y)¶
Параметры:
- $x –
float
, php\gdx\math\Vector2- $y –
float
- (optional)Результат:
float
the squared distance between this and the other vector
limit
($limit)¶
Параметры:
- $limit –
float
Результат:
clamp
($min, $max)¶
Параметры:
- $min –
float
- $max –
float
Результат:
crs
($x, $y)¶
Параметры:
- $x –
float
, php\gdx\math\Vector2- $y –
float
- (optional)Результат:
float
angle
()¶
Результат: float
getAngleRad
()¶
Результат: float
setAngle
($degrees)¶
Параметры:
- $degrees –
float
Результат:
setAngleRad
($radians)¶
Параметры:
- $radians –
float
Результат:
rotate
($degrees)¶
Параметры:
- $degrees –
float
Результат:
rotateRad
($radians)¶
Параметры:
- $radians –
float
Результат:
rotate90
($dir)¶
Параметры:
- $dir –
int
Результат:
lerp
($target, $alpha)¶Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1]. The result is stored in this vector.
Параметры:
- $target – php\gdx\math\Vector2
- $alpha –
float
Результат:
epsilonEquals
($other, $epsilon)¶Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.
Параметры:
- $other – php\gdx\math\Vector2
- $epsilon –
float
Результат:
bool
isUnit
($margin)¶Whether this vector is a unit length vector
Параметры:
- $margin –
float
- (optional)Результат:
bool
isZero
($margin)¶
Параметры:
- $margin –
float
- (optional)
isOnLine
($other, $epsilon)¶
Параметры:
- $other – php\gdx\math\Vector2
- $epsilon –
float
- (optional)Результат:
bool
isCollinear
($other, $epsilon)¶
Параметры:
- $other – php\gdx\math\Vector2
- $epsilon –
float
- (optional)Результат:
bool
isCollinearOpposite
($other, $epsilon)¶
Параметры:
- $other – php\gdx\math\Vector2
- $epsilon –
float
- (optional)Результат:
bool
isPerpendicular
($vector, $epsilon)¶
Параметры:
- $vector – php\gdx\math\Vector2
- $epsilon –
float
- (optional)
hasSameDirection
($vector)¶
Параметры:
- $vector – php\gdx\math\Vector2
Результат:
bool
hasOppositeDirection
($vector)¶
Параметры:
- $vector – php\gdx\math\Vector2
Результат:
bool