### Author Topic: [3D Graphic]Normals of a Face  (Read 11604 times)

#### Farabi

• Member
• Posts: 970
• Neuroscience Fans
##### [3D Graphic]Normals of a Face
« on: June 17, 2012, 01:27:08 AM »
If a face rotated, is the normals rotated too? Im trying to determine the Front and Back faces.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

#### dedndave

• Member
• Posts: 8808
• Still using Abacus 2.0
##### Re: [3D Graphic]Normals of a Face
« Reply #1 on: June 17, 2012, 03:24:58 AM »
not sure what you mean by "normals"
but - this is something i'd like to learn about, too

#### KeepingRealBusy

• Member
• Posts: 426
##### Re: [3D Graphic]Normals of a Face
« Reply #2 on: June 17, 2012, 03:52:25 AM »
Farabi,

The normal to a plane is the vector perpendicular to the plane. It think it is also more accurately described as the cross product of the two vectors that are given for describing the plane (its's been a long time). This gives the normal vector a direction which can be used to describe the front or back of the plane (the normal vector starts at the intersection of the plane defining vectors and proceeds outward from the front of the plane (or face)).

Now the question relates to rotation of the plane. It all depends on which vector is chosen for the rotation. You can rotate around the normal vector, in which case the normal vector does not rotate in the sense that it changes any of its values (the point and direction), but can you consider that it rotates like a rifle  bullet?

If you rotate around any other vector such as one of the plane defining vectors or some other vector in the plane or intersecting the plane (or even a vector that is parallel to the plane) then the normal would rotate in the sense that its values would change (the point and direction).

Dave.

#### KeepingRealBusy

• Member
• Posts: 426
##### Re: [3D Graphic]Normals of a Face
« Reply #3 on: June 17, 2012, 04:59:37 AM »
Farabi,

Please remember that I am talking about Analytic Geometry concepts here, I have not dealt with 3D graphics and I know that in 2D graphics you are dealing with the 4th quadrant (y increasing as you go down the screen x increasing as you go right). 3D graphics may have even other differences.

Dave.

#### FORTRANS

• Member
• Posts: 1016
##### Re: [3D Graphic]Normals of a Face
« Reply #4 on: June 17, 2012, 05:54:34 AM »
Hi,

In 3-D graphics, objects can be made from polyhedra.  You
can use two edges of a polyhedron to generate a normal.
If when creating the polyhedra, you maintain a fixed ordrering
of the vertices (clockwise or counter-clockwise) for all
polyhedra, you use the normal to see if the visible side of
the polyhedron is pointing towards the viewer and needs
to be drawn (unless blocked of course).  Thus the normal
is defined in the object's coordinate system and is rotated
when the object is rotated.  (Whether the normal is stored
in the object definition or calculated for each test.)

Regards,

Steve N.

P.S.  Please get the spell checker going again.  Sigh.

SRN

#### KeepingRealBusy

• Member
• Posts: 426
##### Re: [3D Graphic]Normals of a Face
« Reply #5 on: June 17, 2012, 07:38:25 AM »
Steve,

Quote
P.S.  Please get the spell checker going again.  Sigh.

Did I screw up any spellings? FF does a pretty good job but not always. It doesn't help that I do not a touch type, and that half of the legends are worn off of the keys on this old laptop (I had been coding for 47 years and my former boss said I would be a REAL TERROR if I could touch type!)

Dave

#### KeepingRealBusy

• Member
• Posts: 426
##### Re: [3D Graphic]Normals of a Face
« Reply #6 on: June 17, 2012, 07:44:43 AM »
Steve,

To my question about rotations, if you spin a flat plane about its normal like a top, does the normal rotate? This is not meant to be a trick question, just a question of nomenclature.

Dave.

#### Farabi

• Member
• Posts: 970
• Neuroscience Fans
##### Re: [3D Graphic]Normals of a Face
« Reply #7 on: June 17, 2012, 12:00:02 PM »
not sure what you mean by "normals"
but - this is something i'd like to learn about, too

Hi Dave,
On my term, a normals is where the face facing. For example, a normals of X-Y-Z format value, had a value of 0-1-0, it mean, it was facing directly to Y. and if 1-0-0 it is facing directly to X, where if you scale the normals, and add it with the origin place of a vertex, you can see it direction.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

#### FORTRANS

• Member
• Posts: 1016
##### Re: [3D Graphic]Normals of a Face
« Reply #8 on: June 17, 2012, 10:59:54 PM »
Hi,

Quote
Did I screw up any spellings?

No, I was having a bad day and needed the dictionary way
too many times.

Quote
To my question about rotations, if you spin a flat plane about its normal like a top, does the normal rotate? This is not meant to be a trick question, just a question of nomenclature.

As a one dimensional construct, the vector will be rotated
and it won't make any difference in the end.  I.e. if you
represent the normal vector as a homogeneous vector,
it will be multiplied by the "spin" transformation matrix,
so that all of the arithmetic of a rotation will get carried out.
But you end up with the same vector as you started out with.
does it get rotated or not?

Regards,

Steve N.

#### FORTRANS

• Member
• Posts: 1016
##### Re: [3D Graphic]Normals of a Face
« Reply #9 on: June 19, 2012, 12:09:39 AM »
Hi,

Well that was botched.  Amazing what you think about
at 2:00am.  Sorry.

Replace polyhedron with polygon.  A polygon is a
2-D object, a polyhedron is a 3-D object made up of
a number of  polygonal faces.  Think of a cube made up
of squares.  In 3-D graphics, the polyhedron is usually
called a mesh and is made up of triangles.

A normal is a fancy (?) term for a perpendicular vector.
For a plane that is simple to envision.  As Dave said, for
a polygon, you can take the cross product of two edges
to produce a perpendicular vector, and normalize to get
the normal.

About the spinning:  If you got a pizza pan and stuck
an arrow in it, you could rotate the fixed object around
the arrow.  If you painted the left side of the arrow green
and the right side red, you would see the arrow rotate
with the pan.

But paint does not work with a one dimensional vector.
So when rotating (spinning) a plane about its normal, the
normal remains unchanged.  Even though you can pass it
through all the math of the transform.  So it is normally
(sorry) said to not rotate as it is identical before and after.

Hopefully this is better than yesterday's.

...,

Steve N.

#### KeepingRealBusy

• Member
• Posts: 426
##### Re: [3D Graphic]Normals of a Face
« Reply #10 on: June 19, 2012, 12:16:56 AM »
Steve,

I even pulled "Anlalytic Geometry A Vector Approach" (Wexler, 1964) from my library shelf and started reading. Ugh!

I used to enjoy this!

Dave.

#### KeepingRealBusy

• Member
• Posts: 426
##### Re: [3D Graphic]Normals of a Face
« Reply #11 on: June 19, 2012, 12:26:01 AM »
In 3-D graphics, objects can be made from polyhedra.  You
can use two edges of a polyhedron to generate a normal.
If when creating the polyhedra, you maintain a fixed ordrering
of the vertices (clockwise or counter-clockwise) for all
polyhedra, you use the normal to see if the visible side of
the polyhedron is pointing towards the viewer and needs
to be drawn (unless blocked of course).  Thus the normal
is defined in the object's coordinate system and is rotated
when the object is rotated.  (Whether the normal is stored
in the object definition or calculated for each test.)

Steve,

I question "clockwise OR counter-clockwise". If you go clockwise, I think the  two edge vectors cross product will be reversed, you have to label the edges in a face counter-clockwise to get a normal (cross product) that points out.

Dave.

#### FORTRANS

• Member
• Posts: 1016
##### Re: [3D Graphic]Normals of a Face
« Reply #12 on: June 19, 2012, 12:45:49 AM »
Hi Dave,

That makes my brain hurt.  I think (thought) that CW/CCW
choice depended on your choice of left-hand or right-hand
coordinate system.  (?)  Will try to put that on my to do
list.

A good discussion of this is in "Fundementals of Interactive
Computer Graphics", J. D. Foley and A. Van Dam, 1982.  I
think newer editions are out with a different title.

Jim Blinn's three (?) books in the series "Jim Blinn's Corner"
are entertaining and discuss vectors and transformations.

You can generate normals to a curved suface such as a
sphere by selecting a point on the surface and finding the
plane tangent to the surface at that point.  So a plane has
only one normal, while a sphere has any number of them.
Used for illumination effects.

Regards,

Steve N.

#### KeepingRealBusy

• Member
• Posts: 426
##### Re: [3D Graphic]Normals of a Face
« Reply #13 on: June 19, 2012, 01:32:22 AM »
Steve,

Thank you for the computer age references. All my stuff is ancient.

That makes my brain hurt.

Why do you think I said Ugh!

Have to run to do some errands, be back this afternoon.

Dave.

#### FORTRANS

• Member
• Posts: 1016
##### Re: [3D Graphic]Normals of a Face
« Reply #14 on: June 19, 2012, 04:45:57 AM »
Hi,

I checked in the Foley and Van Dam book where they
noted that in their coordinate system, right-handed with
angles such that a 90 degree rotation will perform rotations
as follows.

Direction of
Axis of rotation  positive rotation
x               y to z
y               z to x
z               x to y

This is right-handed system with counter-clockwise angles.
They state that this is also the standard for vector algebra.
They then note that this is the opposite to the system used
by "Principles of Interactive Computer Graphics", by W. M.
Newman and R. F. Sproull, 1979.  (Clockwise angle definition.)

One book I have defines the cross product based on
the sine of angle between the two vectors used to create
the cross product.  I think that assumes the standard
vector algebra angles.  Otherwise the cross product could
point in either direction based on the choice of a clockwise
or counter-clockwise angle system.  And his explaination
of how to calculate the cross product does not use angles.

Finally, it is noted in an exercise:  "For the test to be valid,
the normal used for each polygon must consistently be inward
(pointing into the polyhedren) or outward."

looks as if your system is consistent, you can choose any
convenient coordinate system idiom or its opposite.  Clockwise
or counter-clockwise angles, clockwise or counter-clockwise
vertex/edge ordering, and left or right handed axis placement.

Cheers,

Steve N.