public function testGeometry_delaunayTriangulation() { $reader = new GEOSWKTReader(); $writer = new GEOSWKTWriter(); $writer->setRoundingPrecision(0); $g = $reader->read('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))'); $b = $g->delaunayTriangulation(); $this->assertEquals('GEOMETRYCOLLECTION (POLYGON ((0 1, 0 0, 1 0, 0 1)), POLYGON ((0 1, 1 0, 1 1, 0 1)))', $writer->write($b)); $b = $g->delaunayTriangulation(0, true); $this->assertEquals('MULTILINESTRING ((0 1, 1 1), (0 0, 0 1), (0 0, 1 0), (1 0, 1 1), (0 1, 1 0))', $writer->write($b)); }
public function testGeometry_area() { $reader = new GEOSWKTReader(); $writer = new GEOSWKTWriter(); $writer->setRoundingPrecision(0); $g = $reader->read('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))'); $this->assertEquals(1.0, $g->area()); $g = $reader->read('POINT (0 0)'); $this->assertEquals(0.0, $g->area()); $g = $reader->read('LINESTRING (0 0 , 10 0)'); $this->assertEquals(0.0, $g->area()); }