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()¶
Результат: floatThe euclidean length
len2()¶
Результат: floatThe 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)Результат:
floatThe 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)Результат:
floatthe distance between this and the other vector
dst2($x, $y)¶
Параметры:
- $x –
float, php\gdx\math\Vector2- $y –
float- (optional)Результат:
floatthe 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