Current Position:Home > Drawing Arcs (For a cannon game)

# Drawing Arcs (For a cannon game)

Update:11-30Source: network consolidation
I was wondering if anyone could help me out with a java program I'm trying to write. I need to draw an arc from a specific location (which I can handle) but I want it to simulate a cannon fire. All I'm really worrying about at this time is involving gravity - I have no idea how to do this. I'm asking the user for an angle, and the velocity.
If anyone can help explain an equation that would draw an arc please do so! :)
(I've tried looping through the x coordinates which seems to work well, but I don't have a proper equation for y :P)

I think you wouldn't draw an actual arc at all. Instead you'd plot points. You know the cannon velocity. From the cannon angle you can get the X and Y delta (Amount of change in X and Y per time click).
For each time click you plot a point in the X direction - wind speed and in the Y direction - gravity.
For example, let's say that that we ignore wind and we're just shooting from left to right and we're shooting at a 45 degree angle. Y = mX + b tells us that the rise and run for a 45 degree angle are the same. And just for fun let's say that gravity is 0.2 So for each plot you take the previous plot and add subtract the energy lost to gravity. But your X direction stays constant because of the lack of wind resistence. Here we go:
Turn is the time click, X and Y are your delta and LocX and LocY are the location of the dot relative to the end of the cannon
Turn  X   Y    LocX   LocY
1     1   1     1       1
2     1   0.8   2       1.8
3     1   0.6   3       2.4
4     1   0.4   4       2.8
5     1   0.2   5       3.0
6     1   0     6       3.0
7     1  -0.2   7       2.8
8     1  -0.4   8       2.4
9     1  -0.6   9       1.8
10    1  -0.8   10      1.0
11    1  -1.0   11      0So after 11 turns the shell crashes into the ground (Assuming level ground) For uneven ground you just test LocX and LocY for an intercept with your ground level.
You can see how you would do the same thing for wind resistence as well. That would simply change your X increment.
Hope that helps
Greg
• Drawing Arcs (For a cannon game) Update:11-30

I was wondering if anyone could help me out with a java program I'm trying to write. I need to draw an arc from a specific location (which I can handle) but I want it to simulate a cannon fire. All I'm really worrying about at this time is involving

• New To Illustrator CS4  - How do you select the Arc Tool to Draw Arcs? Update:10-11

PDF on Illustrator doesn't indicate how to select the Arc tool. Extract from toe pdf follows: Draw arcs 1 Select the Arc tool .  (HELP -- I CAN'T LOCATE THE ARC TOOL). 2 Do one of the following: • Position the pointer where you want the arc to begin,

• When did Draw Arc .vi Change Format? Update:11-30

In LabView 6.1, Draw Arc .vi had different wiring than in LabView 2010.  I ran into a problem with a VI that I was using as a small subVi that is part of a much bigger Vi and now won't work because the Draw Arc.vi has incorrect wiring.  The only diff

• Drawing arcs and lines Update:11-30

Hi! I am having problem in drawing arc and line. We have function Graphics.drawArc(int x, int y, int startAngle, int endAngle) I need to get the last point where the arc ends. Because I want to draw a line touching the last point of this arc. I reque

• Function to drawing Arc in Java Update:11-30

Hello Everybody!! I have already posted this on the "Jave Programming" forum but this place might be more helpful. I am working on a diagram editor and what I want to do is to allow the user to connect pairs of objects using arcs. ( see this pic

• Draw arc in a boolean array Update:11-30

Hello everyone I want to extract the coordinate of an arc and use them to draw the same arc in a 2D boolean array, I have the start point coordinates, the end point coordinates, the center coordinates and the radius value. the result should be like t

• Draw arc with three point( start, middle, end) Update:11-30

hi all, i want to draw an arc with start point, middle point and end point, how can i do this?Not clear what you want, but will try How to calculate - the unit is the pixel it takes practice thats all & a bit of trial and error.        | intB (pixels

• Draw arc to display angle between two lines Update:11-30

I have two lines which interesect at a point. The line coordinates and interesctionpoint is available. Now i need to draw an overlay arc between the lines to show which angle is measured. I used a IMAQ Overlay arc VI. I chose the Intersection point a

• Drawing arcs using the arc tool Update:11-30

The arc tool draws 90 degree arcs by default. How can I draw an arc with a different angle, say 45 degrees? Or, how can I adjust the angle of an arc?CombinatoristAZ, Depending on the exact goal, you may do it with the normal tools or a free script. I

• Isolating/manipulating joined arcs in Flash Update:11-30

In illustrator when using the pen tool and drawing arcs/curves, you may connect a series of curves and manipulate individual curves without affecting the ajdoining curve. I accomplish this by drawing curve #1 , selecting the end anchor point of that