MapleStory guides, forums, screens, videos, auctions and new friends await! Signup or login
Mar 07 12
Windia Chief Bandit
jamesisninja
So I'm fairly new to object orientated Java programming and our teacher wants us to creat a rectangle, and any other 5+ Sided shape and my rectangle and that shape are very messed up.. I'm not sure what order to put my points in, so if someone can help that would be great. The rectangles code and how it looks are here:

Code Picture


And the other 5+ sided (real known shape)

Code Picture


thank you for any help!
Share this page Twitter Facebook
New thread Replies
Mar 07 12
In general, you should define a polygon by defining the points clockwise or counterclockwise. According to the API, a line segment will form between the last point and the first, so you have to take that into account.
Mar 08 12
Windia Chief Bandit
jamesisninja
Alright. I kind of get that, anyway you know what I can do to my code to make it work correct. I'll change my points to clockwise.
Mar 08 12
Make the last y-coordinate be yPosition.
Mar 08 12*
Windia Chief Bandit
jamesisninja
I love you Any idea on helping me with my other shape, I'm tinkering on my own hoping to strike gold soon!
Mar 08 12*
I inputted the data into a very old program of mine and the following came out that SHOULD make it work:

50 0
75 -15
100 0
100 8
75 15
50 8

Unfortunately, converting that back to code would take quite a bit of time.

Again, I'm not certain if the output is correct since I haven't tested it for a while, but the general goal is to form a "convex hull" in the way you form your polygon. Otherwise, it might have difficulty forming the correct polygon.

Register / login
You must be a member to reply or post. signup or login