Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Vector Math Help (Dividing)

Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
09-19-2008 10:19
heyas;

i have two vectors... x, y, z and a, b, c. i want to mathematically create a vector that is x/a, y/b, z/c.

is it possible to do that with the vectors, or do i have to go in and noodle with the vector.x, vector.y, vector.z directly? i dont see anything in the wiki about dividing vectors.

thanks guys!
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
09-19-2008 11:34
Do you mean a vector like v1 = <x, y, z> and v2 = <a, b, c>? Otherwise, you're going to have to describe what you mean by dividing one vector by another. If it IS what you mean, then your simplest best is probably just going to be:

vector v3 = <v1.x/v2.x, v1.y/v2.y, v1.z/v2.z>;

You're probably going to have to check for zeros though to avoid script errors, so it might be worth some temporary variables.

I'm not sure what you are trying to achieve by this operation. It's not one that has much physical significance. It might be more useful to ask for help with the larger problem you are trying to solve. Good luck!
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
09-25-2008 09:54
heyas;

hewee, i did say that ;) just not all in code!

this is what i was trying to do and works perfectly, thanks! silly me, i wouldn't've though to put the .x/.x etc just in the brackets. i woulda done one at a time. duh.
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
09-25-2008 10:36
Makes me wonder what kind of problem this solves ... unless you're using vectors for something other than their typical uses (e.g., just using them to hold a 3-tuple of floats).
_____________________