What's new

[C#] Vector Calculator

  • Thread starter Zer0-One
  • Start date
  • Views 984
Z

Zer0-One

Experienced Member
Messages
2,178
Reaction score
256
Points
220
Sin$
0
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

GoldBl4d3

VIP
VIP
Retired
Programmer Mythical Veteran Legendary Veteran
Messages
3,785
Reaction score
1,452
Points
600
Sin$
0
Re: Vector Calculator

what kind of vector

Vector2, Vector3, Vector4
 
Z

Zer0-One

Experienced Member
Messages
2,178
Reaction score
256
Points
220
Sin$
0
Re: Vector Calculator

im doing it without using any vector class.
 
Z

Zer0-One

Experienced Member
Messages
2,178
Reaction score
256
Points
220
Sin$
0
Re: Vector Calculator

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

GoldBl4d3

VIP
VIP
Retired
Programmer Mythical Veteran Legendary Veteran
Messages
3,785
Reaction score
1,452
Points
600
Sin$
0
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.
 
Z

Zer0-One

Experienced Member
Messages
2,178
Reaction score
256
Points
220
Sin$
0
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.
 
trtl

trtl

Seasoned Member
Mythical Veteran Forum Addict Legendary Veteran
Messages
5,693
Reaction score
1,478
Points
535
Sin$
7
Re: Vector Calculator

So why not make a class yourself like Gold?
 
GoldBl4d3

GoldBl4d3

VIP
VIP
Retired
Programmer Mythical Veteran Legendary Veteran
Messages
3,785
Reaction score
1,452
Points
600
Sin$
0
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?
 
D

dschu012

Enthusiast
Frame In Gold Seasoned Veteran
Messages
757
Reaction score
380
Points
125
Sin$
0
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?
 
Z

Zer0-One

Experienced Member
Messages
2,178
Reaction score
256
Points
220
Sin$
0
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.
 
D

dschu012

Enthusiast
Frame In Gold Seasoned Veteran
Messages
757
Reaction score
380
Points
125
Sin$
0
Z

Zer0-One

Experienced Member
Messages
2,178
Reaction score
256
Points
220
Sin$
0
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
Login
Register