The last issues of chapter 1 are going to handle Point Arithmetic (not
pointer arithmetic! that's something completely different). Thanks to the
place vectors we introduced last week, it becomes quite easy to work with
points in your software: you simply do all calculations on the place vectors,
the result is a new place vector which represents your resulting point. But then you ask: "If you simply do the point arithmetic on the place *vectors*, then why bother about *point* arithmetic? Isn't it the same as vector arithmetic?" Yes and No. You indeed *use* vector arithmetic to perform your point arithmetic, but there's one major problem: the influence of the origin! The real world doesn't have an origin (like we discussed last week), but your model - that uses place vectors - does! So, if you want your model to be a good representation of reality, you have to make sure that it works independent of it. This is becoming quite confusing. Maybe an example will help... |
Take 2 points P and Q in the real world. OK, you have them? Now add those
points P and Q together. What is P + Q? Can you figure it out? No, probably
not. Why? It's hard to explain, but this sum seems to mean nothing.
![]() ![]() ![]() Then, what *can* we do with points? Well, ... |
The first thing that we're going to examine is the addition of a free vector
to a point. How can it be defined and interpreted? Definition: The addition of a point P and a free vector V results back in a point (P + V). That point (P + V) is given by the ending point of the representative of V in P. Wow! Let's say this i.e.: take that free vector V, put it with its tail in the point P, and your resulting point will be the head of vector V. ![]() ![]() Also, let us assume that the component values of vector V (the one we want to add to P) are V(v1, v2, v3). Now, to add V to P, you simply add all component values together: P(p1, p2, p3) + V(v1, v2, v3) = (P + V)(p1+v1, p2+v2, p3+v3). ![]() interpretation: You can see all this as moving a point P in a certain direction and sense, and over a certain distance to a "new" point (P + V). That's why it's called a translation: you translate P to (P + V). The vector V is the "prescription" of this translation: you move P v1 units in the x-direction, v2 units in the y- and v3 units in the z-direction. So, if you need to move one or more points in a certain direction, you simply construct a free vector that prescribes this translation, and you add this vector to all points needed to be moved. An example: we want to move points P(1,2,3) and Q(2,4,0) 3 units along the z-axis. Maybe because it are 2 little spaceships traveling with the same speed in that direction. So, we prepare a vector V that contains this translation: V(0,0,3). And now, we apply this vector on P and Q: P + V = (P+V)(1,2,6) and Q + V = (Q+V)(2,4,3). ![]() What you have to do, is to translate ALL points (including the camera) in the *same* way, so that the relative position of all points remain the same, and the camera is in the origin. What translation do we need? If you look at the picture, you can see that you need to translate all points over –OC. If you do that, you will see that the camera will be back in the origin, and that the relative position of all points will remain the same. ![]() |
This is very analogue with the previous one. Watch it!
![]() This is all very logic. Why? If you shuffle the symbols a little bit (move P to the right side), then you can rewrite this as: Q = P + V, or P + V = Q. Do you see the similarity with paragraph (ii)? An addition of a point P and a free vector V that results in a point Q. I always use this "shuffling" to know the sense of the vector (Q – P). Does the vector point from P to Q, or from Q to P? It's easier to solve this problem if you rewrite is as P + ... = Q. Now, it's easy to see that you have to fill in a vector that points from P to Q How to put this in your computer? As with the addition, you simply replace all points by their place vectors. In this way you actually make the difference of 2 place vectors instead of 2 points: V = OQ – OP. And of course, you get a vector as result then ... Check out issue 02 paragraph (iv) to convince yourself this has the same result. Also, try using another origin with the same points. You will see that the result is independent of the origin! Which is of course *very* important :) ![]() Q(q1,q2,q3) – P(p1,p2,p3) = PQ(q1–p1, q2–p2, q3–p3) An example: We have 2 points P(1,2,3) and Q(2,4,0), the same ones of last example. Now, we want to find the vector V inbetween P and Q (maybe we want to translate P to Q ...). So, what we do is to subtract P from Q: V = Q – P = V(2–1, 4–2, 0–3) = V(1,2,–3). ![]() REMEMBER: If you make the difference of 2 points, you get the free vector in between. Next week we're going to add 1 more operation with points: barycentric combinations. It's a way to extract out of n original points P[0], P[1], ... , P[n-1], a resulting point Q in a way independent on the origin. ![]() I wanted to add this here but it would take up too much space, so you will get it next week. Then, you will know the 3 operations you can do with points: point + vector, point – point, barycentric combinations. It doesn't seem like much, but it really covers all operations you will need. OK, I will see you next week for the barycentric combinations. Regards, the Bramz "He never is alone that is accompanied with noble thoughts." - Fletcher |