POV-Ray : Newsgroups : povray.newusers : simple way to flaten a 'tube' : Re: simple way to flaten a 'tube' Server Time
25 Apr 2024 17:15:46 EDT (-0400)
  Re: simple way to flaten a 'tube'  
From: Alain
Date: 30 Nov 2015 16:43:18
Message: <565cc2f6@news.povray.org>

> Is there a simpler way to flatten a tube, besides using a box with tubes on
> either side?
>
>
If "tube" = a cylinder, then:

cylinder{30*x, -30*x, 5 scale <1, 0.5, 1>}
Will give you an elliptic cylinder that is half as high as it is whide.

But, if you want it to have flat faces, then, you need to use an union 
as follow:

union{
	box{<Left, Top, Front><Right, Bottom, Back>}
	cylinder{<Left, (Top+Bottom)/2, Front><Left, (Top+Bottom)/2, Back>, 
(Top+Bottom)/2}
		cylinder{<Right, (Top+Bottom)/2, Front><Right, (Top+Bottom)/2, Back>, 
(Top+Bottom)/2}
}

If that is to be transparent, replace "union" by "merge" to remove the 
internal surfaces.

If you are OK with having hard edges and rounded parts that don't make a 
half circle, then, you can do this:
intersection{
	cylinder{<0, 0, Front><0,0, Back>, Radius}
	box{<-Radius, 1, Front+0.0001><Radius, -1, Back-0.0001>}
}

The box is made very slightly larger to prevent coincident surfaces and 
the artefacts they cause.



Alain


Post a reply to this message

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