Hi Keith,

GeneralPath is not meant to solve everyone's needs.  Anyone can create a
new Shape that suits their needs better - that is why Shape is an
interface.  I would encourage you to write a "GamesPath" to solve the
specific collision detection issues you are facing.

Note that Path2D in 1.6 is non-final, but their storage is still private
and we have no plans to make their storage public or protected for
internal reasons...

                       ...jim

[EMAIL PROTECTED] wrote:
Hi Jim,

Thanks for telling us about the reasons behind the API construction.  If you 
have time to respond, I'd like to give feedback about Java2D's geometry API.

Because GeneralPath is final and we can't sub-class it,the class is a little 
un-performant for games development.

In a game we like to do collision detection of game objects and obstacles which 
requires access to the underlying points.  Because this is done many times per 
second (> 50), getting a PathIterator for every access to the points or making 
a new array of points every frame adds a huge load to the garbage collector, 
making GeneralPaths unusable for games.  If we could have sub-classed GeneralPath 
then there wouldn't be this trouble.  I think that making classes final kills a 
lot of the possible functionality in an API.  If GeneralPath was not final, 
imagine all of the different sub-classes of GeneralPath that might have been 
contributed by the community which would do things such as efficient constructive 
area geometry (without making Area objects), be able to efficiently calculate a 
GeneralPath's area, perimeter, and countless other useful things.

What are your thoughts?  And do you know of any API that has a GeneralPath 
equivalent which is not final, implements Shape (so it can be painted by 
Java2D), and which can do constructive area geometry?

Thanks,
Keith
[Message sent by forum member 'commanderkeith' (commanderkeith)]

http://forums.java.net/jive/thread.jspa?messageID=236332

===========================================================================
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".

Reply via email to