|
|
|
3 registered members (AndrewAMD, juanex, Grant),
1,018
guests, and 8
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
if-term problem
#253891
02/27/09 15:02
02/27/09 15:02
|
Joined: Nov 2008
Posts: 354 saeculum II
MPQ
OP
Senior Member
|
OP
Senior Member
Joined: Nov 2008
Posts: 354
saeculum II
|
Hello,
I want to use an if-term where I compare a vector:
how do I do this? I have already tried out: VECTOR* vector1;
if (vector1.x < 1) ...
but it does not work!
new project in early stage...
Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
|
|
|
Re: if-term problem
[Re: DiegoFloor]
#253911
02/27/09 17:28
02/27/09 17:28
|
Joined: Nov 2008
Posts: 354 saeculum II
MPQ
OP
Senior Member
|
OP
Senior Member
Joined: Nov 2008
Posts: 354
saeculum II
|
yeah, I only want to use the x-component of the term
like: if the x-value of the vector is under 10, do sth. (thats waht i want ;))
vec_length is not what i need because I only want to get the x-value of the vector and not the whole xyz-vector
Last edited by MPQ; 02/27/09 17:35.
new project in early stage...
Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
|
|
|
Re: if-term problem
[Re: MPQ]
#253960
02/27/09 23:52
02/27/09 23:52
|
Joined: Aug 2003
Posts: 7,439 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,439
Red Dwarf
|
I'll clarify more:
use vector1[0] instead of vector1.x
"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
|
|
|
Re: if-term problem
[Re: Michael_Schwarz]
#253967
02/28/09 01:02
02/28/09 01:02
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
AND as long as the vector is being correctly declares and initialised, [b]if (vector1.x < 1)[.b] should work fine for just testing the X portion. To clarify the defining, VECTOR* vector1 = { x=0; y=0; z=0; } //if OUTSIDE a function (global variable/vector)
VECTOR vector1; //needs both these lines in this order
vec_zero(vector1); // if inside a function(local variable/vector)
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|
|
|
|