|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Awesome, thanks!
On 9/28/2018 12:27 AM, clipka wrote:
> Am 28.09.2018 um 03:27 schrieb Mike Horvath:
>> Two important questions I have (that may not be explained in the docs),
>> is how to convert a 3x3 rotation matrix to POV-Ray syntax, and how to
>> determine the inverse matrix?
>
> given a matrix
>
> / a b c \
> ( d e f )
> \ g h i /
>
> you have to specify either
>
> matrix < a, b, c,
> d, e, f,
> g, h, i,
> 0, 0, 0 >
>
> or
> matrix < a, d, g,
> b, e, h,
> c, f, i,
> 0, 0, 0 >
>
> The order depends on whether the original matrix is specified in
> "mathematical" or "computer graphics" style - they're mirrored along the
> diagonal. Can't remember which one POV-Ray uses.
>
> Determining the inverse /transformation/ is simple:
>
> #declare Foo = transform { matrix < ... > }
> #declare FooInv = transform { Foo inverse }
>
> Actually getting at the corresponding matrix is possible by applying the
> inverted transformation to the axis vectors.
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 28/09/2018 à 03:27, Mike Horvath a écrit :
> Two important questions I have (that may not be explained in the docs),
> is how to convert a 3x3 rotation matrix to POV-Ray syntax, and how to
> determine the inverse matrix?
>
>
> Mike
you only have to input a 3x4 ( column x line), but the math beyond use a
4x4 matrix with a fourth column set to
{ 0,
0,
0,
1 }
(the 4x4 is important, when combining transformation, a 4x4 * 4x4 ->
4x4, whereas it make no sense with 3x4 )
The fourth line is the translation
http://wiki.povray.org/content/Reference:Transformations#Matrix
To input a 3x3 rotation matrix
( A B C
D E F
G H I )
into povray, it's "simply"
( A B C
D E F
G H I
0 0 0 )
With A to I being the naughty variations of
"cos(phi)*sin(theta)*cos(gamma)" as usual.
To get the inverse matrix, I'm lazy:
#declare Forward = transform { matrix < .... > } };
#declare Backward = transform { Forward inverse };
As long as the forward matrix is not degenerated, that should do the job.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 28/09/2018 à 01:40, Mike Horvath a écrit :
> It would be nice to be able to set vector components like this:
>
> #local tPrjB1.z = max(min(tPrjB1.z,1),-1);
>
> Are there any plans to do this in the future?
>
>
>
> Mike
you could use the following:
#local P = <p.x, P.y, max(min(P.z),1),-1)>;
Make that a set of macro, and voila.
#macro BoundZ( V )
<V.x, V.y, max(min(V.z),1),-1) >
#end
#local P = BoundZ(P);
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|