How to Draw an Arc Starting at a Specific Point

In summary, the student is seeking guidance on how to draw an arc connecting two parallel lines using the fillArc function in Java. They have attempted to use the g.drawArc method but are unsure about the correct x and y coordinates. The conversation includes a discussion on how the coordinate system works and suggests trying x=180 and y=170 as coordinates for the desired arc.
  • #1
zak100
462
11

Homework Statement



Hi,
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 can't 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.

Homework Equations


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

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,
Arc.jpg


Zulfi.
 
Physics news on Phys.org
  • #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
 
  • #3
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.
 

Related to How to Draw an Arc Starting at a Specific Point

1. What is an arc in drawing?

An arc in drawing is a curved line that is used to represent a portion of a circle or other curved shape. It is created by drawing a partial circle with a specific radius and center point.

2. What is the purpose of drawing arcs?

Drawing arcs is useful for creating curved lines and shapes in drawings. It is commonly used in technical drawings, architectural drawings, and other types of illustrations to accurately represent circles, cylinders, and other curved structures.

3. How do I draw an arc accurately?

To draw an arc accurately, you will need a compass or a drawing tool with a compass attachment. Set the compass to the desired radius of the arc, place the point of the compass at the center of the arc, and draw the arc by rotating the compass while keeping the point fixed.

4. What are the key elements of an arc drawing?

The key elements of an arc drawing include the center point, radius, and arc length. The center point is the point from which the arc is drawn, the radius is the distance from the center point to any point on the arc, and the arc length is the portion of the circumference of the circle that the arc covers.

5. How do I use arcs in perspective drawing?

In perspective drawing, arcs are used to create the illusion of depth and distance. By drawing arcs of different sizes and angles, you can create the appearance of curved surfaces and objects that are closer or farther away. It is important to use proper perspective techniques to ensure realistic and accurate results.

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Programming and Computer Science
Replies
4
Views
5K
Back
Top