|
Siann Beck
Beauty & Braiiiiinsss!
Join date: 14 Jul 2007
Posts: 140
|
10-06-2007 18:35
I'm afraid you lost me. How do I determine > for a vector value? For example, here are a couple of points I've been working with in testing:
vector vecPoint1 = <209.00,59.00,449.00>; vector vecPoint2 = <233.0,40.0,452.0>;
As you can see, X2 > X1, but Y1 > Y2; swapping the points themselves makes no difference.
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
10-06-2007 19:12
The cost of rearranging the coordinates is just as large as testing between.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
10-06-2007 19:22
sorry I should have specified it's per axis... this won't actually change the cube, only how you are representing it.... though I guess this does add a layer of calculation... //-- this doesn't work w/ negative coordinates vector USER_P1; vector USER_P2; vector CUBE_SIZE = USER_P1 - USER_P2; //-- half this to save calculations later gCUBE_SIZE.x = llFabs( CUBE_SIZE.x ); gCUBE_SIZE.y = llFabs( CUBE_SIZE.y ); gCUBE_SIZE.z = llFabs( CUBE_SIZE.z ); vector gCUBE_CENTER = USER_P1 + USER_P2; gCUBE_SIZE.x = CUBE_SIZE.x / 2; gCUBE_SIZE.y = CUBE_SIZE.y / 2; gCUBE_SIZE.z = CUBE_SIZE.z / 2; vector gTEST_POS = //-- point to test vector vTemp = gTEST_POS - gCUBE_CENTER; IS_INSIDE = FALSE; //-- if you halved it above, remove .5* here if ( llFabs( vTemp.x ) < (.5 * gCUBE_SIZE.x){ if ( llFabs( vTemp.x ) < (.5 * gCUBE_SIZE.y){ if ( llFabs( vTemp.x ) < (.5 * gCUBE_SIZE.z){ IS_INSIDE = FALSE; }}} this has a benefit, in that if the user selects the center + size, you don't need to calc them.... or to use the orignal, use a temp var and swap low to origin, high to end.... I really wish there was a way to easily loop operations through vectors, or apply more than +/- across the whol thing but there isn't.... and to be honest this doesn't look like such a neat solution anymore =/
|