Ejemplo n.º 1
0
 /**
  * @covers webd\vectors\Vector::norm
  */
 public function testNorm()
 {
     $this->assertEquals(3.7417, $this->object->norm(), '', 0.0001);
 }
Ejemplo n.º 2
0
 static function getPoint($x, $y, Camera $camera, $screenWidth, $screenHeight)
 {
     $recenterX = ($x - $screenWidth / 2.0) / 2.0 / $screenWidth;
     $recenterY = -($y - $screenHeight / 2.0) / 2.0 / $screenHeight;
     $a = Vector::times($recenterX, $camera->right);
     $b = Vector::times($recenterY, $camera->up);
     $c = Vector::plus($a, $b);
     return Vector::norm(Vector::plus($camera->forward, $c));
 }