3D Vector Modeling - University of Michigan

3D Vector Modeling
Tim Elliott
Faculty sponsor: Mehrdad Simkani
University of Michigan-Flint
In Linear Algebra, we typically think of Vectors as 1-dimensional objects, having both a
direction and a magnitude. For vectors in Second Life to model mathematical vectors, there are
so many design and modeling considerations, such as what kind of primitives should be used to
model a vector and how many of them should be considered. Primitives in Second Life are
simple 3D shapes used as the basic building boxes for all objects. There are 8 types of primitives:
the Box, the Cylinder, the Prism, the Sphere, the Torus, the Tube, the Ring, and the Sculpted
Prim. We consider two vector models derived from a sphere: Dimple E 0.500 and Spherical
Vector Model Path Cut E 0.500. Both vector models have been inspired by the antipodal nature
of circles and spheres, which is the reason why their diameters are twice their radii. Check out
this website about antipodes (https://en.wikipedia.org/wiki/Antipodal_point)
We begin building in Second Life by opening the Build Tools Window and select the sphere icon
if it’s not already green—it is selected when it is green.
Figure 1
Figure 2
After we select the sphere and move our cursor outside the Build Tools Window to the ground or
the floor, it turns into a magic wand and then we are ready to create a sphere. We click the
mouse on the spot where we want to create the sphere.
2
Any nonzero vector can be written in terms of its magnitude and the unit vector that is pointing
in the same direction. Therefore, that unit vector represents its direction. The vector-magnitudedirection equation is
→
‖ ‖
‖ ‖
→
We can manipulate a primitive‘s modeling parameters and encode vector’s magnitude and
direction, which it is representing in terms of its modeling parameters. Specifically, the vector’s
magnitude is half of one of the vector model’s 3 dimensions, and the unit vector is represented
by the Zero Rotation Vector (ZRV) times the vector model’s rotation. The vector model’s
dimension that changes with the vector‘s magnitude that is being modeled is called the Active
Dimension.
The Antipodal Nature of our Vector Models is Hidden
‖ ‖
√
If →
〈
‖ ‖
〉 then
If →
〈
〉 then
If →
〈
〉 then
√
Our vector models are inspired by the antipodal nature of circles and spheres, like the Dimple E
0.500, the Spherical Vector Model Path Cut E 0.500, and also the Slice B 0.500 Vector Model.
Even though, the Slice B 0.500 Vector Model isn’t derived from a sphere, it has an antipodal line
3
segment in disguise like the Dimple E 0.500, the Spherical Vector Model Path Cut E 0.500. So
their antipodal nature is hidden. If you have a vector model with its tail at the center of a sphere,
the vector head would be a point on the surface of the sphere. Let the radius of the sphere be r
and be equal to the magnitude of the vector:
‖ ‖
√
The diameter is twice the magnitude of the vector, which is the same as the active dimension.
Let
‖ ‖
√
So the vector model’s active dimension changes as the vector’s magnitude changes. That’s why
we call it “Active Dimension.”
One may ask why we put so much emphasis on the hidden antipodal nature of the vector
model. The vector’s tail is the point where the vector rotates and scales from. Since primitives
in Second Life like our vector models to rotate and scale from their geometric centers, the vector
model’s tail needs to be in the primitive’s geometric center. We think of a primitive being
surrounded by a transparent rectangular prism that has 3 dimensions: x, y, and z. The
corresponding dimensions are aligned to the corresponding regional axes x, y, and z, when the
primitive has a zero inherent or implied rotation. A zero inherent rotation is a rotation when a
primitive is rotated by zero degree around every regional axis: x, y, and z. Second Life is made
of regions, and each region is a 256 meter by 256 meter square. More information about regions,
can be found at: http://lslwiki.net/lslwiki/wakka.php?wakka=simulator
4
A region’s x-axis goes from west to east and a region’s y-axis goes from south to north. The
most southwestern point in each region is (0, 0). Of course, the region’s z-axis goes from down
to up. A region’s x-axis is color-coded red, a region’s y-axis is color-coded green, and a region’s
z-axis is color-coded blue. The increasing end of the x-axis points to the east (to the right), the
increasing end of the y-axis points to the north (into the screen), and the increasing end of the zaxis points up. The picture directly below is a sphere in Second Life being edited with its
position handles, which are used to change its position. Each position handler is always parallel
to its corresponding axis—it is color-coded as such, and each position handle points towards the
increasing (positive) direction along its corresponding axis. In Figure 1-1, the sphere’s rotation is
set to zero, which means that the angle around all 3 axes is zero, as we see in Figure 1-1. The
sphere is rotated 90 degrees around the y-axis, as seen in Figure 1-2. The editing window has the
3 rotation fields, and the y-axis rotation is set to 90 degrees. So, the x dimension is aligned with
the z-axis, and the z dimension is aligned with the x-axis. In Figure 1-3, the sphere has a zero
rotation, so all of its dimensions are aligned with their corresponding axes. To make the Path
Cut E 0.500 Vector Model, first we resize by changing its x and y dimensions from 0.5 meter to
0.1 meter. We change its z dimension from 0.5 meter to 2.0 meters. The editing window has 3
size fields, one for each dimension. The editing window has 2 Path Cut fields: The Path Cut B
(Begin) field and the Path Cut E (End) field. We set the Path Cut E to 0.500. This renders the
bottom half of its z dimension invisible and its z dimension is the vector model’s active
dimension, so half of its z dimension represents the vector’s magnitude that the vector model
represents.
5
Figure 1-1
Figure 1-2
6
Figure 1-3
Figure 1-4
7
Figure 1-5
The Notion of a Zero Rotation Vector Makes Inherent Rotations Possible
The Vector Model in Figure 1-5 , the Path Cut E 0.500 Vector Model has an active
dimension of 2 meters and a magnitude of 1meter. So it represents a unit vector. Also, it points
up and it has Inherent Rotation of Zero. Therefore, it represents the vector k <0, 0, 1> and since
its inherent rotation is zero, it has a zero rotation vector (ZRV) of k <0, 0, 1>. That means it can
be thought as always starting from vector k <0, 0, 1> when rotating to the desired vector. For
example, in order for the Path Cut E 0.500 Vector Model to represent the vector i <1, 0, 0>, it
needs 90 degrees or
around the y-Axis. To calculate this, we take the arccosine of the
dot product of vectors k <0, 0, 1> and i <1, 0, 0> to get the angle of rotation, and then take the
cross product of k <0, 0, 1> and i <1, 0, 0> to get the axis of rotation. Let
→ = the axis of rotation.
8
(
)
→
〈
〉
〈
〉
〈
〉
The direction of a vector can be represented by the unit vector which points in the same direction
as the original vector. So a vector can be viewed as the product of its magnitude and the unit
vector which helps to represent the direction. A vector’s direction comes from rotating the Zero
Rotation Vector (ZRV) a specific angle around a given axis to the unit vector specified.
When
we create a primitive in Second Life it has an initial orientation (a zero rotation). When a
rectangular prism has a zero rotation then its corresponding dimensions, Size.X(Length),
Size.Y(Depth) , and Size.Z(Height ) are parallel to a region’s each corresponding axis, X, Y, and
Z. It might be a good idea to draw a difference between mathematical vectors and the models
that model them. Mathematical vectors don’t have ZRVs, and Zero Rotation Vectors only apply
to the vector models. There is a mathematical concept to perform rotation transformations on
vectors which are in 3D space around any arbitrary axis but for now, we will use
RotationBetween(vector A, vector B) to symbolize the rotation applied to the vector A and
resulting the vector B. This can be written as B = A * RotationBetween(vector A, vector B).
Vectors A and B are unit vectors. Let Z be the Zero Rotation Vector, U1 be the first unit vector to
be rotated to, and U2 be the second unit vector to be rotated to: U1 = Z * RotationBetween (Z,
U1). We can do this with mathematical vectors and their vector models but you can’t do the
following with vector models: U2 = U1 * RotationBetween(U1, U2) even though it can be done
with the Mathematical vectors that they model. To get a vector model to U2, we need to do this:
9
U2 = Z * RotationBetween (Z, U1) * RotationBetween (U1, U2) = Z * RotationBetween (Z,
U2) . Let vector V have magnitude m = sqrt(V2x+ V2y+ V2z). Then we set U = 1/m * V and U
= Z * RotationBetween (Z. U). Therefore V = m * Z * RotationBetween (Z. U). Therefore Z *
RotationBetween (Z. U) gives vector models their direction.
The Vector Modeling Algorithm
After calculating the inherent rotation of the desired vector quantity we proceed with the
following steps:
a.
Input the desired vector quantity.
b.
Calculate the active dimension of the desired vector quantity.
c.
Apply the inherent rotation to the vector model.
d.
Apply the active dimension and other dimensions to the vector model’s size.
e.
Get all Dimensions.
f.
Compute the new vector quantity using the Vector Modeling Equation.
g.
Output the new vector quantity.
The above algorithm converts mathematical vectors into vector models for the Second
Life. It converts the magnitude of a mathematical vector into the vector model’s active
dimension, which is twice the magnitude (a =2m). The direction of any vector can be
represented by the unit vector that points in the same direction as the original vector. In order to
convert the unit vector into a modeling parameter, it needs to be converted into an inherent
rotation. The vector’s inherent rotation is the rotation from the Zero Rotation Vector (ZRV) to
that vector. A ZRV is the vector that a vector model represents when it has a zero rotation.
10
The vector modeling equation V = a/2 * Z * RotationBetween(Z, U) takes a vector
model’s modeling parameters like its active dimension, its zero rotation vector, and its inherent
rotation, and converts them into a vector’s magnitude and a vector’s direction, and then finally to
the mathematical vector itself. Finally, our algorithm converts the vector’s magnitude and
direction back into modeling parameters.
11