[C#] Vector Calculator

Zer0-One

Experienced Member
Messages
2,231
Reaction score
256
Vector Calculator

i've been trying to program a vector calculator, and no matter what i do, my program always returns the wrong answer. lets start with the simple stuff. how do i get C# to break a vector down to its x and y components? ive tried everything, please help.

i'd post code, but ive changed it and double checked it 1000 times, so there's really no point.
 

GoldBl4d3

VIP
VIP
Retired
Messages
3,778
Reaction score
1,434
Re: Vector Calculator

what kind of vector

Vector2, Vector3, Vector4
 

Zer0-One

Experienced Member
Messages
2,231
Reaction score
256
Re: Vector Calculator

im doing it without using any vector class.
 

Zer0-One

Experienced Member
Messages
2,231
Reaction score
256
Re: Vector Calculator

hm. you used the vector2d class. im doing it without that class.
 

GoldBl4d3

VIP
VIP
Retired
Messages
3,778
Reaction score
1,434
Re: Vector Calculator

lol, i made the vector2 class. The best way is to go with a class like i did. I made that one. But if you cant for some reason you need to tell us.

Start by telling us why you cant use a class.
 

Zer0-One

Experienced Member
Messages
2,231
Reaction score
256
Re: Vector Calculator

ok, i just need to take a vector, and find it's x and y components. this stuff involves trig functions which i didn't see in your app.

and if it helps, im not using the Vector2 class because not only does it not help me, but my teacher told me he wants to see it done without classes that i didn't make myself.
 

GoldBl4d3

VIP
VIP
Retired
Messages
3,778
Reaction score
1,434
Re: Vector Calculator

DMK06 said:
ok, i just need to take a vector, and find it's x and y components. this stuff involves trig functions which i didn't see in your app.

and if it helps, im not using the Vector2 class because not only does it not help me, but my teacher told me he wants to see it done without classes that i didn't make myself.
Im confused, are you talking about XNA?
 

dschu012

Enthusiast
Messages
762
Reaction score
380
Re: Vector Calculator

So you have an angle and a length right? Where
X = length * cos(degree)
Y = length * sin(degree)
?
Is that what your trying to do?
 

Zer0-One

Experienced Member
Messages
2,231
Reaction score
256
Re: Vector Calculator

dschu012 said:
So you have an angle and a length right? Where
X = length * cos(degree)
Y = length * sin(degree)
?
Is that what your trying to do?

exactly, but it always gives me the wrong answer.
 

Zer0-One

Experienced Member
Messages
2,231
Reaction score
256
Re: Vector Calculator

oh man... this is embarrassing.. i just realized i was making the stupidest simple mistake.. lol. i'm not even gonna tell you what it was, but thanks for the help.
 
Top Bottom