|
![](/i/fill.gif) |
This might be a bit off topic, BUT it
might trigger some ideas for some math-
interested POV-ers...
I've been thinking a little bit about the
fact that this expression:
vdot(vA, vcross(vB, vC))
will give the determinant of an 3x3 matrix
made up from the three 3-dimensional row
vectors; vA, vB and vC:
vA = <Ax, Ay, Az>
vB = <Bx, By, Bz>
vC = <Cx, Cy, Cz>
I.e. this matrix:
| Ax Ay Az |
| Bx By Bz |
| Cx Cy Cz |
Why is this so ?
I'm not really sure, but below is my attempt
to describe how I see this.
(Note that I suspect there to be some
"deeper" relations between the determinant
of a 3x3 matrix and the cross product of
two vectors in 3D-space, but I haven't
studied enough linear algebra to see this
relation. Now it's about 10 years since
I studied a little linear algebra. So for
all I know, my scribbling below may either
be 1) rubbish or 2) common knowledge in
higher degree linear algebra courses without
me being aware of it.)
But anyway - here I go:
The determinant of the matrix above can be
calculated like this:
Ax*(By*Cz - Bz*Cy)
-Ay*(Bx*Cz - Bz*Cx)
+Az*(Bx*Cy - By*Cx)
And this expression can be rewritten like
this:
Ax*(By*Cz - Bz*Cy)
+Ay*(Bz*Cx - Bx*Cz)
+Az*(Bx*Cy - By*Cx)
Now this starts to look like a simple dot
product between two 3D-vectors:
the first one being equal to vA:
<Ax, Ay, Az>
and the second equal to:
<By*Cz - Bz*Cy, Bz*Cx - Bx*Cz, Bx*Cy - By*Cx>
which is the same as the cross product of
the two vectors vB and vC.
I.e.: vcross(vB, vC)
I now name this cross product vector vD.
It's components are then:
Dx = By*Cz - Bz*Cy
Dy = Bz*Cx - Bx*Cz
Dz = Bx*Cy - By*Cx
The dot product between vA and vD is equal
to:
Ax*Dx + Ay*Dy + Az*Dz
So:
Ax*(By*Cz - Bz*Cy)
+Ay*(Bz*Cx - Bx*Cz)
+Az*(Bx*Cy - By*Cx) =
Ax*Dx + Ay*Dy + Az*Dz =
vdot(vA, vD) =
vdot(vA, vcross(vB, vC))
(q.e.d.)
Notice now that each of the 3 components
of vD has similarities to what would be
the determinants of these three 2x2 sub-
matrices.
| By Bz |
| Cy Cz |
and
| Bx Bz |
| Cx Cz |
and
| Bx By |
| Cx Cy |
I.e. the 3 determinants:
By*Cz - Bz*Cy
Bx*Cz - Bz*Cx
Bx*Cy - By*Cx
So I now choose to write the cross product
vector vD like this:
vD = vcross(vB, vC) =
<det(M0), -det(M1), det(M2)>
where M0, M1 and M2 are the three 2x2 sub-
matrices above. And det(Mn) means the
determinant of the matrix Mn.
Now I'm thinking that if a 2-dimensional
vector cross product was defined, then
maybe one could express these determinants
with expressions consisting of 2-
dimensional dot products and cross products ?
E.g.:
det(N) = vdot(vE, vcross(vF))
N is now a 2x2 matrix and vE and vF are
the two 2-dimensional vectors it is made
up from:
vE = <Ex, Ey>
vF = <Fx, Fy>
I.e. this matrix:
| Ex Ey |
| Fx Fy |
I'm choosing the cross product in 2D-space
to be made from only one vector, since
no 2D-vector (except the null vector
<0, 0>) can be orthogonal to two other
2D-vectors (none equal) at the same time.
The cross product vector of two vectors
in 3D-space is orthogonal to each of the
two vectors that it is the cross product
of.
I.e. if:
v2 = vcross(v0, v1)
then v2 is orthogonal to both v0 and v1.
This implies that
vdot(v2, v0) = 0
and that:
vdot(v2, v1) = 0
Therefore I suggest that the 2 dimensional
cross product vector must be orthogonal to
the vector that it is the cross product
vector of.
I.e. if:
vG = vcross(vF)
then here is two ways to form such a cross
product vector:
Either:
vG = <Fy, -Fx>
or:
vG = <-Fy, Fx>
Both solutions will satisfy this expression
vdot(vG, vF) = 0
which can be written like this:
vdot(<Gx, Gy>, <Fx, Fy>) = 0
or like this:
Gx*Fx + Gy*Fy = 0
Here's the result from the 1st solution:
Fy*Fx + (-Fx)*Fy = Fx*Fy - Fx*Fy = 0
Here's the result from the 2nd solution:
(-Fy)*Fx + Fx*Fy = -Fx*Fy + Fx*Fy = 0
I like the 1st solution best, because if
one follows my idea further down the
dimensions, then the vector components of a
2-dimensional cross product vector can be
expressed with determinants of 1x1 matrices
following the same plus/minus sign-pattern
as above:
vG = vcross(vF) =
<det(P0), -det(P1)>
Where P0 and P1 are two 1x1 sub matrices
of the N matrix above:
| Fy |
and
| Fx |
We then get:
det(P0) = Fy
and:
det(P1) = Fx
Thus:
vG = <Fy, -Fx>
So now:
det(N) = vdot(vE, vcross(vF))
= vdot(vE, vG)
= Ex*Fy + Ey*(-Fx) = Ex*Fy - Ey*Fx
Which is the only type of determinand
expression that I'm able to see directly
if it is correct. And IIRC it is.
-------------------------------------------
Now I'm thinking about defining a cross
product for the 4-dimensional space,
that will be useful for calculating the
determinants for 4x4 matrices and for
calculating a vector that is orthogonal
to 3 given 4-dimensional vectors.
I'll just follow the same pattern as above:
First I name this 4x4 matrix P:
| Hx Hy Hz Ht |
| Ix Iy Iz It |
| Jx Jy Jz Jt |
| Kx Ky Kz Kt |
which made up from these 4 row vectors:
vH = <Hx, Hy, Hz, Ht>
vI = <Ix, Iy, Iz, It>
vJ = <Jx, Jy, Jz, Jt>
vK = <Kx, Ky, Kz, Kt>
If:
vR = vcross(vI, vJ, vK) =
<det(Q0), -det(Q1), det(Q2), -det(Q3)>
then:
det(P) = vdot(vH, vR) =
vdot(vH, vcross(vI, vJ, vK))
Q0, Q1, Q2 and Q3 are all 3x3 sub-matrices
of the matrix P. Here they are:
| Iy Iz It |
| Jy Jz Jt |
| Ky Kz Kt |
| Ix Iz It |
| Jx Jz Jt |
| Kx Kz Kt |
| Ix Iy It |
| Jx Jy Jt |
| Kx Ky Kt |
| Ix Iy Iz |
| Jx Jy Jz |
| Kx Ky Kz |
I'm NOT going to show here that now
these statements are all true:
vdot(vR, vI) = 0
vdot(vR, vJ) = 0
vdot(vR, vK) = 0
I'm quite sure about that. (But I've
probably made some errors above, so
someone might prove me wrong ;)
Making similar expressions for the
5th dimension and higher dimensions
is now easy:
Just follow the pattern I've described.
Below is a POV-script that I've made to
experiment with these ideas.
Unfortunately the built in vector
operators in POV-Ray; vdot() and vcross()
are not able to operate on the 4-
dimensional and 5-dimensional POV-
vectors. Therefore I have defined my
own macro versions of these below. I've
also made such macros for 2D- and 3D-
vectors in order to be able to try and
verify my theories above and to make it
easier to compare the macros for the
different dimensions.
Comments are welcome !
Btw.:
Can anyone tell me if it is at all
possible to extract a fifth component
from a 5D-color vector in POV ?
(This would be useful for 5D-macros.)
Tor Olav
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Copyright 2001 by Tor Olav Kristensen
// mailto:tor### [at] hotmail com
// http://www.crosswinds.net/~tok
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// 1-dimensional stuff
#macro DetM_1D(MM)
MM[0]
#end // macro Det_1D
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// 2-dimensional stuff
#macro Vdot_2D(vA, vB)
(
vA.u*vB.u +
vA.v*vB.v
)
#end // macro Vdot_2D
#macro Vcross_2D(vA)
#local M0 = array[1] {
vA.y
}
#local M1 = array[1] {
vA.x
}
< DetM_1D(M0), -DetM_1D(M1)>
#end // macro Vcross_2D
#macro DetM_2D(MM)
Vdot_2D(MM[0], Vcross_2D(MM[1]))
#end // macro Det_2D
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// 3-dimensional stuff
#macro Vdot_3D(vA, vB)
(
vA.x*vB.x +
vA.y*vB.y +
vA.z*vB.z
)
#end // macro Vdot_3D
#macro Vcross_3D(vA, vB)
#local M0 = array[2] {
<vA.y, vA.z>,
<vB.y, vB.z>
}
#local M1 = array[2] {
<vA.x, vA.z>,
<vB.x, vB.z>
}
#local M2 = array[2] {
<vA.x, vA.y>,
<vB.x, vB.y>
}
< DetM_2D(M0), -DetM_2D(M1), DetM_2D(M2)>
#end // macro Vcross_3D
#macro DetM_3D(MM)
Vdot_3D(MM[0], Vcross_3D(MM[1], MM[2]))
#end // macro DetM_3D
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// 4-dimensional stuff
#macro Vdot_4D(vA, vB)
(
vA.x*vB.x +
vA.y*vB.y +
vA.z*vB.z +
vA.t*vB.t
)
#end // macro Vdot_4D
#macro Vcross_4D(vA, vB, vC)
#local M0 = array[3] {
<vA.y, vA.z, vA.t>,
<vB.y, vB.z, vB.t>,
<vC.y, vC.z, vC.t>
}
#local M1 = array[3] {
<vA.x, vA.z, vA.t>,
<vB.x, vB.z, vB.t>,
<vC.x, vC.z, vC.t>
}
#local M2 = array[3] {
<vA.x, vA.y, vA.t>,
<vB.x, vB.y, vB.t>,
<vC.x, vC.y, vC.t>
}
#local M3 = array[3] {
<vA.x, vA.y, vA.z>,
<vB.x, vB.y, vB.z>,
<vC.x, vC.y, vC.z>
}
< DetM_3D(M0), -DetM_3D(M1), DetM_3D(M2), -DetM_3D(M3)>
#end // macro Vcross_4D
#macro DetM_4D(MM)
Vdot_4D(MM[0], Vcross_4D(MM[1], MM[2], MM[3]))
#end // macro DetM_4D
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Define a couple of macros to allow me to see the results
#macro PrintVector_4D(vA)
#debug "< "
#debug str(vA.x, 0, -1)
#debug ", "
#debug str(vA.y, 0, -1)
#debug ", "
#debug str(vA.z, 0, -1)
#debug ", "
#debug str(vA.t, 0, -1)
#debug " >"
#end // macro PrintVector_4D
#macro PrintMatrix_4D(MM)
#debug "\n{ "
PrintVector_4D(MM[0])
#debug ", \n "
PrintVector_4D(MM[1])
#debug ", \n "
PrintVector_4D(MM[2])
#debug ", \n "
PrintVector_4D(MM[3])
#debug " }\n"
#end // macro PrintMatrix_4D
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Now check if the determinant of this matrix equals -795
// (As my HP-48SX says it is.)
#declare M44 =
array[4] {
< 2, 0, 6, 3>,
< 8, 1, -4, -2>,
< 0, 5, 7, 1>,
< 5, -5, -4, -2>,
}
#debug "\n"
#debug "The determinant of this matrix:"
#debug "\n"
PrintMatrix_4D(M44)
#debug "\n"
#debug "Is equal to: "
#debug str(DetM_4D(M44), 0, -1)
#debug "\n"
#debug "\n"
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
Post a reply to this message
|
![](/i/fill.gif) |