Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBrother Bob

Posted 16 December 2012 - 05:46 PM

I addressed that in my last paragraph; you have to perform a full 4-dimensional multiplication because you cannot multiply a 3-dimensional by a 4x4 matrix. You have to expand the multiplication using a full 4-dimensional vector.

Here's your matrix and vector and the product of the two.
>> M
M =
    0.7500    0         0         0
    0         1.0000    0         0
    0         0        -1.0001   -0.2000
    0         0        -1.0000    0
>> v
v =
	 1
	 2
	 3
	 1
>> p = M*v
p =
    0.7500
    2.0000
   -3.2003
   -3.0000
See how the fourth element of the vector p is -3.0? That's because your 3-dimensional vector is actually a 4-dimensional vector with an implicit element at the end with a value of 1.0.

The perspective division is just dividing all elements of the vector by the fourth element:
>> p./p(4)
ans =
   -0.2500
   -0.6667
    1.0668
    1.0000
So your resulting projected 3-dimensional vector is (-0.2500, -0.6667, 1.0668).

#1Brother Bob

Posted 16 December 2012 - 05:42 PM

I addressed that in my last paragraph; you have to perform a full 4-dimensional multiplication because you cannot multiply a 3-dimensional by a 4x4 matrix. You have to expand the multiplication using a full 4-dimensional vector.

Here's your matrix and vector and the product of the two.
>> M
M =
    0.7500		 0		 0		 0
		 0    1.0000		 0		 0
		 0		 0   -1.0001   -0.2000
		 0		 0   -1.0000		 0
>> v
v =
	 1
	 2
	 3
	 1
>> p = M*v
p =
    0.7500
    2.0000
   -3.2003
   -3.0000
See how the fourth element of the vector p is -3.0? That's because your 3-dimensional vector is actually a 4-dimensional vector with an implicit element at the end with a value of 1.0.

The perspective division is just dividing all elements of the vector by the fourth element:
>> p./p(4)
ans =
   -0.2500
   -0.6667
    1.0668
    1.0000
So your resulting projected 3-dimensional vector is (-0.2500, -0.6667, 1.0668).

PARTNERS