Octave

From BEMlab
Jump to: navigation, search

Function fill3

Octave does not have fill3 function, but it is used in plot3d and plot3d_vecs bemlab functions, which are used to visualize meshes and BEMLAB results. Therefore fill3 function (wrapper against patch function was created and included in BEMLAB repository.

You can download fill3 function from websvn: fill3.m

After installing BEMLAB you can add path to the fill3, plot3d and plot3d_vecs functions to your startup Octave configuration file:

% cat ~/.octaverc 
path(path(),'~/dokt/repos/bemlab/trunk/share/octave','~/dokt/repos/bemlab/trunk/share/matlab')

Usage:

octave:1> help fill3
 function fill3(x,y,z,c,varargin)

 Example usage: 
       graphics_toolkit("fltk")
       x=[0 1 1 0];
       y=[0 0 1 1];
       z=[0 0 1 1];
       c=[1 2 3 1];  or  c=[1 1 0 0; 1 1 0 0; 1 1 0 0];
       fill3(x,y,z,c)
       fill3(x,y,z,c,'EdgeColor','none')

Requirements

Function fill3 requires fltk graphics toolkit. It was confirmed to work properly in Octave version 3.6.1. To change it follow the following commands:

octave:1>  available_graphics_toolkits
ans =
{
  [1,1] = fltk
  [1,2] = gnuplot
}
octave:2> graphics_toolkit
ans = gnuplot
octave:3> graphics_toolkit("fltk")
octave:4> graphics_toolkit
ans = fltk

Example

Example:

graphics_toolkit("fltk")
x=[0;1;1;0];
y=[0;0;1;1];
z=[0;0;1;1];
c=[1;2;3;1];
fill3(x,y,z,c)
xlabel('x')
ylabel('y')
zlabel('z')
title('TITLE')
colorbar