setasign\SetaPDF2\Core\Geometry

Vector Class representing a vector.

File: /SetaPDF v2/Core/Geometry/Vector.php
Old class name (alias): \SetaPDF_Core_Geometry_Vector

Internally the matrix is represented as a 3x3 matrix.

Class hierarchy

Summary

Properties

$_x

protected float Vector::$_x

The X value.

$_y

protected float Vector::$_y

The Y value.

$_z

protected float Vector::$_z

The Z value.


Static Methods

byArray()

public static Vector::byArray (
array $array
): Vector

Creates an instance by an array.

Parameters
$array : array
 

byPoint()

public static Vector::byPoint (
Point $point
): Vector

Creates an instance by a point.

Parameters
$point : Point
 

Methods

__construct()

public Vector::__construct (
int|float $x = 0.0,
int|float $y = 0.0,
int|float $z = 0.0
)

The constructor.

Parameters
$x : int|float
 
$y : int|float
 
$z : int|float
 

add()

public Vector::add (
Vector $vector
): Vector

Add a vector to this vector and return the resulting vector.

Parameters
$vector : Vector
 

cross()

public Vector::cross (
self $with
): Vector

Compute the cross product of this and another vector and return the resulting vector.

Parameters
$with : self
 

divide()

public Vector::divide (
float|int $by
): Vector

Devide the vector by a float value and return the resulting vector.

Parameters
$by : float|int
 

getLength()

public Vector::getLength (
void
): float

Get the length of the vector.

getLengthSquared()

public Vector::getLengthSquared (
void
): float

Get the squared length of the vector.

getValues()

public Vector::getValues (
void
): array

Get all vector values.

getX()

public Vector::getX (
void
): float

Get the value of X.

getY()

public Vector::getY (
void
): float

Get the value of Y.

getZ()

public Vector::getZ (
void
): float

Get the value of Z.

multiply()

public Vector::multiply (
float|int|Matrix $with
): Vector

Multiply the vector with a float value or a matrix and return the resulting vector.

Parameters
$with : float|int|Matrix
 

normalize()

public Vector::normalize (
void
): Vector

Normalize the vector.

scalar()

public Vector::scalar (
Vector $with
): float

Computes the scalar/dot/inner product of this and another vector.

Parameters
$with : Vector
 

subtract()

public Vector::subtract (
Vector $vector
): Vector

Subtract a vector from this vector and return the resulting vector.

Parameters
$vector : Vector
 

toPoint()

public Vector::toPoint (
void
): Point