Exemple #1
0
 private function _create_translation(Vector $vec)
 {
     $vtcX = new Vector(['dest' => new Vertex(array('x' => 1.0, 'y' => 0.0, 'z' => 0.0, 'w' => 0.0))]);
     $vtcY = new Vector(['dest' => new Vertex(array('x' => 0.0, 'y' => 1.0, 'z' => 0.0, 'w' => 0.0))]);
     $vtcZ = new Vector(['dest' => new Vertex(array('x' => 0.0, 'y' => 0.0, 'z' => 1.0, 'w' => 0.0))]);
     $vtx0 = new Vertex(array('x' => $vec->getX(), 'y' => $vec->getY(), 'z' => $vec->getZ(), 'w' => 1.0));
     $this->_M = array('vtcX' => $vtcX, 'vtcY' => $vtcY, 'vtcZ' => $vtcZ, 'vtx0' => $vtx0);
 }
Exemple #2
0
 public function sub(Vector $rhs)
 {
     return new Vector(array('dest' => new Vertex(array('x' => $this->_x - $rhs->getX(), 'y' => $this->_y - $rhs->getY(), 'z' => $this->_z - $rhs->getZ()))));
 }
Exemple #3
0
 public function sub(Vector $rhs)
 {
     $NewVertex = new Vertex(array('x' => $this->getX() - $rhs->getX(), 'y' => $this->getY() - $rhs->getY(), 'z' => $this->getZ() - $rhs->getZ()));
     $newVec = new Vector(array('dest' => $NewVertex));
     return $newVec;
 }
Exemple #4
0
 private function _construct_translation(Vector $vtc)
 {
     $this->_tab[0] = array(1, 0, 0, $vtc->getX());
     $this->_tab[1] = array(0, 1, 0, $vtc->getY());
     $this->_tab[2] = array(0, 0, 1, $vtc->getZ());
     $this->_tab[3] = array(0, 0, 0, 1);
     if (self::$verbose) {
         echo "Matrix TRANSLATION preset instance constructed." . PHP_EOL;
     }
 }
Exemple #5
0
 function crossProduct(Vector $rsh)
 {
     $x = $this->getY() * $rsh->getZ() - $this->getZ() * $rsh->getY();
     $y = $this->getZ() * $rsh->getX() - $this->getX() * $rsh->getZ();
     $z = $this->getX() * $rsh->getY() - $this->getY() * $rsh->getX();
     $vert = new Vertex(['x' => $x, 'y' => $y, 'z' => $z, 'w' => 0]);
     return new Vector(['dest' => $vert]);
 }