|
![](/i/fill.gif) |
"John Greenwood" <nomail@nomail> wrote:
> scott <sco### [at] scott com> wrote:
> >
> > How would you go about doing the union (or difference) of two rounded
> > cubes? I tried to modify the code to do this but couldn't get it to
> > work. If that works nicely then I think you're on to something...
> >
> > BTW you could always use a macro for each element, that depending on
> > some global switch, either used the standard POV non-rounded primitive
> > (for speed of setting up the scene) or the isosurface variant (for final
> > render).
>
> I think I have a plan!
>
> Meanwhile here are some cylinders:
And, more exciting, bendy cylinders!
// This work is licensed under the Creative Commons Attribution 3.0 Unported
License.
// To view a copy of this license, visit
http://creativecommons.org/licenses/by/3.0/
// or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain
View,
// California, 94041, USA.
// Demonstration of Bendy Cylinder elements for rounded objects
// Vers: 1.00
// Date: 19 Sept 2016
// Auth: John Greenwood
#version 3.7 ;
#include "colors.inc"
camera {location <5,10,17> angle 10 look_at <0,0,0> }
background { color rgb<0.2, 0.4, 0.8> }
light_source {<5,10,20> color White}
global_settings {assumed_gamma 1.0 }
#declare R_function = function( F,q,p,n){
select((F>q)-(F<-q),2*(q<0)-1,p*pow(F/q,5)-(2*p+.5)*pow(F/q,3)+(1.5+p)*F/q,1-2*(q<0))+n
}
isosurface {
function {
R_function(-sqrt(pow(y-.6+.1*x-.1*pow(x,3), 2)+pow(z,2))+
..2,-.1,0,-1)
+R_function(-sqrt(pow(y+1.5,2)+pow(z,2))+1.9,-.1,0,-1)
+R_function(x+1.5,-.1,0,1)
+R_function(x-1.5,+.1,0,1)
+R_function(y ,-.5,0,1)
}
threshold -1
max_gradient 20
contained_by { box { -2, 2 } }
texture {pigment {color rgb < 1, 0.9, 0.65>}}
translate < 0,-.5,0> }
// note that the cross section is a vertical circle, which means that it will be
elliptical on a plane perpendicular to the cuved axis.
// I think this can be compensated for by taking the slope of the curve into
account.
// I have not worked out the details but I think this is a route to sphere
sweeps.
Post a reply to this message
|
![](/i/fill.gif) |