# 3D Math Primer for Graphic and Game Development problem with Upright Space

In the book in Chapter 3 he mentions Upright Space. I understood everything so far and I did every exercise from Chapter 2 with vectors correctly. But I cannot understand how did he get Upright Space unit vectors for x and y axis. Can someone help me here please?

The origin of his object in world space is (4.5, 1.5) . .What I dont understand is how did he obtain these two vectors: x axis unit vector is (0.87, 0.50) and y: (−0.50, 0.87) . Can someone give me step by step solution please?

3.3.2 Specifying Coordinate Spaces We are almost ready to talk about transformations. But there’s actually one more basic question we should answer first: exactly how do we specify a coordinate space relative to another coordinate space?7 Recall from Section 1.2.2 that a coordinate system is defined by its origin and axes. The origin defines the position of the coordinate space, and the axes describe its orientation. (Actually, the axes can describe other information, such as scale and skew. For the moment, we assume that the axes are perpendicular and the units used by the axes are the same as the units used by the parent coordinate space.) So if we can find a way to describe the origin and the axes, then we have fully documented the coordinate space. Specifying the position of the coordinate space is straightforward. All we have to do is describe the location of the origin. We do this just like we do for any other point. Of course, we must express this point relative to the parent coordinate space, not the local child space. The origin of the child space, by definition, is always (0, 0, 0) when expressed in child coordinate space. For example, consider the position of the 2D robot in Figure 3.2. To establish a scale for the diagram, let’s say the robot is around 5 1/2 feet tall. Then the world-space coordinates of her origin are close to (4.5, 1.5). Specifying the orientation of a coordinate space in 3D is only slightly more complicated. The axes are vectors (directions), and can be specified like any other direction vector. Going back to our robot example, we could describe her orientation by telling what directions the green vectors labeled +x and +y were pointing—these are the axes of the robot’s object space. (Actually, we would use vectors with unit length. The axes in the diagrams were drawn as large as possible, but, as we see in just a moment, unit vectors are usually used to describe the axes.) Just as with position, we do not use the object space itself to describe the object-space axis directions, since those coordinates are [1, 0] and [0, 1] by definition. Instead, the coordinates are specified in upright space. In this example, unit vectors in the +x and +y object-space directions have upright-space coordinates of [0.87, 0.50] and [−0.50, 0.87], respectively. What we have just described is one way to specify the orientation of a coordinate space, but there are others. For example, in 2D, rather than listing two 2D vectors, we could give a single angle. (The robot’s object axes are rotated clockwise 30o relative to the upright axes.) In 3D, describing orientation is considerably more complicated, and in fact we have devoted all of Chapter 8 to the subject. We specify a coordinate space by describing its origin and axes. The origin is a point that defines the position of the space and can be described just like any other point. The axes are vectors and describe the orientation of the space (and possibly other information such as scale), and the usual tools for describing vectors can be used. The coordinates we use to measure the origin and axes must be relative to some other coordinate space.

EXERCISE AT THE END I KNOW FROM A TO E AFTER THAT NO IDEA:

Assume that the robot is at the position (1, 10, 3), and her right, up, and forward vectors expressed in upright space are [0.866, 0,−0.500], [0, 1, 0], and [0.500, 0, 0.866], respectively. (Note that these vectors form an orthonormal basis.) The following points are expressed in object space. Calculate the coordinates for these points in upright and world space. (a) (−1, 2, 0)

(b) (1, 2, 0)

(c) (0, 0, 0)

(d) (1, 5, 0.5)

(e) (0, 5, 10)

The coordinates below are in world space. Transform these coordinates from world space to upright space and object space.

(f) (1, 10, 3)

(g) (0, 0, 0)

(h) (2.732, 10, 2.000)

(i) (2, 11, 4)

(j) (1, 20, 3)

• A solution to what? Please read How To Ask A Good Question and update yours accordingly. – amd Dec 1 '18 at 0:12
• Upright Space is simply the world space with a translated origin. The coordinate axis directions are the same in both. – amd Dec 1 '18 at 0:13
• Ah sorry yeah I updated I just want to know how did he get those two vectors.. I tried to convert 4.5 and 1.5 to unit but it did not gice me values like those... – GoldSpark Dec 1 '18 at 0:53
• Of course not. The world-space coordinates of the object in and of themselves don’t tell you anything about the axis directions. In both world space and upright space the unit axis vectors are simply $(1,0)$ and $(0,1)$, so those other vectors are relative to some other coordinate system that you haven’t described here. Once again, without your providing more information in your question, there’s little anyone can do to help you. – amd Dec 1 '18 at 1:15
• Ah okay... I dont know how to give this additional information because that was all. I can quote what he wrote there in that section of the book? – GoldSpark Dec 1 '18 at 1:30

So, relative to both the world and upright spaces, which share the same axis directions, the object space unit $$x$$-vector is $$(\cos(30°),\sin(30°)) = \left(\frac{\sqrt3}2,\frac12\right) \approx (0.87,0.50)$$ and the unit $$y$$-vector is $$(-\sin(30°),\cos(30°)) = \left(-\frac12,\frac{\sqrt3}2\right) \approx (-0.50,0.87).$$ (I’ve inferred that in this text positive angles represent clockwise rotations.) I expect that you’ll be able to find a detailed explanation if you need one of why these are the vectors that result from a 30-degree rotation of the coordinate axes back in Chapter 2.