1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Understanding drawing of Arc

  1. Mar 2, 2017 #1
    1. The problem statement, all variables and given/known data

    I am trying to draw an arc at the top of two parallel lines i.e connecting two coordinate (130, 170) & (230, 170) using the function below. I cant understand how to start the arc at a particular point.

    public abstract void fillArc(int x,
    int y,
    int width,
    int height,
    int startAngle,
    int arcAngle)

    The resulting arc begins at startAngle and extends for arcAngle degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

    The center of the arc is the center of the rectangle whose origin is (x, y) and
    whose size is specified by the width and height arguments.

    2. Relevant equations
    Instead of eq i have a function:
    public abstract void fillArc(int x,
    int y,
    int width,
    int height,
    int startAngle,
    int arcAngle)

    3. The attempt at a solution
    g.drawLine(130, 170, 130, 270);
    g.drawLine(230, 170, 230, 270);
    g.drawArc(80, 220, 100,30, 0, 180);

    I have stored my result in the image. Some body please guide me,

  2. jcsd
  3. Mar 2, 2017 #2
    It looks like the upper left corner of the rectangle in the picture below is the x,y coordinate for g.drawArc. And I think that the coordinate system is such that x starts from 0 on the left edge and increases to the right, and y starts from 0 on the top and increases downward.
    If the last parameter in g.drawArc was 360, you would get an ellipse that fills the whole 100 by 30 rectangle.
    So it looks like x has to increase to move the arc to the right, and y has to decrease to move the arc upward.
    I'm not positive that I am right on this. Let me know what you find out.
    DrawArc Picture.jpg
  4. Mar 2, 2017 #3


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I do not understand how you arrived at those x and y values for the arc. From the description, it seems like they should be 180, 170, i.e. the coordinates of the point half way between the two points you are trying to connect.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted