Showing posts with label linear.Algebra. Show all posts
Showing posts with label linear.Algebra. Show all posts

Thursday, August 11, 2016

Define: How to transform normal vector from local to eye space :-)

Define


In order to understand how normal vectors are transformed to eye space, think the normals as coefficients of Plane-Equations, which are perpendicular to the planes

Imagine a triangle polygon with 3 vertices;v1-v2-v3,and the normal of this surface is (Nx,Ny,Nz,Nw) as a homogeneous plane (for euclidean space, the normal is (Nx,Ny,Nz)). If we think of the triangle as a homogeneous plane, then the plane equation becomes;(by replacing x,y,z to X/W,Y/W,Z/W, then multiplying on both sides)


XNx + YNy + ZNz + WNw = 0

Since 3 vertices lie on this plane, the plane equation is also true when we substitute these vertices to the equation.For example, for
V1=(x1,y1,z1,w1), it satisfies:


x1Nx + y1Ny + z1Nz + w1Nw = 0

The equivalent matrix form of the plane equation is:



The Plane equation is multiplying the transposed normal (NT) and the vertex together..

Now, we modify the above equation to acquire normal vector transformation formula by inserting GL_MODELVIEW matrix (M-1M)  in between.



As you can see, the right part of the above equation  is transforming vertex to eye space, and the left part  is going to be the normal vector in eye space because the plane equation is also transformed.

It reads as "The transformed vertex  lies on the transformed plane  in eye coordinates space".


Therefore, transforming normal from object space to eye space with GL_MODELVIEW matrix M is; 



Or, by converting pre-multiplication to post-multiplication form, we get:





Sunday, August 7, 2016

Define: Hyperplane

Define: Hyperplane


In geometry a hyperplane is a subspace of one dimension less than its ambient space. If a space is 3-dimensional then its hyperplanes are the 2-dimensional planes, while if the space is 2-dimensional, its hyperplanes are the 1-dimensional lines.

--wikipedia

A hyperplane in n-dimensional space is an (n−1)-dimensional object that can be described by n→⋅x→=k where n→ is a constant vector orthogonal to the hyperplane, x→ is a variable vector from the origin to a point on the plane, and k is some scalar constant. A hyperplane in 2-space is a line; a hyperplane in 3-space is a plane. (edit: Matt E.'s comment that a hyperplane is a subspace of dimension one less than the whole space is a much nicer definition than mine.)


--By Isaac from stackexchange














Saturday, August 6, 2016

Definite: Plane Equation

Define:Plane Equation

...

Transformation of Format


a vector equation for plane-P 

Definition

--by Dan Sloughter 2001

Another Source Tutorial

By songho.ca

Plane Equation
..Distance from Origin
..Distance from any a Point

let's start by assuming that we know a point that is on the plane [point]P0 .
let's also suppose that we have a vector that is orthogonal/perpendicular to the plane [vector]n .This vector is called normal vector. Now assume that [point]P is any point in the plane. Finally, since we are going to be working with vectors initially we'll let [position]r0 and [position]r for [point]P0 and [position]P respectively.
here is a sketch of all these vectors.
Notice that we added in the [vector](r-r0) which will lie completely in the plane.
Also notice that we put the normal vector on the plane, but there is actually no reason to expect this to be the case. We put it here to illustrate the point. It is completely possible that the normal vector does not touch the plane in any way.

Now, because [vector]n is orthogonal to the plane, it's also orthogonal to any vector that lies in the plane. In particular it's orthogonal to [vector](r-r0) . Recall from the Dot-Product section that two orthogonal vectors will have a dot product of zero. In other words,


scalar equation of plane

Start with the first form of the vector equation and write down a vector for the difference.