public function transformVertex(Vertex $vtx) { $tmp_array = array(); $tmp_array[0][0] = $vtx->getX(); $tmp_array[1][0] = $vtx->getY(); $tmp_array[2][0] = $vtx->getZ(); $tmp_array[3][0] = $vtx->getW(); return new Vertex(array('x' => $this->_mult_line_row($tmp_array, 0, 0), 'y' => $this->_mult_line_row($tmp_array, 1, 0), 'z' => $this->_mult_line_row($tmp_array, 2, 0), 'color' => $vtx->getColor())); }
private function _setVectorFromVertex(Vertex $orig, Vertex $dest) { $this->_x = $dest->getX() / $dest->getW() - $orig->getX() / $orig->getW(); $this->_y = $dest->getY() / $dest->getW() - $orig->getY() / $orig->getW(); $this->_z = $dest->getZ() / $dest->getW() - $orig->getZ() / $orig->getW(); }
public function transformVertex(Vertex $vtx) { $newX = $vtx->getX() * $this->_matrix[0][0] + $vtx->getY() * $this->_matrix[0][1] + $vtx->getZ() * $this->_matrix[0][2] + $this->_matrix[0][3]; $newY = $vtx->getX() * $this->_matrix[1][0] + $vtx->getY() * $this->_matrix[1][1] + $vtx->getZ() * $this->_matrix[1][2] + $this->_matrix[1][3]; $newZ = $vtx->getX() * $this->_matrix[2][0] + $vtx->getY() * $this->_matrix[2][1] + $vtx->getZ() * $this->_matrix[2][2] + $this->_matrix[2][3]; $newW = $vtx->getX() * $this->_matrix[3][0] + $vtx->getY() * $this->_matrix[3][1] + $vtx->getZ() * $this->_matrix[3][2] + $this->_matrix[3][3]; return new Vertex(array('x' => $newX / $newW, 'y' => $newY / $newW, 'z' => $newZ / $newW)); }