|
|
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "Alfred Knudson" <nomail@nomail> wrote:
> > How does one draw a parametric curve on a surface, for example the helyx:
> >
> > f(t) - (cos t, sin t, t)
> >
> > on the surface of a cone x^2 + y^2 = 1?
> >
> > I can't seem to find anything about plotting cusrves on the manual.
>
> Hi Alfred
>
> The code below might give you a hint of one way to achieve this.
>...
This may be a better example for you.
You can also replace the cylinder and the spiral objects with isosurfaces.
--
Tor Olav
http://subcube.com
https://github.com/t-o-k
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
/*
Cylinder with parametric spiral pigment
By Tor Olav Kristensen, 2024-09-29
*/
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#version 3.7;
global_settings { assumed_gamma 1.0 }
#include "functions.inc"
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare Tau = 2*pi;
#declare Radius = 1.5;
// Fn(s): <Radius*cos(s), Radius*sin(s), s>
#declare Helix_FnX = function(s) { Radius*cos(s) };
#declare Helix_FnY = function(s) { Radius*sin(s) };
#declare Helix_FnZ = function(s) { s };
#declare N = 1000;
#declare MinT = -2.5*Tau;
#declare MaxT = +2.5*Tau;
#declare dT = (MaxT - MinT)/N;
#declare R = 0.4;
#declare Spiral =
union {
#declare T_Previous = MinT;
#declare pPrevious =
<
Helix_FnX(T_Previous),
Helix_FnY(T_Previous),
Helix_FnZ(T_Previous)
>
;
sphere { pPrevious, R }
#for (I, 0, N - 1)
#declare T_Next = T_Previous + dT;
#declare pNext =
<
Helix_FnX(T_Next),
Helix_FnY(T_Next),
Helix_FnZ(T_Next)
>
;
cylinder { pPrevious, pNext, R }
sphere { pNext, R }
#declare T_Previous = T_Next;
#declare pPrevious = pNext;
#end // for
}
cylinder {
MinT*z, MaxT*z, Radius
pigment {
object {
Spiral
color rgb <0.0, 0.3, 1.0> // Outside
color rgb <1.0, 0.7, 0.0> // Inside
}
}
}
/*
object {
Spiral
pigment { color rgb <1.0, 1.0, 1.0> }
}
*/
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
background { color rgb 0.2*<1, 1, 1> }
light_source {
100*<+1, +3, -1>
color rgb <1, 1, 1>
shadowless
}
camera {
orthographic
location < 0, +3, -8>*2
look_at <0, 0, 0>
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
Post a reply to this message
|
|