POV-Ray : Newsgroups : povray.general : Difference object that cant be scaled Server Time
6 Nov 2024 18:25:24 EST (-0500)
  Difference object that cant be scaled (Message 1 to 8 of 8)  
From: lars petter
Subject: Difference object that cant be scaled
Date: 26 Apr 2004 07:07:57
Message: <408ced8d@news.povray.org>
Hi. I've got this difference object:

difference {   // a cylinder subtracted with another cylinder with smaller
radius -> a ring

        cylinder {
          <5, 0, 5>,
          <5, 1, 5>,
          1
          pigment { rgb <1, 0, 0> }
        }

       cylinder {
          <5, 0, 5>,
          <5, 1, 5>,
          0.9
          open
       }
    //scale <2,1,1>   is this the right place to insert the scaling?

}

if i try to scale it in x- or z- direction, the object simply fails to show
in the render. scaling i y-direction however, works fine.

why is this?

-greets,
    lars petter


Post a reply to this message

From: Christoph Hormann
Subject: Re: Difference object that cant be scaled
Date: 26 Apr 2004 07:20:02
Message: <c6ir4a$4he$1@chho.imagico.de>
lars petter wrote:
> [...]
> 
> if i try to scale it in x- or z- direction, the object simply fails to show
> in the render. scaling i y-direction however, works fine.

You seem to have a wrong idea what 'scale' does.  What you probably want is:

difference {
   cylinder { <0,0,0>, <0,1,0>, 1 }
   cylinder { <0,0,0>, <0,1,0>, 0.9 }
   scale <2,1,1>
   translate <5,0,5>
}

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 21 Mar. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Ger
Subject: Re: Difference object that cant be scaled
Date: 26 Apr 2004 07:33:59
Message: <408cf3a7@news.povray.org>
lars petter wrote:

> Hi. I've got this difference object:
> 
> difference {   // a cylinder subtracted with another cylinder with smaller
> radius -> a ring
> 
>         cylinder {
>           <5, 0, 5>,
>           <5, 1, 5>,
>           1
>           pigment { rgb <1, 0, 0> }
>         }
> 
>        cylinder {
>           <5, 0, 5>,
>           <5, 1, 5>,
>           0.9
>           open
>        }
>     //scale <2,1,1>   is this the right place to insert the scaling?
> 
> }
> 
> if i try to scale it in x- or z- direction, the object simply fails to
> show in the render. scaling i y-direction however, works fine.
> 
> why is this?
> 
Because your scaling scales the position of the cylinder. It's still there
but has moved to <10,0,5> (Scaled x by 2)
Better would be to define your object at the origin <0,0,0> and then
translate it to where you want it to be.
So
difference {
    cylinder { <0, 0, 0>, <0, 1, 0>, 1 }
// Make the inner cylinder longer then the outer one to avoid
// accidental surfaces
    cylinder { <0,-1, 0>, <0, 2, 0>, 0.9 }
// Move the pigment out of the cylinder definition so they both use it
    pigment { rgb <1, 0, 0> }
// Here you apply scaling
    scale < 2, 1, 1 >
// Last you apply translation
    translate < 5, 0, 5 >
    //scale <2,1,1>   is this the right place to insert the scaling? Nope :)
}



-- 
Ger


Post a reply to this message

From: Francois Labreque
Subject: Re: Difference object that cant be scaled
Date: 26 Apr 2004 07:50:58
Message: <408cf7a2@news.povray.org>
Program ended abnormally on 26/04/2004 07:07, Due to a catastrophic lars petter 
error:

> Hi. I've got this difference object:
> 
> difference {   // a cylinder subtracted with another cylinder with smaller
> radius -> a ring
> 
>         cylinder {
>           <5, 0, 5>,
>           <5, 1, 5>,
>           1
>           pigment { rgb <1, 0, 0> }
>         }
> 
>        cylinder {
>           <5, 0, 5>,
>           <5, 1, 5>,
>           0.9
>           open
>        }
>     //scale <2,1,1>   is this the right place to insert the scaling?
> 
> }
> 
> if i try to scale it in x- or z- direction, the object simply fails to show
> in the render. scaling i y-direction however, works fine.
> 
> why is this?
> 
Others have already explained why.

You also have the problem of coincident surfaces as the ends of your first and 
second cylinders are at the same place you should do:

difference {
   cylinder { <0,0,0>, <0,1,0>, 1 }
   cylinder { <0,-1,0>, <0,2,0>, 0.9 }
   scale <2,1,1>
   translate <5,0,5>
   pigment { rgb <1, 0, 0> }
}

This way, you will be certain that you object looks like a tube and does not 
have artifacts at the ends.

Secondly, you put the pigment on your first cylinder only.  This makes the 
second one have the "default" texture (black by default), so the inside of your 
tube would be black, not red.  If you want the whole tube to be red, move the 
pigment to the end of the difference block, like I did above.

-- 
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/*    flabreque    */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/*        @        */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/*   videotron.ca  */}camera{orthographic location<6,1.25,-6>look_at a }


Post a reply to this message

From: Phil Cook
Subject: Re: Difference object that cant be scaled
Date: 26 Apr 2004 12:19:16
Message: <opr62nkrnmp4ukzs@news.povray.org>
On Mon, 26 Apr 2004 13:07:56 +0200, lars petter <lar### [at] higno> 
wrote:

> Hi. I've got this difference object:
>
> difference {   // a cylinder subtracted with another cylinder with 
> smaller
> radius -> a ring
>
>         cylinder {
>           <5, 0, 5>,
>           <5, 1, 5>,
>           1
>           pigment { rgb <1, 0, 0> }
>         }
>
>        cylinder {
>           <5, 0, 5>,
>           <5, 1, 5>,
>           0.9
>           open
>        }
>     //scale <2,1,1>   is this the right place to insert the scaling?
>
> }
>
> if i try to scale it in x- or z- direction, the object simply fails to 
> show
> in the render. scaling i y-direction however, works fine.
>
> why is this?
>
> -greets,
>     lars petter

I've also been caught out by this; the help file states that scale is used 
to change the size of an object or texture pattern with a origin sphere 
example. IMHO an additional non-origin sphere to demonstrate how it also 
affects the vector location(s) would make this a bit more obvious. The way 
scale works makes sense if you stop and think about it, but it's not 
something you you might stop and think of :)

Actually I'll post this to povray.documentation.inbuilt as a suggestion.

--
Phil Cook

-- 
All thoughts and comments are my own unless otherwise stated and I am 
happy to be proven wrong.


Post a reply to this message

From: lars petter
Subject: Re: Difference object that cant be scaled
Date: 26 Apr 2004 12:36:17
Message: <408d3a81$1@news.povray.org>
Me so stupid=)

Thanks for the help!



-    Lars Petter


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Difference object that cant be scaled
Date: 26 Apr 2004 13:28:56
Message: <408d46d8@news.povray.org>
In article <opr62nkrnmp4ukzs@news.povray.org> , Phil Cook 
<phi### [at] nospamdeckingdealscouk>  wrote:

> I've also been caught out by this; the help file states that scale is used
> to change the size of an object or texture pattern with a origin sphere
> example. IMHO an additional non-origin sphere to demonstrate how it also
> affects the vector location(s) would make this a bit more obvious. The way
> scale works makes sense if you stop and think about it, but it's not
> something you you might stop and think of :)

Well, even if you don't think about it, you should know that there has to be
some center of scaling.  And once you start thinking about where that center
could be, you eventually starting thinking about how scaling does work ;-)

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Phil Cook
Subject: Re: Difference object that cant be scaled
Date: 27 Apr 2004 05:14:00
Message: <opr63yj0e0p4ukzs@news.povray.org>
On Mon, 26 Apr 2004 19:28:55 +0200, Thorsten Froehlich <tho### [at] trfde> 
wrote:

> In article <opr62nkrnmp4ukzs@news.povray.org> , Phil Cook
> <phi### [at] nospamdeckingdealscouk>  wrote:
>
>> I've also been caught out by this; the help file states that scale is 
>> used
>> to change the size of an object or texture pattern with a origin sphere
>> example. IMHO an additional non-origin sphere to demonstrate how it also
>> affects the vector location(s) would make this a bit more obvious. The 
>> way
>> scale works makes sense if you stop and think about it, but it's not
>> something you you might stop and think of :)
>
> Well, even if you don't think about it, you should know that there has 
> to be
> some center of scaling.  And once you start thinking about where that 
> center
> could be, you eventually starting thinking about how scaling does work 
> ;-)

Which is how I worked it out, but only after being giving a large nudge in 
the right direction. After that of course it's obvious.*

However by that measure it's obvious that there has to be some common 
point of rotation for objects and that it is obviously the origin so all 
the warnings and notes about how rotation works should be removed from the 
help file :P

--
Phil Cook

*Well at least how it appears to work from the users perspective I don't 
want to get into an argument with Christoph Hormann about how POVRay 
really does it :)

-- 
All thoughts and comments are my own unless otherwise stated and I am 
happy to be proven wrong.


Post a reply to this message

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