help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tetramesh alternative?


From: Bart Vandewoestyne
Subject: Re: tetramesh alternative?
Date: Wed, 7 Jul 2010 22:21:36 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Jul 06, 2010 at 09:31:53PM +0200, Martin Helm wrote:
>
> Here is a very primitive implementation of tetramesh
> 
> function tetramesh( T, X, C)
>   if nargin < 3
>      C = mod((1:size(T, 1))'-1, size(colormap(), 1) + 1);
>   endif
>   triang = [T(:, 1) T(:, 2) T(:, 3); ...
>             T(:, 2) T(:, 3) T(:, 4); ...
>             T(:, 3) T(:, 4) T(:, 1); ...
>             T(:, 4) T(:, 1) T(:, 2)];
>   patch("Faces", triang, "Vertices", X, "FaceVertexCData", [C; C; C; C])
> endfunction
> 
> which gives with the example above:
> 
> backend("fltk")
> d = [-1 1];
> [x,y,z] = meshgrid(d,d,d);
> x = [x(:);0];
> y = [y(:);0];
> z = [z(:);0];
>  
> tetra = delaunay3(x,y,z);
> X = [x(:) y(:) z(:)];
> tetramesh(tetra, X)
> view(30,30)

Thanks for this suggestion, Martin.  I didn't test it myself, but
my students did, and they seemed happy :-)

Thanks!
Bart

-- 
        "Share what you know.  Learn what you don't."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]