meshGrid

Purpose

Generate X-Y grid for 2D bounded polyhedra.

Syntax

[X,Y] = P.meshGrid
[X,Y] = P.meshGrid(N)
[X,Y] = meshGrid(P,N)

Description

Generates X-Y grid points for plotting of two-dimensional polyhedra. Supported are only bounded and lower-dimensional polyhedra. The output from this function is consistent with Matlab "meshgrid" function used for plotting functions over 2D polyhedra. The argument to this function is the number of points used to grid the polyhedron, default value is 20.

Input Arguments

P

Polyhedron given by V- or H-representation in dimension 2.

Class: Polyhedron

N

The number of points for gridding. The value must be positive and integer-valued.

Class: double

Default: 20

Output Arguments

X

Matrix with x-coordinates of the grid values.

Class: double

Y

Matrix with y-coordinates of the grid values.

Class: double

Example(s)

Example 1

Define random polyhedron P in 2D.
 P = ExamplePoly.randVrep; 
Grid the polyhedron 
[X,Y] = P.meshGrid; 
 Define Z coordinate as ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/meshgrid1.png. 
 Z=10./(1+exp((X-Y).^2)); 
Plot the Polyhedron and the Z values.
 plot(P,'color','limegreen','alpha',0.4); hold on; surf(X,Y,Z); view(3); 

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/meshgrid_img_1.png

See Also

grid, plot, fplot


© 2010-2013 Colin Neil Jones: EPF Lausanne, colin.jones@epfl.ch

© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch