help-octave
[Top][All Lists]
Advanced

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

Re: tetramesh alternative?


From: Martin Helm
Subject: Re: tetramesh alternative?
Date: Tue, 6 Jul 2010 20:11:30 +0200
User-agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; x86_64; ; )

Am Dienstag, 6. Juli 2010 16:13:47 schrieb Bart Vandewoestyne:
> Hello list,
> 
> I have two students working on M*tl*b code where the tetramesh
> command is used:
> 
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/tetramesh.html
> 
> They would like the code to also run in Octave.  On
> 
> http://wiki.octave.org/wiki.pl?MissingMatlabFunctions
> 
> I have found that tetramesh is currently still missing in Octave.
> 
> Is there a workaround/alternative?  Can they do the visualization
> using another command sequence that would lead to about the same
> result?
> 
> Thanks!
> Bart
> 


Just to give a simple idea, the example from the link above can be rewritten 
in octave with the patch function:

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);                          

## create a triangulation from the tetraeder array
T = [tetra(:, 1) tetra(:, 2) tetra(:, 3); ...
tetra(:, 2) tetra(:, 3) tetra(:, 4); ...
tetra(:, 3) tetra(:, 4) tetra(:, 1); ...
tetra(:, 4) tetra(:, 1) tetra(:, 2)];

X = [x(:) y(:) z(:)];

patch("Faces", T, "Vertices", X, "FaceVertexCData", X)
view(30,30)

Of course I did not use a very intelligent coloring here, just that you can 
see something.

It will also work with the standard gnuplot backend.

So it is easy to make your own tetramesh function.

- mh






reply via email to

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