|
|
...
> Now the next trick will be to draw an arbitrary curve on said
> surface.
...
See my code below for a way to draw simple functions on an
uv-mapped surface.
It shouldn't be very difficult to add a coordinate grid to
the surface pigment too.
Tor Olav
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare LW = 0.01; // Line Width
#declare SelFn =
function(A) {
select(A, select(A + LW/2, 0, 1), select(A - LW/2, 1, 0))
}
#declare OneLineFn = function(u, v) { SelFn(v - u) }
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare DrawFn =
function(u) { 0.5 + 0.25*sin(4*pi*u) + 0.25*cos(5*pi*u) }
//#declare DrawFn = function(u) { 0.5 + 0.5*sin(2*pi*u) }
bicubic_patch {
type 0
flatness 0.01
u_steps 4
v_steps 4
<0, 0, 0>, <1, 0, 0>, <2, 0, 0>, <3, 0, 0>,
<0, 1, 0>, <1, 1, 0>, <2, 1, 0>, <3, 1, 0>,
<0, 2, 0>, <1, 2, 0>, <2, 2, 0>, <3, 2, 0>,
<0, 3, 0>, <1, 3, 0>, <2, 3, 0>, <3, 3, 0>
uv_mapping
texture {
pigment {
function { OneLineFn(DrawFn(u), v) }
color_map {
[ 0 color rgb <1, 1, 1> ]
[ 1 color rgb <1, 0, 0> ]
}
}
}
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
camera {
location <1.5, 1.5, -4>
look_at <1.5, 1.5, 0>
}
light_source {
<1, 1, -3>*100
color rgb <1, 1, 1>
shadowless
}
background { color blue 0.5 }
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
Post a reply to this message
|
|