2009-11-11 12:15:36 UTC
if one can shading a surface according to the specified weights which just like some heat sources?
for the plane, I finded a way, it is similar to the filesurface.asy. Can we draw it without througth the 3D?
the data.txt is :
1 3 4 5
0 1.4 2 3
1.0 1.0 1.0 2.0
0.2 0.3 0.5 0.7
0.5 0.7 0.2 0.4
2 1.5 0.9 1.0
====================================
settings.render=0;
import graph3;
import palette;
size(200);
file in=input("data.txt").line();
real[] x=in;
real[] y=in;
real[][] z=in.dimension(0,0);
surface s=surface(z,(min(x),min(y)),(max(x),max(y)),Spline);
s.colors(palette(s.map(zpart), Rainbow()));
draw(s,nolight);
//draw(planeproject(unitsquare3)*s,nolight);
currentprojection=orthographic(0,0,1);
limits((0,0,0),(1.1*max(x),1.1*max(y),1.1*max(z)));
xaxis3("$x$",OutTicks(),Arrow3(),above=true);
yaxis3("$y$",OutTicks(),Arrow3(),above=true);
for the general surface, I don't know how to do. it seems difficult to constructed the temperature distrubution function real(triple v) according to the specified heat sources.
import palette;
import graph3;
size(200);
currentprojection=orthographic(1,1,1);
triple[] P={
(2, 0, 0),
(-2, 0, 0),
(0, 2, 0),
(4, 0, 4),
(0, 4, 4),
(-4, 0, 4)
};
path3 p1=P[0]..P[2]..P[1];
path3 p2=P[3]..P[4]..P[5];
surface sur=extrude(p1,p2);
real[][] weights={
{5,15},
{20,12},
{10,8},
};
real distribution(triple v){return sin(v.x*v.z);}//??????
sur.colors(palette(sur.map(distribution),Rainbow()));
draw(sur);
draw(planeproject(unitsquare3)*sur);
axes3("$x$","$y$","$z$",Arrow3());