Re: Display Functions defined by Barycentric Coordinates

*To*: mathgroup at smc.vnet.net*Subject*: [mg4786] Re: Display Functions defined by Barycentric Coordinates*From*: rubin at msu.edu (Paul A. Rubin)*Date*: Mon, 16 Sep 1996 23:51:16 -0400*Organization*: Michigan State University*Sender*: owner-wri-mathgroup at wolfram.com

In article <508fp4$14k at dragonfly.wolfram.com>, pyu at leland.Stanford.EDU (Pok-Yin Yu) wrote: -> ->Dear All: -> ->Does anyone have experience on displaying functions ->defined on triangles via barycentric coordinates? -> ->I need to know, for example, how to constrain the ->plotting range to an non-rectangular domain. -> ->thanks, ->Thomas -> -> You can define the function only for those arguments in the domain. For instance, suppose want a function f(x,y) = (x-1)^2 + (y-1)^2, with triangular domain {(x,y) | 1 <= x, 1 <= y, x + y <= 10}. I can do the following: In[]:= f[x_, y_] := (x-3)^2 + (y-3)^2 /; x >= 1 && y >= 1 && x + y <= 10 In[]:= Plot3D[ f[x, y], {x, 0, 10}, {y, 0, 10} ]; Note that f[] is undefined outside my triangle. Plot3D spits up a bunch of diagnostic messages (which you can suppress with the Off[] command if they bother you), then plots the surface. The only catch is that, since the plot elements are rectangles with edges parallel to the x- and y-axes, the diagonal boundary x + y <= 10 makes for a ragged edge to the plot. Try it and you'll see what I mean. -- Paul ************************************************************************** * Paul A. Rubin Phone: (517) 432-3509 * * Department of Management Fax: (517) 432-1111 * * Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU * * Michigan State University * * East Lansing, MI 48824-1122 (USA) * ************************************************************************** Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. J. W. v. GOETHE ==== [MESSAGE SEPARATOR] ====