|
![](/i/fill.gif) |
Wasn't it Chrisir who wrote:
>
>
>Hello!
>
>I am still struggling with my arcs I wanted to have like an up-side-down U
>(see posting some weeks back).
>
>I started with a spline, placing spheres on it, but this is far to slow to
>render since I have *a lot* of those arcs. Is there any quick arc? Maybe
>originated from a torus or some other trick?
>
>I like them in a right-angle above my plane,
>give the start-point P1 and end-point P2 and a certain height h.
>
>A macro with three parameters P1,P2,h would be cool!
>
>Thanks!
Here's a simplified version of what I posted back then that used three
functions. Instead of using functions, this just calculates the values
directly in the macro.
#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location <0,2,-10> look_at <0,2,0> angle 20}
background {rgb 1}
light_source {<-30, 100, -30> color rgb 1}
#macro Arch(P1,P2,H)
union {
#local ctr = 0;
#while (ctr < 1)
#local XX=P1.x+(P2.x-P1.x)*ctr;
#local YY=P1.y+(P2.y-P1.y)*ctr + sin(ctr*pi)*H;
#local ZZ=P1.z+(P2.z-P1.z)*ctr;
sphere {
<XX,YY,ZZ>, .05
}
#local ctr = ctr + 0.01;
#end
pigment { rgb <0.5,1,0> }
}
#end
// Invoke the macro
Arch(<-.87,1.05,-.85>, <.64, 1.1,.6>, 1.5)
The above produces a sinusoidal arch. For a parabolic arch replace
"+ sin(ctr*pi)*H;" with "+ 4*(ctr-ctr*ctr)*H;". For an elliptical arch,
replace it with "+ 2*sqrt(ctr-ctr*ctr)*H;".
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
![](/i/fill.gif) |