Math_Vector [ class tree: Math_Vector ] [ index: Math_Vector ] [ all elements ]

Class: Math_VectorOp

Source Location: /Math_Vector-0.7.0/Math/VectorOp.php

Class Overview

Vector operation class.

• 1.0

Class Details

[line 32]
Vector operation class.

A static class implementing methods to operate on Vector objects. Originally this class was part of NumPHP (Numeric PHP package)

[ Top ]

Method Detail

 ```object Math_Vector add( object Math_Vector \$v1, object Math_Vector \$v2)```

Vector addition v + w = <v1 + w1, v2 + w2, ..., vk + wk>

Parameters:

 object Math_Vector \$v1 — (or subclass) \$v1 object Math_Vector \$v2 — (or subclass) \$v2

[ Top ]

angleBetween   [line 362]

 ```mixed angleBetween( object Math_Vector2 \$v1, object Math_Vector2 \$v2)```

Angle between vectors, using the equation: v . w = |v| |w| cos(theta)

Parameters:

 object Math_Vector2 \$v1 — or MathVector3 (or subclass) \$v1 object Math_Vector2 \$v2 — or MathVector3 (or subclass) \$v2

[ Top ]

create   [line 90]

 ```object if create( int \$size, numeric \$value)```

Creates a vector of a given size in which all elements have the same value
• Return: (\$size == 2) Math_Vector2 elseif (\$size == 3) Math_Vector3 else Math_Vector
• Access: public

Parameters:

 int \$size — vector size numeric \$value — value to assign to the elements

[ Top ]

createBasis   [line 142]

 ```object if createBasis( int \$size, int \$index)```

Creates a basis vector of the given size A basis vector of size n, has n - 1 elements equal to 0 and one element equal to 1
• Return: (\$size == 2) Math_Vector2 elseif (\$size == 3) Math_Vector3 else Math_Vector, on error PEAR_Error
• See: Math_VectorOp::createZero()
• Access: public

Parameters:

 int \$size — vector size int \$index — element to be set at 1

[ Top ]

createOne   [line 124]

 ```object if createOne( int \$size)```

Creates a one-filled vector of the given size
• Return: (\$size == 2) Math_Vector2 elseif (\$size == 3) Math_Vector3 else Math_Vector
• See: Math_VectorOp::create()
• Access: public

Parameters:

 int \$size — vector size

[ Top ]

createZero   [line 110]

 ```object if createZero( int \$size)```

Creates a zero-filled vector of the given size
• Return: (\$size == 2) Math_Vector2 elseif (\$size == 3) Math_Vector3 else Math_Vector
• See: Math_VectorOp::create()
• Access: public

Parameters:

 int \$size — vector size

[ Top ]

crossProduct   [line 315]

 ```object the crossProduct( object Math_Vector3 \$v1, object Math_Vector3 \$v2)```

Vector cross product = v x w
• Return: cross product vector (Math_Vector3) on success, a PEAR_Error object otherwise
• See: Math_VectorOp::isVector3()
• Access: public

Parameters:

 object Math_Vector3 \$v1 — (or subclass) \$v1 object Math_Vector3 \$v2 — (or subclass) \$v2

[ Top ]

divide   [line 263]

 ```object Math_Vector divide( object Math_Vector \$v1, object Math_Vector \$v2)```

Vector division v / w = <v1 / w1, v2 / w2, ..., vk / wk>

Parameters:

 object Math_Vector \$v1 — (or subclass) \$v1 object Math_Vector \$v2 — (or subclass) \$v2

[ Top ]

dotProduct   [line 292]

 ```mixed dotProduct( object Math_Vector2 \$v1, object Math_Vector2 \$v2)```

Vector dot product = v . w = |v| |w| cos(theta)

Parameters:

 object Math_Vector2 \$v1 — or MathVector3 (or subclass) \$v1 object Math_Vector2 \$v2 — or MathVector3 (or subclass) \$v2

[ Top ]

isVector   [line 41]

 ```boolean isVector( object \$obj)```

Checks if object is of Math_Vector class (or a subclass of Math_Vector)
• Return: true on success
• Access: public

Parameters:

 object \$obj —

[ Top ]

isVector2   [line 57]

 ```boolean isVector2( object \$obj)```

Checks if object is of Math_Vector2 class (or a subclass of Math_Vector2)
• Return: true on success
• Access: public

Parameters:

 object \$obj —

[ Top ]

isVector3   [line 73]

 ```boolean isVector3( object \$obj)```

Checks if object is of Math_Vector3 class (or a subclass of Math_Vector3)
• Return: true on success
• Access: public

Parameters:

 object \$obj —

[ Top ]

multiply   [line 215]

 ```object Math_Vector multiply( object Math_Vector \$v1, object Math_Vector \$v2)```

Vector multiplication v * w = <v1 * w1, v2 * w2, ..., vk * wk>

Parameters:

 object Math_Vector \$v1 — (or subclass) \$v1 object Math_Vector \$v2 — (or subclass) \$v2

[ Top ]

scale   [line 240]

 ```object Math_Vector scale( numeric \$f, object Math_Vector \$v)```

Vector scaling f * w = <f * w1, f * w2, ..., f * wk>

Parameters:

 numeric \$f — scaling factor object Math_Vector \$v — (or subclass) \$v

[ Top ]

substract   [line 190]

 ```object Math_Vector substract( object Math_Vector \$v1, object Math_Vector \$v2)```

Vector substraction v - w = <v1 - w1, v2 - w2, ..., vk - wk>

Parameters:

 object Math_Vector \$v1 — (or subclass) \$v1 object Math_Vector \$v2 — (or subclass) \$v2

[ Top ]

tripleScalarProduct   [line 340]

 ```mixed tripleScalarProduct( object Math_Vector3 \$v1, object Math_Vector3 \$v2, object Math_Vector3 \$v3)```

Vector triple scalar product = v1 . (v2 x v3)

Parameters:

 object Math_Vector3 \$v1 — (or subclass) \$v1 object Math_Vector3 \$v2 — (or subclass) \$v2 object Math_Vector3 \$v3 — (or subclass) \$v3

[ Top ]

Documentation generated on Mon, 11 Mar 2019 15:39:22 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.