public function testConstructorSetsExpectedPropertyValues()
 {
     $x = 123.4;
     $y = 456.7;
     $z = 789.1;
     $datum = $this->datumFactory->createDefault();
     $instance = new CartesianCoordinate($x, $y, $z, $datum);
     $this->assertEquals($x, $instance->getX());
     $this->assertEquals($y, $instance->getY());
     $this->assertEquals($z, $instance->getZ());
     $this->assertEquals($datum, $instance->getDatum());
 }
Пример #2
0
 /**
  * Perform the HelmertTransform on a CartesianCoordinate.
  *
  * @param CartesianCoordinate $coordinate The CartesianCoordinate to transform.
  *
  * @return CartesianCoordinate The transformed CartesianCoordinate.
  */
 public function transform(CartesianCoordinate $coordinate)
 {
     $x = $coordinate->getX();
     $y = $coordinate->getY();
     $z = $coordinate->getZ();
     $tx = $this->translationX;
     $ty = $this->translationY;
     $tz = $this->translationZ;
     $rx = $this->getRotationXRadians();
     $ry = $this->getRotationYRadians();
     $rz = $this->getRotationZRadians();
     // Normalise parts-per-million to (scaleFactor + 1).
     $s1 = $this->scaleFactor / '1e6' + 1;
     // Apply the transform.
     $x2 = $tx + $x * $s1 - $y * $rz + $z * $ry;
     $y2 = $ty + $x * $rz + $y * $s1 - $z * $rx;
     $z2 = $tz - $x * $ry + $y * $rx + $z * $s1;
     return new CartesianCoordinate($x2, $y2, $z2, clone $coordinate->getDatum());
 }