Re: [Jts-topo-suite-user] Triangulating polygons?
Brought to you by:
dr_jts
From: Ian T. <ij...@ps...> - 2010-04-24 20:53:17
|
On Fri, Apr 23, 2010 at 10:51 PM, Michael Bedward <mic...@gm...> wrote: > Thanks for the tip Martin. I'll try implementing the second idea. > > Ian, have you already tried the C code ? I'll defer looking at it > until after having a go myself. I've made a start but generating monotone polygons is harder than it looks - I'm having problems with angles - the algorithm calls for determining if the interior angle is less than PI so I was using Angle.interiorAngle(c1,c2,c3) but it never seems to return a value > PI, so I never end up with any merge points. Am I missing something obvious? I tried out the following public void testAngle() { GeometricShapeFactory gsf = new GeometricShapeFactory(); final Coordinate center = new Coordinate(1,1); gsf.setBase(center); gsf.setSize(1); gsf.setNumPoints(360); Polygon circle = gsf.createCircle(); Coordinate[] c = circle.getCoordinates(); Coordinate start = circle.getExteriorRing().getStartPoint().getCoordinate(); int i=0; for(Coordinate cc:c) { System.out.println(i); i++; System.out.println("interior "+Angle.interiorAngle(start, center, cc)); System.out.println("orientatedBetween "+Angle.angleBetweenOriented(start, center, cc)); System.out.println("acute "+Angle.isAcute(start, center, cc)+" "+Angle.isObtuse(start, center, cc)); } } and all the way around the circle I get acute angles and the two angles are always the same. Ian -- Ian Turton |