Forums Register Login

how to calculate X Y cooridinates for GeneralPath?

+Pie Number of slices to send: Send
I have never done good graphic work before but I want to play with Graphics for fun.The question is how to
calculate x and y coordinates for GernerPath's functions?

In below code I put some random arguments but actually I have no idea how to calculate those values to draw a stunning object.
Please enlighten me how to do math or how to plan for creating an graphic object.



best regards,
Omi
+Pie Number of slices to send: Send
Wikipedia article. Finding a decent reference on the internet which shows the difference between computer screen locations and ordinary locations is difficult. This is the best I could find.
Suggest you
  • copy your Graphics object with its create method
  • Cast it to Graphics2D
  • Perform a scale transform of x = 1.0, y = -1.0 on it.
  • Preform a translate transform x = width / 2, y = height / 2 on it.
  • Then you can use the same sort of Cartesian coordinates you are used to.
    +Pie Number of slices to send: Send
    I've always thought spirographs were neat; maybe this link will give you some ideas.
    +Pie Number of slices to send: Send
    thanks for your replies.

    BTW I wonder if Adobe Flash can get vertices from a drawing object.

    I mean we draw polygons in Adobe flash and get their vertices by someway and use them
    as an argument in Java's drawing functions. :P

    +Pie Number of slices to send: Send
    Try drawing on squared paper.
    Try tracing lines on a JPanel, add a MouseListener, and get the X Y coordinates from the MouseEvent whenever the mouse is clicked.
    +Pie Number of slices to send: Send
    I tried squared paper coordinates but it did not work boss.



    Java code


    Am I missing any functions for 'start' and 'stop'.? What's the functions for 'start' and 'stop'


    Flash and Java both have same coordinates system.When I get coordinates from any drawing in flash and put into Java, I get different shapes surprisingly.

    Why is that ? I thought Flash could save me the trouble so I tried
    it but it made me more frustrated.

    How to translate flash coordinates to Java coordinates ?
    +Pie Number of slices to send: Send
    Don't know. It helps little to say did not work. What went wrong? Did you get lots of lines from one corner of the display to another corner?
    +Pie Number of slices to send: Send
    Below is what I got from Java but expected a flower.




    In Flash I drew a polygon , noted its coordinates and put them into Java but got a unexpected result.



    Coordinates for the polygon

    Oh sure, it's a tiny ad, but under the right circumstances, it gets bigger.
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 1046 times.
    Similar Threads
    Java loops- linear/log time- calculation
    Program: calculates distance between 2 points on 2d plane
    Transpose of a Vector
    Function not returning values.
    how to compare the values in arrays
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Mar 29, 2024 00:19:59.