POV-Ray : Newsgroups : povray.general : matrix question : Re: matrix question Server Time
12 Aug 2024 03:32:40 EDT (-0400)
  Re: matrix question  
From: Rune S  Johansen
Date: 4 Apr 1999 17:15:06
Message: <3707c84a.0@news.povray.org>
John VanSickle wrote:
>Thomas Willhalm wrote:
>>
>> "Rune S. Johansen" <run### [at] get2netdk> writes:
>>
>> > Normally a matrix can transform
>> > an object so the point x can become
>> > P1, y can become P2, z can become
>> > P3 and the origin becomes P4.
>> > How can I do this thing backwards?
>> > I.e. P1 becomes x, P2 becomes y,
>> > P3 becomes z, and P4 becomes the
>> > origin. The way I tried it I only
>> > got a lot of divide by zero warnings.
>>
>> In practice, the matrix keyword in povray divides into a
>> - a linear function given by the matrix entries Val00 to Val22
>> - a transformation given by Val30 to Val32
>      ^^^^^^^^^^^^^^
>
>This should be "translation."
>
>> If you want to calculate the inverse function, you have to
>> - invert the 3x3 matrix Val00 to Val22
>> - take the negative of the vector Val30 to Val32
>
>Pretty much; IIRC, the inverted 3x3 has to be applied to the
>negated vector to yield the final result.  I've been scribbling
>notes for a suite of macros to fiddle with matrices, mainly
>because (a) there is no one-stop-shop for inverting a general
>matrix in POV-Ray (without doing the math oneself), (b)
>POV-Ray does not provide access to the elements within a
>transform, and (c) I wanted to provide a macro with the package
>to explicitly perform shears.
>
>> How to calculate a inverse matrix should be described in every
>> linear algebra book. Keep in mind, that not every matrix is
>> invertible.
>
>Yes, but the matrices that are not invertible are not valid for
>use in transformations.  They're easy to spot:  The first nine
>elements, when taken as a 3x3 matrix, yields a determinant = 0.
>
>If you give one of these to POV-Ray, you'll get a fatal error.
>
>Regards,
>John

So, I should be able to get the inverse function in ANY case.
I'd just appreciate an example or two so I will be able to
understand how.

Thanks,

Rune S. Johansen
http://hjem.get2net.dk/rsj


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.