matGeom

버전 1.2.7 (2.16 MB) 작성자: David Legland
A collection of functions for 2D and 3D geometric computing.
다운로드 수: 644
업데이트 날짜: 2023/12/20

MatGeom

MATLAB geometry processing library in 2D/3D.

MatGeom is a library for geometry processing / geometric computing with MATLAB in 2D and 3D. MatGeom is a “function-based” library: it contains several hundreds of functions for the creation, manipulation and display of 2D and 3D shapes such as point sets, lines, ellipses, polygons, 3D polygonal meshes, ... The official homepage for the project is http://github.com/mattools/matGeom.

A user manual containing a large number of illustrations and examples is available. Starting from February 2022, the HTML pages of the functions (obtained with m2html) are available here.

The MatGeom library corresponds to the concatenation of the "geom2d" and "geom3d" libraries that were distributed on the FileExchange. Distribution as a single library greatly facilitates the interoperability of the functions.

If you use matGeom, you might cite it as follows:

David Legland et al. (2023) "MatGeom library for geometric computing with MATLAB" DOI: 10.5281/zenodo.7799184

Package organization

The library is organized into several modules:

  • geom2d - General functions in Euclidean plane
  • polygons2d - Functions operating on polygons and polylines represented as list of vertices
  • graphs - Manipulation of geometric graphs
  • geom3d - General functions in 3D Euclidean space
  • meshes3d - Manipulation of 3D polygonal meshes (trimesh, quadmesh, or more generic meshes)

Quick overview

Basic functionalities comprise creation of simple geometries such as points, lines, ellipses... An example is provided in the following script.

% load data
data = load('fisheriris');
pts = data.meas(:, [3 1]);
% display
figure; axis equal; hold on; axis([0 8 3 9]);
drawPoint(pts, 'bx');
% Fit line
line = fitLine(pts);
drawLine(line, 'color', 'k', 'linewidth', 2);
% Draw oriented box
obox = orientedBox(pts);
drawOrientedBox(obox, 'color', 'k', 'linewidth', 1);
% identifiy species index
[labels, ~, inds]= unique(str.species);
% for ech species, compute equivalent ellipse and display with axes
colors = [1 0 0; 0 0.8 0; 0 0 1];
for i = 1:3
    pts_i = pts(inds == i, :);
    drawPoint(pts_i, 'marker', 'x', 'color', colors(i,:), 'linewidth', 2);
    elli = equivalentEllipse(pts_i);
    drawEllipse(elli, 'color', colors(i,:), 'linewidth', 2)
    drawEllipseAxes(elli, 'color', colors(i,:), 'linewidth', 2)
end

Computation of equivalent ellipses, oriented box, and fitting line from set of points

It is possible to work with more complex shapes such as polygonal lines ("polylines") or polygons. Common operations comprise smoothing, simplification (retaining only a selection of vertices), computation of convex hull or of intersections with other geometric primitives. A summary of typical operations in presented in the following script.

% read polygon data as a numeric N-by-2 array
poly = load('leaf_poly.txt');

% display the polygon using basic color option
figure; axis equal; hold on; axis([0 600 0 400]);
drawPolygon(poly, 'k');

% Bounding box of the polygon
poly_bnd = boundingBox(poly);
drawBox(poly_bnd, 'k');

% computes convex hull of polygon vertices
poly_hull = convexHull(poly);
drawPolygon(poly_hull, 'LineWidth', 2, 'Color', 'k');

% applies smoothing to the original polygon.
poly_smooth = smoothPolygon(poly, 51);
drawPolygon(poly_smooth, 'color', 'b', 'linewidth', 2);

% Computes a simplified version of the polygon
poly_simpl = simplifyPolygon(poly, 20);
drawPolygon(poly_simpl, 'color', 'r', 'linewidth', 2);
drawVertices(poly_simpl, 'Color', 'k', 'Marker', 's', 'MarkerFaceColor', 'w');

% compute intersections with an arbitrary line
line = createLine([0 250], [600 350]);
drawLine(line, 'k');
inters = intersectLinePolygon(line, poly_simpl);
drawPoint(inters, 'Color', 'r', 'Marker', 'o', 'MarkerFaceColor', 'w', 'linewidth', 2);

Summary of polygon processing operations: smoothing, simplification, convex hull, intersection with lines.

인용 양식

David Legland (2024). matGeom (https://github.com/mattools/matGeom/releases/tag/v1.2.7), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2023b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

demos/geom2d

demos/geom2d/triangle

demos/geom3d

demos/meshes3d

matGeom

matGeom/deprecated/geom2d

matGeom/deprecated/geom3d

matGeom/deprecated/graphs

matGeom/deprecated/meshes3d

matGeom/deprecated/polygons2d

matGeom/geom2d

matGeom/geom2d/private

matGeom/geom3d

matGeom/geom3d/private

matGeom/graphs

matGeom/meshes3d

matGeom/meshes3d/private

matGeom/polygons2d

matGeom/polygons2d/private

matGeom/utils

tests

tests/geom2d

tests/geom3d

tests/graphs

tests/meshes3d

tests/meshes3d/tmp

tests/polygons2d

버전 게시됨 릴리스 정보
1.2.7

See release notes for this release on GitHub: https://github.com/mattools/matGeom/releases/tag/v1.2.7

1.2.6.0

See release notes for this release on GitHub: https://github.com/mattools/matGeom/releases/tag/v1.2.6

1.2.5

See release notes for this release on GitHub: https://github.com/mattools/matGeom/releases/tag/v1.2.5

1.2.4

1.2.3.0

See release notes for this release on GitHub: https://github.com/mattools/matGeom/releases/tag/v1.2.3

1.2.2.0

See release notes for this release on GitHub: https://github.com/mattools/matGeom/releases/tag/v1.2.2

1.2.1.0

See release notes for this release on GitHub: https://github.com/mattools/matGeom/releases/tag/v1.2.1

1.2.0.0

See release notes for this release on GitHub: https://github.com/mattools/matGeom/releases/tag/v1.2

1.0.0.0

See release notes for this release on GitHub: https://github.com/mattools/matGeom/releases/tag/v1.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.