Hi Sandro,

Many thanks for the code !

I've just had a quick look at your code and tried it out with some
randomly generated convex polygons  If found a couple of little
problems...

In the Vector2 class, I think you want to make those public final
fields static members:

        private static final double ZERO_TOLERANCE = 1e-06f;
        public static final Vector2 ZERO = new Vector2(0.0d, 0.0d);
        public static final Vector2 UNIT_X = new Vector2(1.0d, 0.0d);
        public static final Vector2 UNIT_Y = new Vector2(0.0d, 1.0d);

And in the method Box2.computeVertices I think this line:

            akVertex[1] = center.add(akEAxis[0]).add(akEAxis[1]);

should be:

            akVertex[1] = center.add(akEAxis[0]).sub(akEAxis[1]);

...otherwise you get a triangle instead of a rectangle :-)

Once I made those changes the code seemed to work well.

I think that this would be a nice facility to add to JTS.

Michael
_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to