POV-Ray : Newsgroups : povray.advanced-users : How to cap a cylinder by a 2d-function? Server Time
22 Dec 2024 12:55:03 EST (-0500)
  How to cap a cylinder by a 2d-function? (Message 1 to 5 of 5)  
From: Kay
Subject: How to cap a cylinder by a 2d-function?
Date: 5 Dec 2016 16:00:00
Message: <web.5845d43ad3f57dfa67f2d6ab0@news.povray.org>
Hey Folks,

I'm trying to code a cylinder, which is capped on one side by a 2d-function. The
2d-function I have in mind is running like a helix with the parameters (x,y,z)
of the form {x=r*Cos[a], y=r*Sin[a], z=a} with r and a, both running from 0 to
1.

How can I do that? I tried Isosurface, but I failed...
Could anyone help out?

Thanks in advance,
Kay


Post a reply to this message

From: Bald Eagle
Subject: Re: How to cap a cylinder by a 2d-function?
Date: 5 Dec 2016 16:20:01
Message: <web.5845d99693354f5bc437ac910@news.povray.org>
"Kay" <uhu### [at] webde> wrote:
> Hey Folks,
>
> I'm trying to code a cylinder, which is capped on one side by a 2d-function. The
> 2d-function I have in mind is running like a helix with the parameters (x,y,z)
> of the form {x=r*Cos[a], y=r*Sin[a], z=a} with r and a, both running from 0 to
> 1.
>
> How can I do that? I tried Isosurface, but I failed...
> Could anyone help out?

See:
http://www.f-lohmueller.de/pov_tut/all_shapes/shapes910e.htm

And Mike Williams' Isosurface tutorial, as well as the POV-Ray docs.

I'd say you need to go from 0 to 2*pi to get a full wrap, and do the "cylinder"
and the cap in 2 parts...


Post a reply to this message

From: Kay
Subject: Re: How to cap a cylinder by a 2d-function?
Date: 5 Dec 2016 16:50:01
Message: <web.5845dffe93354f5b67f2d6ab0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Kay" <uhu### [at] webde> wrote:
> > Hey Folks,
> >
> > I'm trying to code a cylinder, which is capped on one side by a 2d-function. The
> > 2d-function I have in mind is running like a helix with the parameters (x,y,z)
> > of the form {x=r*Cos[a], y=r*Sin[a], z=a} with r and a, both running from 0 to
> > 1.
> >
> > How can I do that? I tried Isosurface, but I failed...
> > Could anyone help out?
>
> See:
> http://www.f-lohmueller.de/pov_tut/all_shapes/shapes910e.htm
>
> And Mike Williams' Isosurface tutorial, as well as the POV-Ray docs.
>
> I'd say you need to go from 0 to 2*pi to get a full wrap, and do the "cylinder"
> and the cap in 2 parts...

You're right, "a" should run from 0 to 2*pi, my bad.
Thanks for your hints! Actually, to my pitty, I already know these tutorials,
without success for me. I was hoping to rebuild this:
http://imgur.com/a/9cISt
with the help of an isosurface. But I do not know, how to get the golden
structure made out of this. I fear any boolean operations aren't accessable with
isosurface. Are they?

Thanks for help!


Post a reply to this message

From: Bald Eagle
Subject: Re: How to cap a cylinder by a 2d-function?
Date: 6 Dec 2016 10:15:00
Message: <web.5846d50e93354f5bc437ac910@news.povray.org>
It seems like the easiest thing to do there is just create a for-next loop and
increment the y position of a short cylinder as you alter the x and z values
with cos and sin functions.

#declare R1 = 5; // radius of spiral
#declare R2= 0.25; // radius of cylinders
#declare Y=0;

#for (t, 0, 2*pi, 0.1)
     #declare X = R1*cos(t);
     #declare Z = R1*sin(t);
     cylinder {<X, Y, Z>, <X, Y+0.5, Z>, R2 pigment {Yellow}}
     #declare Y = Y + 0.1;
#end // end for t


Post a reply to this message

From: Sherry K  Shaw
Subject: Re: How to cap a cylinder by a 2d-function?
Date: 6 Dec 2016 19:21:23
Message: <58475603@news.povray.org>
Kay wrote:

> I fear any boolean operations aren't accessable with
> isosurface. Are they?
>

You can't put an #if statement into a function, but you CAN use the 
result of a comparison as a numeric value in a function.  For example:

f_rounded_box( x*(1+((y/100)*(y>0))), y, z, 6, 36, 78, 12 )

In an isosurface, this creates a rounded box that's straight-sided below 
y=0 and tapers gently above.  (Don't forget to include functions.inc.)

Hope this is useful.

--Sherry Shaw

-- 
#macro T(E,N)sphere{x,.4rotate z*E*60translate y*N pigment{wrinkles scale
.3}finish{ambient 1}}#end#local I=0;#while(I<5)T(I,1)T(1-I,-1)#local I=I+
1;#end camera{location-5*z}plane{z,37 pigment{granite color_map{[.7rgb 0]
[1rgb 1]}}finish{ambient 2}}//                                   TenMoons


Post a reply to this message

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