SURE 372 
OTHER USEFUL INFORMATION


This information has been taken from discussions in various newsgroups.  The actual applications may not fit specifically to surveying engineering but they do provide further information about the basic principles.  There is no guarantee as to the accuracy of all of the information.

Echelon Form of a Matrix
Vector Dot Product


The Vector Dot Product

The vector dot product, also called the scalar product, is defined as the magnitudes of two vectors multiplied by the cosine of the angle formed by the two vectors. Or, in notation, the dot product of two vectors, A and B, (denoted by the notation A·B) and written as;

A·B = |A| |B| cos q (( read as A dot B = abs(A) abs(b) cos theta))

The dot product is also called the scalar product since its result is a scalar value, not a vector. The dot product is commutative, as in;

A·B = B·A

As well as distributive;

A·(B+C) = A·B + A·C = B·A + C·A

The dot product can also be calculated by taking the individual vector components and calculating the dot product on each component (since dot products are distributive). When you do this, after eliminating all vectors that are at right angles (since cos 90o is zero) is; 

A·B = ax + ay + az ((read as a SUB x, b SUB x...))

This is the form that's typically used to generate a dot product, since it's made up of just the sum of the product of each unit vectors. The dot product is very useful in a variety of ways. With it you can calculate the angle between two vectors, you can break a vector that's in a random direction on a plane into two vectors (for example, a vector on the xy plane can be broken into an x vector and a y vector). For example, in the recipe on collison detection, we need to calculate the distance between a bounding sphere, and on of the sides of the viewing volumn. In simpler terms this breaks down into the distance between a point p and a plane. If you have the normal to the plane (which is easy to get, as we'll see in the next section) all you need to do is calculate a vector that starts on the plane an intersects the point. If we have the normal, n, we already have a direction vector. Using the dot product, we just need to create a vector that goes from the point to any place on the surface (like a vertex of our wall), say point v, and take the dot product of that with the surface normal. (Technically this is called projecting, and it means taking one vector and projecting it onto another in terms of one parallel vector and one orthogonal vector. Think of it as getting the sine and cosine from a radius.) Create the vector by simply subtracting one point from the other (the order is important. This is a vector connecting the surface to the point. What we need is the length of the vector that makes up the distance from the plane to the point, not the origin. Take the cross product of that new vector with the normal [[......................]]

Since the dot product doesn't require the two vectors to have the same origin, this will work for any point on the plane (since, the further away from the point, the smaller the angle will be). Remember that

Now where it gets interesting is when both A and B are unit vectors. Then we can simplify equation XXX to be;

A·B = cos q

Now knowing the cos q value is very useful in 3D graphics because if vector L represents a lighting direction vector, and vector N represents a surface normal, and scalar I represents the light's intensity, then we can calculate the intensity of the light on the surface, Is (assuming no attenuation (decrease) of the light with distance) with the following equation;

Is = I(-L·N)

Note that we use L negated since we want the angle of the vector parallel to the light vector but pointing towards the surface, where as L points towards the surface.

The dot product is also useful for physics in calculating the work done on an object by a force F, since this is equal to the product of the vector force and the distance S that the object is moved by the force. It's also useful in collision detection for calculating the impulse generated by colliding bodies.

From: "Ron Fosner" <ron@directx.com> 
Date: 6/7/99 4:42PM 

Top of Page  

ECHELON FORM OF A MATRIX

31 March 1995, translated July 1997

The echelon form or a reduced echelon form of a matrix is found. If any entries are not more than the tolerance E in absolute value, then they are assumed to be numerically zero when the program searches for a nonzero pivot. Such small entries are set to zero when the reduced matrix is displayed.

MatA starting matrix (left unchanged)
MatB echelon form
C pivot column
E tolerance (may be set to zero)
F flag equals 92 iff the echelon form will be reduced
G flag equals 92 iff each step is displayed
I row
J flag equals 1 if pivot is sufficiently large
L1 {M,N} = dimension of matrix
R pivot row

\start86\
\comment=Reduced or unreduced echelon form 
\name=ECHELON
\file=C:\WINLINK\86\ECHELON.HC6
:1\EE\\(-)\8\->\E
:ClLCD
:Input "ORIGINAL MATRIX =",MatA
:Disp "MatA=ORIGINAL MATRIX","
:Disp "MatB=ECHELON FORM","
:Disp "1 = REDUCED
:Disp "2 = UN-REDUCED
:Disp "3 = QUIT
:Repeat F\!=\0
:getKy\->\F
:End
:If F==94:Stop
:ClLCD
:Disp "1 = DISPLAY STEPS","
:Disp "2 = ANSWER ONLY
:Repeat G==92 or G==93
:getKy\->\G
:End
:ClLCD
:Disp "ORIGINAL MATRIX:","
:Pause MatA\>\Frac
:MatA\->\MatB
:dim MatB\->\L1
:L1(1\->\M:L1(2\->\N
:1\->\R:1\->\C
:While R\<=\M and C\<=\N
:1\->\J
:If abs MatB(R,C)\<=\E
:Then
:0\->\J:R+1\->\I
:While I\<=\M and J==0
:If abs MatB(I,C)>E
:Then
:1\->\J
:rSwap(MatB,R,I\->\MatB
:If G==92:Then
:ClLCD:Pause MatB\>\Frac
:End:End
:I+1\->\I
:End:End
:If J:Then
:multR(MatB(R,C)\^-1\,MatB,R\->\MatB
:If F==92:Then
:For(I,1,R-1
:mRAdd(\(-)\MatB(I,C),MatB,R,I\->\MatB
:End:End
:For(I,R+1,M
:mRAdd(\(-)\MatB(I,C),MatB,R,I\->\MatB
:End
:R+1\->\R:End
:For(I,1,M
:If abs MatB(I,C)\<=\E
:0\->\MatB(I,C
:End
:If G==92:Then
:ClLCD
:Pause MatB\>\Frac
:End:C+1\->\C
:End:0\->\F
:For(I,1,M
:For(J,C,N
:If abs MatB(I,J)\<=\E:Then
:1\->\F:0\->\MatB(I,J
:End:End:End
:If G==93 or F==1
:Then:ClLCD
:Disp "ECHELON FORM:","
:Pause MatB\>\Frac
:End
\stop86\

Michael Lloyd (lloydm@holly.hsu.edu)
Henderson State University

Top of Page

Back to SURE 372 web page.


This page is maintained by Bob Burtch and was last updated on 22 August 2000.
Please send any
comments or suggestions here.