Code archives/Algorithms/2 point Angle difference

This code has been declared by its author to be Public Domain code.

Download source code

2 point Angle difference by Nebula2008
2 points on the screen. The angle difference is returned from the function.
Function volledigehoek#(x1,y1,x2,y2) ; x2 y2 naar
	Local hoek = 0
	Local laagste = 1024
	For i=0 To 360
		x3 = x1+Cos(hoek) * 211
		y3 = y1+Sin(hoek) * 211
		hoek = hoek + 1
		nieuw = Sqr((x3-x2)^2+(y3-y2)^2)
		If nieuw < laagste Then laagste = nieuw : uitgraad = i
	Next
	Return uitgraad
End Function

Comments

Who was John Galt?2008
Don't use this code, it's extremely slow and inaccurate.


Code Archives Forum