This topic is 4275 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm currently coding for an hardware without any 3D acceleration nor possibility to utilize such an API. However it was probably 1.5 years ago since I did anything in 3D and now I can't recall the basic 3D mathematics. Quite disturbing actually. First of all I have problems understanding what a Cross and Dot product really calculates. To discover whether a polygon is facing towards the camera or not. I know I should calculate the normal for the polygon but how shall I check that normal with the camera direction? Furthermore it has slipped my mind if I need to sort the vertices on a polygon depending on y-coordinates before I start calculating the edge's slopes and set initial values for the scan conversion to begin from. From my previous work it doesn't seem I have but it could be some kind of optimization I have forgotten about. I really appreciate if someone could help me solve these out and show me how it is done explaining the process as I'm so lost at the moment.

##### Share on other sites
Quote:
 Original post by lordmetroidFirst of all I have problems understanding what a Cross and Dot product really calculates.

What do you mean with "really"?

The cross product
v' := v1 x v2
computes the vector that
(a) is perpendicular to both of the argument vectors
v' . v1 == 0 (see dot product below)
v' . v2 == 0 (see dot product below)
(b) has a length equal to the area of the diamond spanned out by the argument vectors
||v'|| == ||v1|| * ||v2|| * |sin( <v1,v2> )|
(c) with a right handed orientation (i.e. in order v1 thumb, v2 forefinger, v' middle finger of the right hand).

The dot product
s' := v1 . v2
computes the scalar that is equal to
||v1|| * ||v2|| * cos( <v1,v2> )
Assuming that both arguments are not of zero length, then the resulting scalar gives some information about the angle between them:
s' > 0 : the angle is less than 90°
s' < 0 : the angle is greater than 90°
s' == 0 : the angle is exactly 90° (perpendicularity!)
s' == s'max = ||v1|| * ||v2|| : the angle is 0°
s' == s'min = -||v1|| * ||v2|| : the angle is 180°

The absolute value |s'| can be understood as the length with which the one argument vector is projected onto the other argument vector. Or, in other words, its the length of the one argument vector in direction of the other argument vector. This property is often used to find the decomposition of a vector in its parallel and perpendicular parts w.r.t. a reference vector.

Quote:
 Original post by lordmetroidTo discover whether a polygon is facing towards the camera or not. I know I should calculate the normal for the polygon but how shall I check that normal with the camera direction?

See the explanation belonging to the sign of the scalar resulting from the dot product above.

[Edited by - haegarr on November 7, 2006 8:36:03 AM]

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
16
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631776
• Total Posts
3002299
×