POV-Ray : Newsgroups : povray.newusers : Odd transformation of cylinders Server Time
23 Nov 2024 03:14:53 EST (-0500)
  Odd transformation of cylinders (Message 1 to 6 of 6)  
From: Cyningstan
Subject: Odd transformation of cylinders
Date: 11 Aug 2020 01:35:00
Message: <web.5f322ce4e7e86bcf88e55160@news.povray.org>
I'm not "new" to POV-Ray but returning to it after a number of years. But this
problem I've run into is definitely in newbie territory.

I'm building up a basic scene currently using only spheres and cylinders. The
spheres are acting as I'd expect, but the cylinders are having an odd
transformation applied to them that I have to undo. They're all being rotated
-45 degrees around the X axis, and translated down by whatever their radius is.
For example:

camera {
  location <0, 0, -10>
  look_at  <0, 0,  0>
}

cylinder {
  <0 0 -1.25>
  <0 0 1.25>
  1
}

This isn't the full scene; I've omitted lighting and textures for brevity. I'd
expect to be looking at this cylinder end-on, but it's actually rotated -45
degrees and moved down -1, so I'm looking at the top side. I have to bring it
back to where I expect with the following:

  rotate <+45 0 0>
  translate <0 0 +1>

My 0.5 radius cylinders need translating up +0.5 on the Z axis, and all
cylinders need a +45 degree correction on the X axis.

Neither the tutorial nor the reference section on the cylinder give me any clue
as to why this weird transformation is being applied to all my cylinders, and I
don't remember having this problem last time I built a scene about seven years
ago. Is there something obvious I'm missing?

Thanks!


Post a reply to this message

From: Thomas de Groot
Subject: Re: Odd transformation of cylinders
Date: 11 Aug 2020 02:38:25
Message: <5f323ce1@news.povray.org>
Op 11/08/2020 om 07:30 schreef Cyningstan:
> 
> For example:
> 
> camera {
>    location <0, 0, -10>
>    look_at  <0, 0,  0>
> }
> 
> cylinder {
>    <0 0 -1.25>
>    <0 0 1.25>
>    1
> }

Not sure if this is the cause, but I am missing the ",". To be 
unambiguous, you should write:

cylinder {
   <0, 0, -1.25>,
   <0, 0, 1.25>,
   1
}

> 
> This isn't the full scene; I've omitted lighting and textures for brevity. I'd
> expect to be looking at this cylinder end-on, but it's actually rotated -45
> degrees and moved down -1, so I'm looking at the top side. I have to bring it
> back to where I expect with the following:
> 
>    rotate <+45 0 0>
>    translate <0 0 +1>

Same here:

rotate <45, 0, 0>
translate <0, 0, 1>

> 
> My 0.5 radius cylinders need translating up +0.5 on the Z axis, and all
> cylinders need a +45 degree correction on the X axis.
> 
> Neither the tutorial nor the reference section on the cylinder give me any clue
> as to why this weird transformation is being applied to all my cylinders, and I
> don't remember having this problem last time I built a scene about seven years
> ago. Is there something obvious I'm missing?
> 
> Thanks!
> 
> 


-- 
Thomas


Post a reply to this message

From: Cyningstan
Subject: Re: Odd transformation of cylinders
Date: 11 Aug 2020 04:20:01
Message: <web.5f32545b60013892f88e55160@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:

> Not sure if this is the cause, but I am missing the ",". To be
> unambiguous, you should write:

Thanks, Thomas! You're absolutely right, it was the missing commas. I made the
mistake in one place and then copied and adapted it all over the place without
noticing.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Odd transformation of cylinders
Date: 11 Aug 2020 04:30:37
Message: <5f32572d@news.povray.org>
Op 11/08/2020 om 10:18 schreef Cyningstan:
> 
> Thomas de Groot <tho### [at] degrootorg> wrote:
> 
>> Not sure if this is the cause, but I am missing the ",". To be
>> unambiguous, you should write:
> 
> Thanks, Thomas! You're absolutely right, it was the missing commas. I made the
> mistake in one place and then copied and adapted it all over the place without
> noticing.
> 
> 

Excellent! I have a dim memory of an explanation some time ago by Alain 
Martel about /why/ omitting the commas is ambiguous. I cannot find it 
presently.

-- 
Thomas


Post a reply to this message

From: Alain Martel
Subject: Re: Odd transformation of cylinders
Date: 11 Aug 2020 12:23:45
Message: <5f32c611$1@news.povray.org>
Le 2020-08-11 à 01:30, Cyningstan a écrit :
> 
> I'm not "new" to POV-Ray but returning to it after a number of years. But this
> problem I've run into is definitely in newbie territory.
> 
> I'm building up a basic scene currently using only spheres and cylinders. The
> spheres are acting as I'd expect, but the cylinders are having an odd
> transformation applied to them that I have to undo. They're all being rotated
> -45 degrees around the X axis, and translated down by whatever their radius is.
> For example:

> cylinder {
>    <0 0 -1.25>
>    <0 0 1.25>
>    1
> }
> 

This get interpreted as :
cylinder{<0, 0-1.25> <0,0,1.25> 1}

You can ignore the comas, but only in unambiguous cases. Whenever you 
have a negative value, the coma is mandatory in front of it.

There was a time, prior to version 3.0, where the space was a hard 
separator and when your way of defining the vector was interpreted as 
<0,0,-1.25>. It's been over 30 years that it's no longer the case.


Post a reply to this message

From: Leroy
Subject: Re: Odd transformation of cylinders
Date: 16 Aug 2020 13:35:00
Message: <web.5f396dbc600138921420b9440@news.povray.org>
We've all done something like this at one time or another.
Those commas hide sometimes!

Have fun!


Post a reply to this message

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