Go to Post More later, if anyone's interested and I still have homework to avoid. - Chris is me [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 04-14-2004, 07:24 AM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Angle from X,Y

It was a joke. The prize: Absolutely nothing!

Basically, I'm asking if anyone knows why you would want it on the controller.
  #17   Spotlight this post!  
Unread 04-14-2004, 06:21 PM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Post Atan Function

Here is my Arc Tangent code:
Code:
#define ATAN_COUNT 64
char rom ATAN_ARRAY[64] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 
17, 18, 19, 21, 22, 23, 25, 26, 27, 29, 30, 32, 34, 
36, 37, 39, 41, 43, 46, 48, 50, 53, 56, 59, 62, 66, 
69, 74, 78, 83, 88, 95, 101, 109, 118, 128, 140, 154, 
171, 192, 218, 253, 299, 367, 473, 663, 1106, 3319};

char atan (char Num)
{
	char Index = 0;
	char Value = 0;
	char IsDone = 0;
	
	LOOP:
		if (ATAN_ARRAY[Index] > Num)
			Value--;
		if (ATAN_ARRAY[Index] >= Num)
			IsDone = 255;
		else if (Index >= ATAN_COUNT - 1) //was ATAN_COUNT + 1
		{
			IsDone = 255;
			Value = 64;
		}
		
		if (IsDone)
			goto LOOP_DONE;
		else
		{ Value++; Index++; }
		goto LOOP;
	LOOP_DONE:
	
	return Value;
}
The lookup table is compressed. If I were to use a regular variety than it would be 3320 elements long! Instead, I put the location of the element that the value changes. That's why I loop. I think this will work, but I'm not sure.

[edit]that chould be ATAN_COUNT - 1 not ATAN_COUNT + 1 at line 19[/edit]

Last edited by Astronouth7303 : 04-15-2004 at 07:25 AM.
  #18   Spotlight this post!  
Unread 04-19-2004, 09:58 PM
scottm87 scottm87 is offline
Registered User
AKA: Scott McClure
#0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Nov 2002
Rookie Year: 2000
Location: Bloomfield Hills, MI
Posts: 24
scottm87 is on a distinguished road
Re: Angle from X,Y

hmmm you can also use vectors, and find the angle with the formula (u * v)/(|u||v|) (the dot product of u and v divided by the product of the magnitudes). This is useful if you are already using vectors, which are probably better suited for motion and such anyways.
  #19   Spotlight this post!  
Unread 04-19-2004, 10:08 PM
dtk's Avatar
dtk dtk is offline
Registered User
AKA: Daniel Kimura
None #0469 (Las Guerrillas)
 
Join Date: Mar 2002
Rookie Year: 1998
Location: Oakland County MI
Posts: 22
dtk has much to be proud ofdtk has much to be proud ofdtk has much to be proud ofdtk has much to be proud ofdtk has much to be proud ofdtk has much to be proud ofdtk has much to be proud ofdtk has much to be proud ofdtk has much to be proud ofdtk has much to be proud of
Re: Angle from X,Y

Quote:
Originally Posted by scottm87
hmmm you can also use vectors, and find the angle with the formula (u * v)/(|u||v|) (the dot product of u and v divided by the product of the magnitudes). This is useful if you are already using vectors, which are probably better suited for motion and such anyways.

The result of that equation gives you the cos of the angle between the vectors. That is cos(x). You would still need to use an inverse trig function to find the angle (x).

I'm going to have to go ahead and give you -15 points for that one. o_O

-Daniel
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PBASIC ARCTAN function Greg Ross Programming 14 05-11-2003 12:28 PM
The angle of going up the Ramp David Bryan Programming 2 01-21-2003 08:56 PM
Slotted Angle Aluminum hinge87 OCCRA 1 10-09-2002 06:15 PM
Is an angle bracket allowed? archiver 2001 0 06-24-2002 12:58 AM
45 degree PVC angle fittings: which? archiver 2001 2 06-23-2002 10:53 PM


All times are GMT -5. The time now is 09:06 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi