Please read here first regarding the site update.

Help with Java Programming

Non-MapleStory Tech Talk Computer and tech issues NOT related to Maple Story

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!
JamesInNinjajamesisninja - Level 70
Posted: March


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 07 2012
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.
JamesInNinjajamesisninja - Level 70
Mar 08 2012
Make the last y-coordinate be yPosition.
Mar 08 2012
I love you Any idea on helping me with my other shape, I'm tinkering on my own hoping to strike gold soon!
JamesInNinjajamesisninja - Level 70
Mar 08 2012
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.
Mar 08 2012

Become a member

Signup or login to join the conversation.