Docs of Buxa\Math\Geo\Object3d\Vector

Buxa\Math\Geo\Object3d
  \
  Buxa\Math\Geo\Object3d\Vector

Type
Final Class
Description
3D Vector
Used Packages
  • None
Children
  • None
Implemented Interfaces
Constants
  • None
Properties
  • None
Inherited Properties
  • None
Methods
Inherited Methods
See
None
Links
None
Todo
None
Source
Buxa\Math\Geo\Object3d\Vector.php
Version
$Id$
Since
forever
Authors
None
Copyright
© 2008 Buxaprojects
Licence
GNU Public License

Properties

None

 

Methods

public void __construct(float $x, float $y, float $z)

Description
Constructs a new 3D vector
Parameters
$x Value to move on x abscissa
$y Value to move on y ordinate
$z Value to move on z altitude
Returns
Void
Throws
None
See
None
Links
None
Todo
None
Since
forever
Authors
None

public Vector add(Vector $vector)

Description
Adds a vector to the vector
Parameters
$vector Vector
Returns
Changed vector
Throws
None
See
None
Links
None
Todo
None
Since
forever
Authors
None

public float dotProduct(Vector $vector)

Description
Returns the dot product of this and the parameter vector
Parameters
$vector Vector factor
Returns
Dot product
Throws
None
See
None
Links
None
Todo
None
Since
forever
Authors
None

public float getLength()

Description
Returns the length
Parameters
None
Returns
Length
Throws
None
See
None
Links
None
Todo
None
Since
forever
Authors
None

public void scale(float $factor)

Description
Scales the vector
Parameters
$factor Factor to scale
Returns
Void
Throws
None
See
None
Links
None
Todo
None
Since
forever
Authors
None

Example

<?php
require_once 'Buxa/Autoloader.php';
Buxa\Autoloader::register();

use 
Buxa\Math\Geo\Object3d\Point;
use 
Buxa\Math\Geo\Object3d\Vector;

$p = new Point(2105);
$v = new Vector(3, -40);

$p->move($v);

echo 
$p->getX(); // 5
echo $p->getY(); // 6
echo $p->getZ(); // 5

$v->scale(-0.5);

$p->move($v);

echo 
$p// (6.5,12,5)
?>