POV-Ray : Newsgroups : povray.advanced-users : Convert matrix to rotate ? Server Time
30 Jul 2024 06:24:09 EDT (-0400)
  Convert matrix to rotate ? (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: Rune
Subject: Re: Convert matrix to rotate ?
Date: 20 May 2000 19:18:18
Message: <39271d3a@news.povray.org>
"Tor Olav Kristensen" wrote:
> I think there must be an error in your second macro.
> The variable X (in the 3rd line) is not defined.
> Is this meant to be a lower case x ?

No, it's supposed to be VectorX. Thank you for pointing it out.
This should be correct:

#macro Vectors2Rotate (VectorX,VectorY) // by Rune S. Johansen
   #local RotZ = FindAngle(x,<VectorX.x,VectorX.y,0>,z);
   #local RotY = FindAngle(x,vrotate(VectorX,-RotZ*z),y);
   #local RotX = FindAngle(vrotate(y,<0,RotY,RotZ>),VectorY,VectorX);
   <RotX,RotY,RotZ>
#end

> And I believe your first macro could be simplified to this:
<snipped code>

Hmm, you're probably right. I just write code using my own math skills,
which means that it is not always so optimized... I will have a look your
version.

Greetings,

Rune

---
Updated April 25: http://rsj.mobilixnet.dk
Containing 3D images, stereograms, tutorials,
The POV Desktop Theme, 350+ raytracing jokes,
miscellaneous other things, and a lot of fun!


Post a reply to this message

From: Ron Parker
Subject: Re: Convert matrix to rotate ?
Date: 22 May 2000 11:09:07
Message: <slrn8iik23.17k.ron.parker@linux.parkerr.fwi.com>
On Sat, 20 May 2000 15:46:55 +0200, Rune wrote:
>"Ken" wrote:
>> Rune wrote:
>> > So is there any way?
>>
>> If it is possible these two sites will tell you -
>>
>> http://www.gate.net/~shipbrk/raytrace/matrix.html
>> http://www.erols.com/vansickl/matrix.htm
>
>No of those pages explain how to do what I want to do, although the second
>one comes close. But thanks for the links anyway! :-)

I once did the math to figure out how to turn a matrix into a rotation,
a scale, and a transform (provided it didn't have a significant skew
component.)  If you still need it (not that it looks like you do) I can
email it to you or post it here.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
These are my opinions.  I do NOT speak for the POV-Team.


Post a reply to this message

From: Rune
Subject: Re: Convert matrix to rotate ?
Date: 22 May 2000 14:43:34
Message: <39297fd6@news.povray.org>
"Ron Parker" wrote:
> I once did the math to figure out how to turn a
> matrix into a rotation, a scale, and a transform
> (provided it didn't have a significant skew
> component.) If you still need it (not that it
> looks like you do) I can email it to you or post
> it here.

My own problem is solved now, but it would be very interesting to see your
solution anyway! Mine did the rotation part only.

> (provided it didn't have a significant skew
> component.)

You can do that with rotate, scale and translate too. Actually I would guess
that any transformation can be done using those. Not that I need it... :-)

Greetings,

Rune

---
Updated April 25: http://rsj.mobilixnet.dk
Containing 3D images, stereograms, tutorials,
The POV Desktop Theme, 350+ raytracing jokes,
miscellaneous other things, and a lot of fun!


Post a reply to this message

From: Peter Popov
Subject: Re: Convert matrix to rotate ?
Date: 22 May 2000 17:46:34
Message: <tfajisof9ihiip7do7f9mjud8uugc4i853@4ax.com>
On Mon, 22 May 2000 17:46:55 +0200, "Rune" <run### [at] inamecom>
wrote:


>> (provided it didn't have a significant skew
>> component.)
>
>You can do that with rotate, scale and translate too. Actually I would guess
>that any transformation can be done using those. Not that I need it... :-)

If you mean you can skew an object by rotation, translation and
scaling, I think you've been mislead. Mr. VanSickle is The One when it
comes to manipulating the matrix keyword and I trust whatever he says
on the subject, but this time I doubt he'd disagree. Then again, if I
am wrong, I will learn something new :)


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: PoD
Subject: Re: Convert matrix to rotate ?
Date: 22 May 2000 18:03:34
Message: <3929B3C4.C15692F@merlin.net.au>
Peter Popov wrote:
> If you mean you can skew an object by rotation, translation and
> scaling, I think you've been mislead. Mr. VanSickle is The One when it
> comes to manipulating the matrix keyword and I trust whatever he says
> on the subject, but this time I doubt he'd disagree. Then again, if I
> am wrong, I will learn something new :)

box{
  0,1
  rotate z*45
  scale <1,2,1>
  rotate z*-45}

PoD.


Post a reply to this message

From: Peter Popov
Subject: Re: Convert matrix to rotate ?
Date: 22 May 2000 18:45:42
Message: <qtdjisoodpngvfjuqpno5hdq9c6mbonj70@4ax.com>
On Tue, 23 May 2000 07:55:08 +0930, PoD <pod### [at] merlinnetau> wrote:

>box{
>  0,1
>  rotate z*45
>  scale <1,2,1>
>  rotate z*-45}

This is not what I had in mind. This only scales the local coordinate
axes but does not change the angle between them, as skewing does (I
think). Something like matrix <1,1,0,0,1,0,0,0,1,0,0,0> is more along
the lines of what I have in mind.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Margus Ramst
Subject: Re: Convert matrix to rotate ?
Date: 22 May 2000 19:57:34
Message: <3929BB96.1249FB24@peak.edu.ee>
Peter Popov wrote:
> 
> 
> This is not what I had in mind. This only scales the local coordinate
> axes but does not change the angle between them, as skewing does

This transform does indeed skew the object, but you'd have to use a bit of trig
to get the skewing along a specific axis.

-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg


Post a reply to this message

From: Peter Popov
Subject: Re: Convert matrix to rotate ?
Date: 22 May 2000 20:13:35
Message: <24jjisc9avdl16s2ggj9cmnu6ir9750ik1@4ax.com>
On Tue, 23 May 2000 01:58:30 +0300, Margus Ramst <mar### [at] peakeduee>
wrote:

>> This is not what I had in mind. This only scales the local coordinate
>> axes but does not change the angle between them, as skewing does
>
>This transform does indeed skew the object, but you'd have to use a bit of trig
>to get the skewing along a specific axis.

I see, so shearing comes down to scaling along (an) axe(i)s which are
(is) not perpendicular to the local axes. Am I right in guessing that?
If so, thanks for clearing it up for me! If not, I'd be thankful if
you cleared it up for me <grin>


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Margus Ramst
Subject: Re: Convert matrix to rotate ?
Date: 22 May 2000 20:50:24
Message: <3929C7F9.972F7B26@peak.edu.ee>
Peter Popov wrote:
> 
> I see, so shearing comes down to scaling along (an) axe(i)s which are
> (is) not perpendicular to the local axes. Am I right in guessing that?
> If so, thanks for clearing it up for me! If not, I'd be thankful if
> you cleared it up for me <grin>
> 

Well, yes. That's one way of looking at it. Of course, matrix shearing
approaches the problem from a different perspective - the scaling of a point
along one global axis is (linearly) bound to the distance of this point along
another global axis. E.g. when Point.x increases, the multiplier (scale) of
Point.y increases.

-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg


Post a reply to this message

From: John VanSickle
Subject: Re: Convert matrix to rotate ?
Date: 23 May 2000 19:19:57
Message: <392B1591.B312F16F@erols.com>
Peter Popov wrote:
> 
> On Mon, 22 May 2000 17:46:55 +0200, "Rune" <run### [at] inamecom>
> wrote:
> 
> >You can do that with rotate, scale and translate too. Actually I would guess
> >that any transformation can be done using those. Not that I need it... :-)
> 
> If you mean you can skew an object by rotation, translation and
> scaling, I think you've been mislead. Mr. VanSickle is The One when it
> comes to manipulating the matrix keyword and I trust whatever he says
> on the subject, but this time I doubt he'd disagree. Then again, if I
> am wrong, I will learn something new :)

My matrix page does not explicitly spell this out, but shearing can
be done with the proper combination of rotate, non-uniform scale, and
another rotation.  It is far easier to use a matrix.  I would have
whipped up some macros for shearing, but the many different ways that
shearing can be specified makes it troublesome to decide how the syntax
should work.

Regards,
John
-- 
ICQ: 46085459


Post a reply to this message

<<< Previous 6 Messages Goto Initial 10 Messages

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