Polygon and Rectangle were part of the original integer-based AWT Graphics API before it was fleshed out in Java 2 to become the "2D API" that we know today. Thus it makes sense that Polygon was created as an integer polygon (for handing directly to the platform APIs that did all of the rendering before we created our own rendering pipelines in Java 2).
The remaining question then is why we didn't create a "2D superclass" for Polygon like we did for Rectangle[2D] and Point[2D] and there isn't a great answer to that. We did create GeneralPath in Java 2, which can handle polygons and much more, but it fell outside of the typical design pattern used for all of the other geom classes (Foo2D with inner subclasses Foo2D.Float and Foo2D.Double). In 1.6 we finally upgraded GeneralPath by creating Path2D(.Float and .Double) and making GeneralPath a trivial subclass of Path2D.Float, but we've never done anything similar with the Polygon [non-]hierarchy. Path2D (and GeneralPath) is powerful enough to be a non-integer-based Polygon so having Polygon2D would be partially redundant. One could view Path2D as the "geom hierarchy virtual parents" of Polygon except that Polygon is unable to subclass them directly since it can provide only a subset of their API. That doesn't preclude Polygon2D, but it makes it much less critical in its absence and potentially detrimental to add at this time to avoid API/code bloating. ...jim [EMAIL PROTECTED] wrote:
Hi, I would like to know why java.awt.Polygon is constructed with integers as opposed to doubles. I want to create a Polygon from an array of Point2D.Double objects, and now face the challenge of having to change all coordinates to integer values. Is there any other way around this? Thanks [Message sent by forum member 'deirdre' (deirdre)] http://forums.java.net/jive/thread.jspa?messageID=236261 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".