trig and angles in the computer world?

BlitzMax Forums/BlitzMax Beginners Area/trig and angles in the computer world?

I have a line drawn at the bottom of my screen,I shoot a canon ball from the right side.When it hits the bottom screen,I want it to bounce.My problem is the angles.What is the angle if the ball is dropped straight down?How about 45 degrees in the real world,what is it in our world?I've done the tan2 demos but the angles are neg,and can't seem to relate it to the real world.

Thanks,
mudcat

If you are moving your cannon ball with just x and y acceleration then you just negate the y acceleration:

yacceleration = -yacceleration

If you are moving your cannon ball with an angle and speed then to get the bounce:

angle = ( 90 - angle ) + 90

Hope I understood you correctly.

Something like this?


Example

* Move MOUSE to change distance/height
* LMB/RMB changes cannonball speed
' Cannonball - DISTANCE / HEIGHT

Const sw%=720,sh%=500

AppTitle="Cannonball path"
Graphics sw,sh,0
SetClsColor 200,210,210

MoveMouse sw/12*9,sh/9*2

Global startX% , startY%
Global height# , distance# , speed#=1.5

While Not KeyHit(KEY_ESCAPE)
	Cls
	Local mx#=MouseX() , my#=MouseY()
	startX=10 ; startY=sh-70

	' adjust distance/height with mouse
	distance#=(mx-startX)
	height#=(my-startY)
	If height>-1 height=-1
	
	' change speed with LMB/RMB
	If MouseDown(1) speed:+0.009
	If MouseDown(2) And speed>1.5 Then speed:-0.009
	
	' draw base/height lines
	SetColor 90,90,90
	DrawLine startX,startY,startX+distance,startY
	DrawLine startX,startY+height,startX+distance,startY+height
	
	' draw arc
	SetColor 10,90,150
	Repeat
		Local d%=0
		Repeat
			Local x%=startX+((distance/180)*d)
			Local y%=startY+Sin(d)*height
			DrawOval x-2,y-2,4,4
			d:+speed
		Until d>180
		startX=x ; startY=y ; height=height*0.65 ; distance=distance*0.7
	Until height>-1

	' stats
	SetColor 90,20,0
	DrawText "Dist="+distance+"   Height="+height+0.0+"   Speed="+speed , 10,10
	DrawText "Mouse X   = change DISTANCE     Mouse Y   = change HEIGHT" , sw/8,sh-36
	
	Flip False
Wend

End


Function Dist!(x1!, y1!, x2!, y2!)
  Local xd! = Abs(x1-x2) , yd! = Abs(y1-y2)
  Return Sqr(xd*xd+yd*yd)
End Function

Function Dist3D!(x1!,y1!,z1!,x2!,y2!,z2!)
	Local width!=x1-x2 , height!=y1-y2 , depth!=z1-z2
	Return Sqr(width^2+depth^2+height^2)
End Function

Function Angle!(x1!,y1!,x2!,y2!)
	Return 180!-(ATan2(x2-x1,y2-y1))
End Function