The Octave Forge package repository is no longer actively maintained. Please find Octave Packages at https://packages.octave.org.

Navigation

Operators and Keywords

Function List:

C++ API

CLIPMESH2DPOLYGON  Clip a planar mesh with a polygon.

   [NODES2, EDGES2, FACES2] = clipMesh2dPolygon(NODES, EDGES, FACES, POLY)
   Clips the graph defined by nodes NODES and edges EDGES with the polygon
   given in POLY. POLY is a N-by-2 array of vertices.
   The result is a new graph containing nodes inside the polygon, as well
   as nodes created by the intersection of edges with the polygon.

   Important: it is assumed that no edge crosses the polygon twice. This
   is the case if the polygon is convex (or nearly convex) and if the
   edges are small compared to the polygon.

   Example
     elli = [50 50 40 20 30];
     figure; hold on;
     drawEllipse(elli, 'k');
     poly = ellipseToPolygon(elli, 200);
     box = polygonBounds(poly);
     germs = randomPointInPolygon(poly, 100);
     drawPoint(germs, 'b.');
     [n, e, f] = boundedVoronoi2d(box, germs);
     [n2, e2, f2] = clipMesh2dPolygon(n, e, f, poly);
     drawGraphEdges(n2, e2);
     fillGraphFaces(n2, f2);

   See also
     graphs, drawGraph, clipGraph

Package: matgeom