public function testHelmertOSWorkedExample() { $tx = -446.448; $ty = 125.157; $tz = -542.0599999999999; $s = 2.04894E-5; $rx = -0.1502; $ry = -0.247; $rz = -0.8421; $c = new Cartesian(3909833.018, -147097.138, 5020322.478, RefEll::wgs84()); $c->transformDatum(RefEll::airy1830(), $tx, $ty, $tz, $s, $rx, $ry, $rz); self::assertEquals(3909460.068, round($c->getX(), 3)); self::assertEquals(-146987.302, round($c->getY(), 3)); self::assertEquals(5019888.07, round($c->getZ(), 3)); }
/** * Transform co-ordinates from one datum to another using a Helmert transformation * @param RefEll $toRefEll * @param float $tranX * @param float $tranY * @param float $tranZ * @param float $scale * @param float $rotX rotation about x-axis in seconds * @param float $rotY rotation about y-axis in seconds * @param float $rotZ rotation about z-axis in seconds * @return mixed */ public function transformDatum(RefEll $toRefEll, $tranX, $tranY, $tranZ, $scale, $rotX, $rotY, $rotZ) { if ($this->refEll == $toRefEll) { return; } $cartesian = Cartesian::fromLatLong($this); $cartesian->transformDatum($toRefEll, $tranX, $tranY, $tranZ, $scale, $rotX, $rotY, $rotZ); $newLatLng = $cartesian->toLatitudeLongitude(); $this->lat = $newLatLng->getLat(); $this->lng = $newLatLng->getLng(); $this->h = $newLatLng->getH(); $this->refEll = $newLatLng->getRefEll(); }