Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Polygon "Fixing" Algorithm

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Polygon "Fixing" Algorithm

    Hello there! I bring you a maybe complex question which i would love your help with. Allow me to go straight to the point:

    I desire an algorithm or logic in which i draw a shape using my mouse (for example a square) and it becomes a perfect square, with all the 4 sides in straight lines and perfectly regular. A human-drawn square is hardly perfect, but i wish that after it goes through the "filter" of this algorithm ,it becomes such.

    A fine example of what i wish is in the game Trine, where the Wizard works by a similar principle: You draw a shape in the screen and it becomes the closest shape, that is, if you draw something similar to a square it becomes a perfect square box, but if you draw a triangle it becomes a perfect triangular box. Its like it detects what kind of shape it is and then draws a better version of it.

    I want this for a game, just so you know what is the goal of all this.

    Please help me figure out either the algorithm or logic behind this, or at least tell me what is the name of this kind of action (:

    P.S. i added a simple image so it becomes even more clear what i intend =)


    Shape Perfectioner.jpg


  2. #2
    Junior Member
    Join Date
    Apr 2013
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Polygon "Fixing" Algorithm

    You should search the web for mouse gesture recognition or detection. If you provide some code or even some pseudo-code, I am sure you will get come feed-back from people.

Similar Threads

  1. What makes a "good" encryption algorithm?
    By aesguitar in forum Java Theory & Questions
    Replies: 3
    Last Post: July 11th, 2012, 06:14 PM
  2. "Program execution skips the "if" statement"!
    By antony1925 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 7th, 2012, 07:15 AM
  3. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  4. Replies: 7
    Last Post: August 13th, 2011, 01:22 AM
  5. "java.lang.NoSuchMethodError: main" and "fatal exception occured."
    By joachim89 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 10th, 2010, 08:35 AM

Tags for this Thread