 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Mon, 22 May 2000 17:46:55 +0200, "Rune" <run### [at] iname com>
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] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Tue, 23 May 2000 07:55:08 +0930, PoD <pod### [at] merlin net au> 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] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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] peak edu ee
TAG (Team Assistance Group) e-mail: mar### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Tue, 23 May 2000 01:58:30 +0300, Margus Ramst <mar### [at] peak edu ee>
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] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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] peak edu ee
TAG (Team Assistance Group) e-mail: mar### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Peter Popov wrote:
>
> On Mon, 22 May 2000 17:46:55 +0200, "Rune" <run### [at] iname com>
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |