POV-Ray : Newsgroups : povray.general : Half a cylinder (with open ends) Server Time
29 Jul 2024 12:21:30 EDT (-0400)
  Half a cylinder (with open ends) (Message 11 to 18 of 18)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: B  Gimeno
Subject: Re: Half a cylinder (with open ends)
Date: 26 Jul 2012 13:55:01
Message: <web.5011841dc440f47951f818f50@news.povray.org>
Hello,
maybe I didn't quite understand the question, but there is a reserved keyword to
generate open cylinders. Just add "open" at the end of the statement of the
cylinder.

On the other hand, I started writing a small macro to generate half cylinder
rounded (if that's what I understood) that perhaps could be helpful. This time I
have left over before reaching sixty parameters. Posted in
povray.binaries.images

B. Gimeno


Post a reply to this message

From: Warp
Subject: Re: Half a cylinder (with open ends)
Date: 26 Jul 2012 14:01:03
Message: <501185df@news.povray.org>
Chaanakya <nomail@nomail> wrote:
> Warp <war### [at] tagpovrayorg> wrote:
> > Chaanakya <nomail@nomail> wrote:
> > > I was trying to create half of a hollow cylinder (both ends open).  I tried
> > > using CSG with an intersection, and that gave me a half a hollow cylinder, but
> > > I'd like to not have a plane on the end.  That is, I'd like essentially a curved
> > > plane (the side of the cylinder without the endcaps).  Is there some
> > > transformation I could use on, for example, a box to achieve this?
> >
> > Just make a difference of the cylinder and another cylinder with a slightly
> > smaller radius and which is a bit longer ther the first cylinder.

> Thanks!  That lets me control the thickness of the resulting object.  How would
> I cut it in half?

Ah, I didn't notice that you also wanted to cut it in half. I only paid
attention to your problem of getting the end caps on the cylinder, most
probably because your differenced cylinder was not long enough.

You can cut the hollow cylinder in half by differencing (or intersecting) it
with an appropriately placed and sized box. You just have to figure out the
coordinates (this shouldn't be difficult if your cylinder is on a main axis;
you can translate and rotate it later to its final position).


Post a reply to this message

From: Chaanakya
Subject: Re: Half a cylinder (with open ends)
Date: 26 Jul 2012 14:45:01
Message: <web.50118f3dc440f4797f523b7e0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Chaanakya <nomail@nomail> wrote:
> > Warp <war### [at] tagpovrayorg> wrote:
> > > Chaanakya <nomail@nomail> wrote:
> > > > I was trying to create half of a hollow cylinder (both ends open).  I tried
> > > > using CSG with an intersection, and that gave me a half a hollow cylinder, but
> > > > I'd like to not have a plane on the end.  That is, I'd like essentially a
curved
> > > > plane (the side of the cylinder without the endcaps).  Is there some
> > > > transformation I could use on, for example, a box to achieve this?
> > >
> > > Just make a difference of the cylinder and another cylinder with a slightly
> > > smaller radius and which is a bit longer ther the first cylinder.
>
> > Thanks!  That lets me control the thickness of the resulting object.  How would
> > I cut it in half?
>
> Ah, I didn't notice that you also wanted to cut it in half. I only paid
> attention to your problem of getting the end caps on the cylinder, most
> probably because your differenced cylinder was not long enough.
>
> You can cut the hollow cylinder in half by differencing (or intersecting) it
> with an appropriately placed and sized box. You just have to figure out the
> coordinates (this shouldn't be difficult if your cylinder is on a main axis;
> you can translate and rotate it later to its final position).

Just for posterity, here's how I managed to do this:

difference {
  cylinder { <-1,0,0>,<1,0,0>,1.003}
  cylinder { <-1.00003,0,0>,<1.00003,0,0>,1}
  plane { z,0 }
}

That's for a half-cylinder 0.003 cm thick (I am treating 1 POV-Ray unit as 1
cm).  As you can see Warp, planes work just as well as boxes (it's just a bit
harder to tell which side is 'inside').

Thanks again! :)

- Chaanakya


Post a reply to this message

From: Thomas de Groot
Subject: Re: Half a cylinder (with open ends)
Date: 27 Jul 2012 02:58:08
Message: <50123c00$1@news.povray.org>
On 26-7-2012 17:25, Chaanakya wrote:
I've actually been using the manual pretty heavily ;)

Excellent :-) My /hint/ was half serious. I know from experience that 
some things need to settle down, so to speak, before being properly 
understood. Once you get the knack for it, csg becomes pretty easy 
(although I sometimes meet bewildering situations). Intersection and 
difference may look quite the same in the end and yet one or the other 
may be the preferred solution according to the case at hand. It helps 
(for me) to visualize how to do it in the Real World, with a piece of 
wood for instance.

Thomas


Post a reply to this message

From: B  Gimeno
Subject: Re: Half a cylinder (with open ends)
Date: 27 Jul 2012 13:40:01
Message: <web.5012d1cdc440f47951f818f50@news.povray.org>
"Chaanakya" <nomail@nomail> wrote:
> Thomas de Groot <tho### [at] degrootorg> wrote:
> > On 26-7-2012 16:31, Chaanakya wrote:
> >
> > > Ah I understand.  Thank you!  Is there any way to now cut that object in half
> > > (without ending up with a plane "capping" it)?
> > >
> >
> > Just a hint: maybe this is described in the manual...? It is really
> > worth reading and the writers have done a great job; they must feel
> > frustrated if their work is not appreciated or used...  ;-)
> >
> > Thomas
>
> I did read the manual.  I think I didn't completely understand exactly how CSG
> worked (and clipka cleared that up for me).  Maybe I didn't search thoroughly
> enough.  I did find how to cut a sphere in half somewhere in the manual, and I
> tried copying that at first.  I didn't realize that the reason the cylinder
> looked solid was because of other issues (not cutting the second cylinder out
> properly).  Also, the example given in the manual with the hemisphere uses an
> intersection, and the eventual solution here used a difference.  Yes, it's
> pretty much the same thing, but as I said, I didn't really understand how CSG
> worked.  I've actually been using the manual pretty heavily ;)

Hi,
The best method of teaching isn't give the solution as I have done in my
previous answer, but provide the necessary guidelines to understand the problem
as other users did. So, I apologize for the intrusion and I suggest that you
consider the following:
- In general, never use a fixed value where you can declare a variable.
- Do not declare a variable where you can use a parameter (and write a function
or a macro, in the long run is more profitable)
- Do not repeat code in the same file stage.
- If you get stuck, ask the user community.

Regards,
B. Gimeno


Post a reply to this message

From: peter puzzelaar
Subject: Re: Half a cylinder (with open ends)
Date: 28 Jul 2012 16:45:00
Message: <web.50144ef2c440f47947437ba70@news.povray.org>
"Chaanakya" <nomail@nomail> wrote:
> Hey guys!
>
> I was trying to create half of a hollow cylinder (both ends open).  I tried
> using CSG with an intersection, and that gave me a half a hollow cylinder, but
> I'd like to not have a plane on the end.  That is, I'd like essentially a curved
> plane (the side of the cylinder without the endcaps).  Is there some
> transformation I could use on, for example, a box to achieve this?
>
> Thanks in advance!
>
> - Chaanakya

The object cylinder also comes with the (optional) attribute "open".
When "open" is added, the cylinder will have the caps removed.
Hence this way, no csg needs to be used, and your code will be a tiny bit
simplified.

Peter.


Post a reply to this message

From: Alain
Subject: Re: Half a cylinder (with open ends)
Date: 3 Aug 2012 19:10:32
Message: <501c5a68$1@news.povray.org>

>
> "Chaanakya" <nomail@nomail> wrote:
>> Hey guys!
>>
>> I was trying to create half of a hollow cylinder (both ends open).  I tried
>> using CSG with an intersection, and that gave me a half a hollow cylinder, but
>> I'd like to not have a plane on the end.  That is, I'd like essentially a curved
>> plane (the side of the cylinder without the endcaps).  Is there some
>> transformation I could use on, for example, a box to achieve this?
>>
>> Thanks in advance!
>>
>> - Chaanakya
>
> The object cylinder also comes with the (optional) attribute "open".
> When "open" is added, the cylinder will have the caps removed.
> Hence this way, no csg needs to be used, and your code will be a tiny bit
> simplified.
>
> Peter.
>
>

"open" only remove the end caps. The resulting object have NO thickness 
at all.
If you later use that in some compound object, it can lead to unexpected 
results. It also realy don't play well if your object is transparent, 
especialy if it have an ior, use fading colour, contains any media or 
sits in an environment containing any media or fog.

When you use CSG difference, you can have an open cylinder whose sides 
have an actual thickness.


Alain


Post a reply to this message

From: Frolbo
Subject: Re: Half a cylinder (with open ends)
Date: 20 Sep 2012 14:45:00
Message: <web.505b637bc440f479b8de7b6a0@news.povray.org>
What about making the plane invisible:

intersection {
    cylinder { <-1,0,0>,<1,0,0>,1 open pigment { color Red }}
    box { <-1.1,0,1.1>,<1.1,1.1,-1.1> pigment { color rgbt<0,0,0,1> }}
    pigment { color Red }
}


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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