POV-Ray : Newsgroups : povray.newusers : Turn an arrow : Re: Turn an arrow Server Time
29 Jul 2024 16:32:49 EDT (-0400)
  Re: Turn an arrow  
From: Slime
Date: 23 Jul 2005 18:52:28
Message: <42e2ca2c$1@news.povray.org>
> But, should be a way to turn the cylinder like a half torus and I don't
know
> how can I do it.

I'm not quite sure what you're asking if my reply didn't answer it.

Let's say you had a cylinder, along the Y axis from <0,0,0> to <0,H,0> with
radius R. You want to curl the cylinder by X degrees towards the x-axis. You
could do it like this:

#declare H = 2;
#declare X = 90;
#declare R = .2;

intersection {
    torus {
        // we want X/360 * circumference of torus to equal H
        #declare MajorRad = H*360/(X*2*pi);
        MajorRad,
        // minor radius = cylinder's radius
        R

    }

    #if (X < 180)
        intersection {
    #else
        union {
    #end
        // cut off the bottom
        plane {
            -z,0
        }
        // cut off the other end
        plane {
            z,0
            rotate X*y
        }
    }

    translate MajorRad*x
    rotate -90*x

    pigment {rgb 1}

    rotate 90*x
}

It sounds like you want X = 180 if you want "half a torus." Watch what
happens as you bring X from 0 to 90, 180 and even up to 360.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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