It seems that you could get the rotation of the diagonal and copy the defined vectors, rotating them 180 deg. about the x or y axis of the center of the diagonal line. But, I haven't been able to find the key here
Thanks!These forums are CLOSED. Please visit the new forums HERE
Vector magic... |
|
|
BlueWall Slade
Registered User
Join date: 6 Jul 2007
Posts: 5
|
01-15-2008 17:20
Is it possible to discover the vectors for all eight corners of a box by defining two diagonal vectors (right-front-lower corner <---> left-rear-upper corner) ?
It seems that you could get the rotation of the diagonal and copy the defined vectors, rotating them 180 deg. about the x or y axis of the center of the diagonal line. But, I haven't been able to find the key here Thanks! |
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
01-15-2008 17:36
You might check:
http://rpgstats.com/wiki/index.php?title=LlGetBoundingBox And then you could do simple adds and subtracts of the vector elements to get all the vertices. |
|
BlueWall Slade
Registered User
Join date: 6 Jul 2007
Posts: 5
|
RE: Vector Magic...
01-15-2008 18:18
Yeah, that's what got me thinking about doing this, but that is restricted to the size of a prim, or linked set. So, I can't use that because the area could be fairly large. Also, the adding/subtracting only works if the area is aligned directly with world coordinates. if it is rotated at all, it doesn't work.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-15-2008 18:53
The minimum amount of information you need to fully specify the vertices of a rectangular prism ("box"
are: position (3 degrees of freedom), rotation (3 degrees of freedom), and size (3 degrees of freedom). So in all you need 12 numbers to fully specify the corners. Two 3-component vectors can only specify 6 of them.EDIT: 3+3+3=9, not 12. Be nice if I could count. Blah! ![]() I would suggest, as perhaps the easiest way of keeping track of the corners, the vector location of one corner, a rotation to specify the orientation of the edges, and a third vector for the scale (just a convenient storage mechanism; though you could also think of it as storing the relative offset of the "opposite corner" in the reference frame specified by the rotation). CODE
(Note that these values correspond to the basic position and size information available through the LSL library, too: llGetPos(), llGetRot(), and llGetScale(). You COULD store the position of the center of the shape rather than one corner, which would match more closely the definition of llGetPos(). Same amount of information though.) |
|
BlueWall Slade
Registered User
Join date: 6 Jul 2007
Posts: 5
|
Re: Vector Magic...
01-15-2008 19:36
Yeah, that makes sense. I'm hoping to figure out a way to derive the orientation from the diagonal between the opposite corners. I will try using some of the info you presented to work toward that in the a.m.
tnx! |
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-15-2008 22:10
Unfortunately orientation can't quite be nailed down that way. Take a rubix cube, put forefingers on opposite corners, hold it steady, and spin it around the line between your fingers using your thumbs. There's just that one degree of rotational freedom not quite covered by the diagonal. With one MORE of the prism's diagonals you can pin down orientation, though scale isn't fully specified unless an assumption is made about its dimensions (like it being a cube rather than a general rectangular prism).
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
01-15-2008 22:27
I'm hoping to figure out a way to derive the orientation from the diagonal between the opposite corners. |
|
BlueWall Slade
Registered User
Join date: 6 Jul 2007
Posts: 5
|
Re: Vector Magic...
01-16-2008 03:45
OK, I see! Ha, this vector/rotation stuff is killing me anyway
But, I see now that i need more input to nail down the direction of everything. Thanks for the enlightenment! |