|
![](/i/fill.gif) |
"John Greenwood" <joh### [at] john-greenwood co uk> wrote:
> I am working on a way to have a union of two R_objects with a rounding of its
> own that swamps that of the components. It is a bit more complicated than what I
> have done so far.
I am struggling with this, I may ask for help in a new topic.
> I also think we could have hypobolic corners, ie, would be assymptopic to two
> intersecting plane surfaces.
This however works. I have tidied up the workings a bit and added two new types
of corner profile, a flat bevel and the hyperbolic corner.
In this example the corner profile parameter takes a value from -1 to +1. The
whole number values are special cases, +1 gives a hyperbolic corner and -1 gives
a flat bevel with sharp corners. In between putting this parameter just more
than -1 gives a rounded bevel and increasing to just less than 1 makes it
increasingly rounded, with nearly circular at a value of .6
// 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 R_objects elements for rounded objects
// Vers: 1.00
// Date: 03 Oct 2016
// Auth: John Greenwood
#version 3.7 ;
#include "colors.inc"
camera {location <4,10,30> angle 10 look_at <0,0,0> }
background { color rgb<0.2, 0.4, 0.8> }
light_source {<10,5,10> color White}
global_settings {assumed_gamma 1.0 }
#declare R_function = function( F,p){
select((p+.999) , select((F>1)-(F<-1) , -1 , F , 1)+1
, select(p-1 , select((F>1)-(F<-1) , -1 ,
..5*p*pow(F,5)-(p+.5)*pow(F,3)+(1.5+.5*p)*F , 1)+1
,F/(sqrt(.25+pow(F,2))) +1
) )
}
#declare Corner_Profile1 = +1; // = p in the above equations
#declare Corner_Profile2 = -1; // = p in the above equations
// p = -1 sharp bevel and p = +1 gives hyperbolic corner. Between these, as p
increases, the corner goes from a nearly flat getting increasingly rounded with
nearly circular at p = +.6
#declare Corner_round1 = .5;
#declare Corner_round2 = .5;
isosurface {
function {
-R_function((x+1.5)/Corner_round1,Corner_Profile1)
+R_function((x-1.5)/Corner_round2,Corner_Profile2)
+R_function((y-1.5)/Corner_round2,Corner_Profile2)
-R_function((y+1.5)/Corner_round1,Corner_Profile1)
+R_function((z-1.5)/Corner_round2,Corner_Profile2)
-R_function((z+1.5)/Corner_round1,Corner_Profile1)
+5
}
threshold 0
max_gradient 20
contained_by { box { -2.2, 2.2 } }
texture {pigment {color rgb < 1, 0.9, 0.65>}}
}
Post a reply to this message
|
![](/i/fill.gif) |