POV-Ray : Newsgroups : povray.general : Matrices Server Time
11 Aug 2024 09:27:51 EDT (-0400)
  Matrices (Message 11 to 20 of 21)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 1 Messages >>>
From: Charles
Subject: Re: Matrices
Date: 4 Sep 1999 14:02:33
Message: <37D15F17.77748C9D@enter.net>
Mike wrote:
> //sheared box
> 
> box {<-1, -1, -1>, <1, 1, 1>
> pigment {checker color White, color Black}
> finish {ambient .1 phong 1 phong_size 40}
> 
> rotate 45*z
> scale <2, 1, 1>
> rotate -27*z
> [...]

<g> Or, to be more precise, the final line should read...
rotate -z * atan2((sin(.25*pi)/2/cos(.25*pi)),1) * 180 / pi

Thank you. Armed with your sample POV code and a piece of
scratch paper, I was finally able to visualize what a shear
transformation was doing. Which in turn makes it easier to
make use of. :)


Charles
-- 
http://www.enter.net/~cfusner
"...Then darkness took me, and I strayed out of thought and time,
 and I wandered far on roads that I will not tell..." 
                              -The Two Towers, JRR Tolkien


Post a reply to this message

From: Nieminen Juha
Subject: Re: Matrices
Date: 6 Sep 1999 05:18:49
Message: <37d386f9@news.povray.org>
Tony Vigil <tvi### [at] gtenet> wrote:
: This is not completely true.  There is another way...  If you rotate your
: object, then add it to a CSG, rescale the CSG, then rotate the CSG the
: oposite direction of the first rotation the necessary amount - you do get a
: sheared object!

  Why do you need a CSG at all for this?

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: Matrices
Date: 6 Sep 1999 11:20:09
Message: <37d3dbf0.582873090@news.povray.org>
On 6 Sep 1999 05:18:49 -0400, Nieminen Juha <war### [at] cctutfi> wrote:

>Tony Vigil <tvi### [at] gtenet> wrote:
>: This is not completely true.  There is another way...  If you rotate your
>: object, then add it to a CSG, rescale the CSG, then rotate the CSG the
>: oposite direction of the first rotation the necessary amount - you do get a
>: sheared object!
>
>  Why do you need a CSG at all for this?

Probably because people who have used Moray extensively don't realize
POV lets you do multiple rotations on the same object without having
to put it in a gruop.


Post a reply to this message

From: Josh English
Subject: Re: Matrices
Date: 7 Sep 1999 12:47:29
Message: <37D541C4.B65251FC@spiritone.com>
You do them in your head? I'm impressed... especially when it comes to
figuring out sine and cosine values.

Can you teach me to do that? I'm going to teach math eventually, so I should
probably learn to save face, or impress students.

John VanSickle wrote:

> Larry Fontaine wrote:
> >
> > Just for anybody who maybe isn't familiar with this feature...
>
> I have a whole page devoted to this, and it's fairly well-known
> 'round here.  You can find it at:
>
>   http://users.erols.com/vansickl/matrix.htm
>
> > You can use matrices in POV, and they're very useful because you can
> > shear (only way to do so), and you can multiply them so you only have
> > one transform statement in your object.
> > Most of you probably knew that.
>
> Yup.
>
> > Format is:
> >    matrix <Ax,Ay,Az,Bx,By,Bz,Cx,Cy,Cz,Dx,Dy,Dz>
> > Matrix transformations in POV:
> >  shear x and y for z:
> >    [  1    0    0  ]
> >    [  0    1    0  ]
> >    [  X    Y    0  ]
> >    [  0    0    0  ]
>
> The third row should read:
>
>      [  X    Y    1  ]
>
> > I made a TI-86 program to find POV-matrices. Just select the transform
> > and enter the numbers. Maybe I'll post it.
>
> Bah.  I do them in my head.
>
> Regards,
> John
> --
> ICQ: 46085459

--
Joshua English
eng### [at] spiritonecom
IQC: 1946299
"It's a thankless job, but I've got a lot of Karma to burn off."


Post a reply to this message

From: Tony Vigil
Subject: Re: Matrices
Date: 7 Sep 1999 14:01:04
Message: <37D552DA.3D071989@emc-inc.com>
Can you get a sheared object any other way - not including matrices?

Nieminen Juha wrote:

> Tony Vigil <tvi### [at] gtenet> wrote:
> : This is not completely true.  There is another way...  If you rotate your
> : object, then add it to a CSG, rescale the CSG, then rotate the CSG the
> : oposite direction of the first rotation the necessary amount - you do get a
> : sheared object!
>
>   Why do you need a CSG at all for this?
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: Matrices
Date: 7 Sep 1999 15:12:28
Message: <slrn7taoss.v8.parkerr@ron.gwmicro.com>
On Tue, 07 Sep 1999 11:00:58 -0700, Tony Vigil wrote:
>Can you get a sheared object any other way - not including matrices?

Yes, but not with most modeling programs.  Just rotate, scale, and
rotate back.  There is no need for the CSG.  In fact, POV complains
if a CSG doesn't contain at least two objects.


Post a reply to this message

From: Tony Vigil
Subject: Re: Matrices
Date: 7 Sep 1999 16:18:07
Message: <37D572F9.6E755DD9@emc-inc.com>
Hmmm.  I didn't realize that would work in POV since it doesn't work that
way in Moray.  I started using POV with Moray as my method of creating
all of my scenes (gasp!) - so I'm not the sharpest knife in the POV scene
building language cabinet.

Thanks for the info.  Now I know that much more!

Ron Parker wrote:

> On Tue, 07 Sep 1999 11:00:58 -0700, Tony Vigil wrote:
> >Can you get a sheared object any other way - not including matrices?
>
> Yes, but not with most modeling programs.  Just rotate, scale, and
> rotate back.  There is no need for the CSG.  In fact, POV complains
> if a CSG doesn't contain at least two objects.


Post a reply to this message

From: John VanSickle
Subject: Re: Matrices
Date: 7 Sep 1999 18:39:37
Message: <37D5977E.83926BF@erols.com>
Josh English wrote:
> 
> John VanSickle wrote:
> 
> > Larry Fontaine wrote:
> > >
> > > I made a TI-86 program to find POV-matrices. Just select the
> > > transform and enter the numbers. Maybe I'll post it.
> >
> > Bah.  I do them in my head.
>
> You do them in your head? I'm impressed... especially when it comes to
> figuring out sine and cosine values.
> 
> Can you teach me to do that? I'm going to teach math eventually, so I
> should probably learn to save face, or impress students.

I generally use them when I want to do two transforms at once.  The
first thing I do is to type out the identity matrix (the one that
doesn't make any changes):

  matrix <1,0,0, 0,1,0, 0,0,1, 0,0,0>

Then I go back and replace the elements with what's needed to accomplish
the transformation.  To save on typing, any value that is not a neat 
fraction or decimal value is assigned to a variable earlier on:

#local sC=sqrt(.75); // scalar containing a cosine value
#local sS=.5;        // scalar containing a sine value

For rotations, the cosine value replaces the 1 in the affected vectors.
For rotation around the x vector, we get:

  matrix <1,0,0, 0,sC,0, 0,0,sC, 0,0,0>

The sine values need to be plugged in; I visualize what a y-vector will
do when rotated as I desire (ie, whether it moves in the +z or -z
direction), and put the appropriate value into the matrix:

  matrix <1,0,0, 0,sC,sS, 0,-sS,sC, 0,0,0>
    // rotate x*degrees(atan2(sC,sS))

I can throw in my scaling as I go,

  matrix <sV,0,0, 0,sC,sS, 0,-sS,sC, 0,0,0> // scale <sV,1,1>

And then the translation,

  matrix <sV,0,0, 0,sC,sS, 0,-sS,sC, tX,tY,tZ>  // translate <tX,tY,tZ>

I generally don't try to multiply two matrices in my head or on paper,
unless I am reasonably sure that the product matrix will be as simple as
the multiplicands.  It's just as easy to invoke the two matrices in
succession.

That's enough brain calories for one day...
-- 
ICQ: 46085459


Post a reply to this message

From: Nieminen Juha
Subject: Re: Matrices
Date: 8 Sep 1999 07:04:13
Message: <37d642ad@news.povray.org>
Tony Vigil <tvi### [at] emc-inccom> wrote:
: Hmmm.  I didn't realize that would work in POV since it doesn't work that
: way in Moray.

  That's one of the reasons why some people dislike modellers. They are
always limited.
  For example, you can't make multiple transformations to the same object,
inverse objects, loops with mathematical functions, etc, etc.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Bob Hughes
Subject: Re: Matrices
Date: 8 Sep 1999 11:12:09
Message: <37d67cc9@news.povray.org>
I agree wholeheartedly.  Take for instance my recent light bulb
making.  I tried to use the fine lathe/sor editing program Spiliner
yet ended up continuing to fix it up in POV-Ray after getting the
model made.  I've tried many modelers over the past several years and
I always end up with a draft getting done.  However there will always
be times when a modeling program can be very important since not
everything is easily handmade, some things not at all possible.  I can
at least say that I have one solitary sPatch modelled object (no Moray
or anything else) which helped me complete a much larger model, my
Seattle Space Needle.  The part is a curved and twisted section of the
tripod (hexpod, I like to call it) but the rest is straight sections.
Of course most everything else I've done doesn't seem to require
things I can't do in the POV-Ray editor anyway and that is probably
more a vice not a virtue, if you get what I mean.

Bob

Nieminen Juha <war### [at] cctutfi> wrote in message
news:37d642ad@news.povray.org...
> Tony Vigil <tvi### [at] emc-inccom> wrote:
> : Hmmm.  I didn't realize that would work in POV since it doesn't
work that
> : way in Moray.
>
>   That's one of the reasons why some people dislike modellers. They
are
> always limited.
>   For example, you can't make multiple transformations to the same
object,
> inverse objects, loops with mathematical functions, etc, etc.
>
> --
>
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i
]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*-
Warp -*/


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 1 Messages >>>

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