Advertisement

Understanding cross product without delving too much on Linear algebra

Started by January 15, 2016 03:50 PM
9 comments, last by LetsDoThis 8 years, 11 months ago

In this tutorial on Exploding Objects topics. The author talks about getting the normal vector using two vectors parallel to the surface of triangle. I just have few questions regarding this. Though I know I am not that good at math. I believe understanding this or just a little on how it works will help me a lot when dealing with 3D.

First of the author said something like this

If we were to retrieve two vectors a and b that are parallel to the surface of the triangle we can retrieve the normal vector by doing a cross product on those vectors

But then what is a surface? Googling it, I think it is just the whole area of a triangle. But then he said "parallel" to the surface. that means this surface has a direction? If I understand parallel vectors. it is a vector that have the same direction. So if we are talking about 2D triangle, at what direction does the surface of the triangle is pointing to? Is this a correct visualization

image.jpg

Second is about plane

The author said something like this

Subtracting two vectors from each other results in a vector that is the difference of the two vectors and since all 3 points lie on the triangle plane, subtracting any of its vectors from each other results in a vector parallel to the plane.

If I am right plane is is about flat shapes. I also going to ask this. if it is flat shape, where is it pointing to?

Is the plane and surface the same here?

thanks

ooookkkkkaaaayyy

In this context, the surface and the plane is almost the same thing.

The mathematical definition of parallel is that they never intersect, even if extended to infinity.

This means there is an infinite number of vectors that are parallel to a plane, so all three of the edges of a triangle are parallel to the plane of the triangle. (this is usually the vectors you use when calculating the normal to a triangle)

In math, a plane is a flat surface without thickness that extend into infinity.

The plane of the triangle is the plane that goes through all three vertices of the triangle.

And the surface of a triangle, is the part of that plane, which is enclosed by the three edges that make up the triangle.

So almost the same thing :)

Advertisement


This means there is an infinite number of vectors that are parallel to a plane, so all three of the edges of a triangle are parallel to the plane of the triangle.

Still confuse about this. so that means this plane is also the surface? That means in 2D, this plane is facing up or facing to any direction? But let say if the plane is pointing up, does that mean the vertices as well?

ooookkkkkaaaayyy


This means there is an infinite number of vectors that are parallel to a plane, so all three of the edges of a triangle are parallel to the plane of the triangle.

Still confuse about this. so that means this plane is also the surface? That means in 2D, this plane is facing up or facing to any direction? But let say if the plane is pointing up, does that mean the vertices as well?

A plane does not have any vertices at all - a plane is just either a point + a unit vector or the plane is defined as a unit vector and some signed distance (scalar) to the origin. And in 2D a plane is just a line with infinite width.

Try to imagine just a point in some world and some arrow from the point to a specific direction - Thats the easiest way to understand the concept behind it.

For a triangle in 3D, vertices can be seen as planes as well. Each 3D Vertex in world space can also be defined as a unit normal with a distance to the origin. Each vertex may have its own normal overriden, so each point can face in a different direction - this is important when you want some smoothness for lightning as a example.

Given a plane, pick two unique points that lie on the plane. Imagine a vector that starts at one point and points towards the other. That is what the author means by a vector parallel to the surface of the plane. A triangle has three unique points on a plane. So staring at one of the points on the triangle and creating a vector towards each of the remaining two points gives two unique vectors that are each parallel to the plane. Doing the cross product on these two vectors results in a vector perpendicular to the plane. You could pick any three points on the plane, it is just convenient that a triangle comes with exactly what you need.
My current game project Platform RPG

Unfortunately you haven't labelled your diagram. Labelling would make it easier to explain/understand. So I'd help you label the triangle

Lets make the top tip point A, Bottom left B and Bottom right C

Before answering your specific questions - some brief basics, this will help you to understand your specific questions.

To get a vector you subtract 2 points , say B - A . that is A -> B. we call this VectorAB (The direction of this vector is A to B)

Likewise C - A that is A -> C we call this VectorAC (The direction of this vector is A to C)

These vectors are on the surface of the triangle because the points A, B, and C that make up the vectors are on the surface of the triangle.

That we chose A, B, C is just a matter of convenience, because (i assume) we know the coordinate A(x,y), B(x,y) and C(x,y)

We could well have chosen any 3 points on the triangle's surface whose (x,y) coordinates are known

You say you don't want to get into the algebra, so then the short non-algebraic explanation is

VectorAB X VectorAC yeilds a vector perpendicular to the surface of triangle ABC, lets call this perpendicular vector VectorN ( X here stands for crossproduct )

Answer to question 1. Since we are talking directions here, this same normal would be true for any surface parallel to surface of the triangle ABC. Hence the author used the term "parallel" in explaining, but this is simply not a helpful way to describe to someone learning the concept.

Answer to question 2. Plane and surface is the same (Edit: surface is plane without the edges).

The normal is what gives the plane (surface) a direction. The NORMAL VectorN is the direction of the surface of triangle ABC

Edit: Normalization might be required, but not getting into that since you don't want the complicated/algebraic stuff

can't help being grumpy...

Just need to let some steam out, so my head doesn't explode...

Advertisement

My take on the questions:

First, 2D and 3D are different dimensionality. If you are making the shift from 3D to 2D, some of the concepts shift as well. Just like a cube becomes a square and a sphere becomes a circle, normals change from being vectors in 3D to being vectors in 2D.

Also, possibly contributing to the confusion is that vectors don't have a a position. A vector is just a direction, and a vector can be placed anywhere.

In 3D the normal is perpendicular to a 3D surface. A 3D surface is a plane. So if you have a plane like a flat desk, then you stand a pen on end so it points in the air at a right angle to the surface, that pen is pointing the direction of a the plane or surface normal.

In 2D the normal is perpendicular to a 2D surface. A 2D surface is a line segment or a curve. So if you have a line segment, then you draw a right angle to the line segment, that right angle is the direction of the surface normal.

First of the author said something like this

If we were to retrieve two vectors a and b that are parallel to the surface of the triangle we can retrieve the normal vector by doing a cross product on those vectors

But then what is a surface? Googling it, I think it is just the whole area of a triangle. But then he said "parallel" to the surface. that means this surface has a direction? If I understand parallel vectors. it is a vector that have the same direction. So if we are talking about 2D triangle, at what direction does the surface of the triangle is pointing to? Is this a correct visualization
image.jpg

A normal vector is a vector that is perpendicular to an object at a place. A vector only has a direction, not a location.

In 2D, a normal vector is perpendicular to a single line or curve. So if you imagine a curve, you've got a tangent line that is parallel to the curve at that point, and a normal line that is perpendicular at that point on the curve. The normal and tangent lines form a "T" shape if you put them along that point.

At the top and bottom of a sine curve, the normal vector would point straight up or straight down.

At any point in a circle, the normal vector would extend out from the center of the circle through that point, like rays from the sun.

In 3D, the normal vector to a surface is a vector that points directly away from that surface. So if you have a flat desk in front of you, the surface normal points up.

It does not matter if the shape is a triangle or rectangle or hexagon, the surface normal is perpendicular to the surface, pointing up from the surface.

If you have a ball, the surface normal at any point would be like a spiky outward direction.

When they wrote that the vectors were parallel to the plane, it just means they would be flat. It is the direction of the 'flat' at that point relative to the surface or plane. Like an arrow pointing along the edge of a desk, and another different arrow pointing along another edge of the desk. The top of the desk is essentially a plane at that point, and those vectors (that have a direction but do not have a position) would point directly along it.

Second is about plane
The author said something like this

Subtracting two vectors from each other results in a vector that is the difference of the two vectors and since all 3 points lie on the triangle plane, subtracting any of its vectors from each other results in a vector parallel to the plane.


If I am right plane is is about flat shapes. I also going to ask this. if it is flat shape, where is it pointing to?
Is the plane and surface the same here?

thanks

What he describes there is finding two vectors (direction without a position) that is the same direction as two legs of the triangle.

If you are working in 2D then you need to reduce the dimensionality by one. Instead of computing the normal of a 3D object with two vectors, you would need to compute the normal of a 2D curve or line segment.

The normal of a line is similar to a tangent of a line. The normal is perpendicular at that point, the tangent is parallel at that point. The normal points exactly 'away' at that point of the curve, the tangent points exactly 'flat' at that point in the curve.

If you are working with those two vectors you will get a 3D normal. The normal of two legs of a triangle is a direction that points out from the surface of the triangle; drawn on a paper the normal points up out of the paper in 3D. If you want to work in 2D you would find the normal to a single line segment or curve.

This means there is an infinite number of vectors that are parallel to a plane, so all three of the edges of a triangle are parallel to the plane of the triangle.

Still confuse about this. so that means this plane is also the surface? That means in 2D, this plane is facing up or facing to any direction? But let say if the plane is pointing up, does that mean the vertices as well?

No, because you are working in 2D rather than 3D.

Again, vectors are a direction without a position so there are are infinitely many of them. Anywhere in the mathematical universe the vector will remain constant if it has the same direction.

In this case, the vectors point along the direction of the triangle's three legs. If you have a triangle with three points ABC, you can make one vector that points from A to B, one points from B to C, and a third that points from A to C. If you go the other direction, you can have vectors that go B to A, C to B, and C to A.

Since by definition a triangle lies on a single 3D plane, that also means by definition you can use two vectors to define a 3D plane's orientation. It won't find the plane's position because vectors can be anywhere, but it will tell you how the plane is oriented. The normal is perpendicular to that plane.

In 2D you would have a single line or a single line segment rather than a triangle. The normal to that line segment is a perpendicular line, meaning a line that is at a right angle to the line segment.

I guess some pictures are in order.

Here are some 3D normals, blatantly stolen from the Wikipedia article on the topic. In both images the blue lines are the normal vectors. They are always perpendicular to the object at that location.

431px-Surface_normal_illustration.svg.pn
Surface_normal.png

And for 2D, they are still perpendicular to the object. The objects are just 2D objects rather than 3D objects.

A to B is the line segment, The vector O to X is the normal:

90_right_angle.png



E to P is the normal. At point E, both the line CD and the curve AB have the same normal.


TANGENT_straight_line_curve_line.jpg

All the spokes in a wheel are normal to the curve of the wheel.

bicycle-wheel-spokes.gif

For this curve, the blue lines are normals which are perpendicular to that point, the red lines are tangets which are parallel to that pont:

line_1.jpg

Another way of looking at it, is imagine yourself as the normal. On Earth as you walk around upright you are essentially the normal at that point on Earth because you are perpendicular to that point of the planet.

But imagine you are an astronaut and you are in zero G environment, say on the outside of some space station. Your boots let you stick to the outside so you can walk around it. If you imagine yourself trying to walk around the space station 'upright' then your orientation will be the same as the normal at that point on the space station. Doesn't matter what shape the space station is, you can be upright at any point on it provided you can stick to it.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

I you have Firefox (won't work in Chrome because no NPAPI) and the Java plugin (and most security stuff disabled), you can run the interactive demo:

http://www.mwit.ac.th/~physicslab/applet_02/part1/chapter03vectors/07-crossproduct/crosspro.html

IMHO that's the best tutorial I ever found on cross products.

This topic is closed to new replies.

Advertisement