POV-Ray : Newsgroups : povray.newusers : Prisms with conic sweeps and unpredictable results : Re: Prisms with conic sweeps and unpredictable results Server Time
4 Nov 2024 19:16:00 EST (-0500)
  Re: Prisms with conic sweeps and unpredictable results  
From: Hughes, B 
Date: 28 May 2003 17:21:30
Message: <3ed5285a@news.povray.org>
"Mike Williams" <mik### [at] econymdemoncouk> wrote in message
news:XZ6Z4EABqP1+Ewa### [at] econymdemoncouk...
> Wasn't it LibraryMan who wrote:
> >
> >How much should the object get translated downward for its base to be at
> >y=0? And would scaling the object along y affect where its base lay?
>
> If you can't work it out, you could try using trace()

Good idea. However, this is a problem about transformation order.

By putting translate before scale is making -0.85*y move by four times, so
what's needed is the common scale, rotate, translate ordering to keep that
from happening. Doing so makes it like this: "height 2" is at 1*y (the
ever-widening conic sweep shape's top, starting from a point at 0 regardless
of "height 1"), becoming 4*y next, then turned upside down to become -4*y,
and finally moved upward by 4*y.

  prism {
    conic_sweep
    linear_spline
    .85, // height 1
    1, // height 2 [is +y*1 here]
    5, // the number of points making up the shape...
    <4,4>,<-4,4>,<-4,-4>,<4,-4>,<4,4>
    scale <1, 4, 1> // will move height 2 by this multiple
    rotate <180, 0, 0> // upside-down
    translate <0, 4, 0> // final move to 0*y
    pigment { gradient y scale .201 }
  }

Please notice that the pigment scaling here is to circumvent pattern/surface
alignments, since it would have created unwanted artifacts where the object
and pattern are equally positioned. Reason in this case: 4 times 0.15 equals
0.6, making exactly 3 repeats of the gradient.

Curious thing about this though is that I had thought all such patterns were
changed to shift them slightly to stop this from happening. I know the
'checker ' pattern was, anyway. Oh well, something to think about again.

Bob H.


Post a reply to this message

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