{"id":15716383,"url":"https://github.com/mattools/matgeom","last_synced_at":"2026-04-01T21:50:44.933Z","repository":{"id":31103681,"uuid":"34662973","full_name":"mattools/matGeom","owner":"mattools","description":"Matlab geometry toolbox for 2D/3D geometric computing","archived":false,"fork":false,"pushed_at":"2025-02-11T13:25:43.000Z","size":10002,"stargazers_count":278,"open_issues_count":14,"forks_count":99,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-16T03:03:10.109Z","etag":null,"topics":["geometric-computing","geometric-shapes","geometry","geometry-library","geometry-processing","matlab","matlab-geometry-toolbox","mesh","mesh-processing","polygon"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-27T11:35:25.000Z","updated_at":"2025-05-15T15:33:47.000Z","dependencies_parsed_at":"2024-07-23T15:04:06.375Z","dependency_job_id":"218fc1e6-3f52-4e21-b736-300b0b6c4606","html_url":"https://github.com/mattools/matGeom","commit_stats":{"total_commits":955,"total_committers":22,"mean_commits":43.40909090909091,"dds":0.6324607329842932,"last_synced_commit":"b95645430e4649bd3e811b603c80b4a6a6ad4105"},"previous_names":["dlegland/matgeom"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattools%2FmatGeom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattools%2FmatGeom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattools%2FmatGeom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattools%2FmatGeom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattools","download_url":"https://codeload.github.com/mattools/matGeom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459083,"owners_count":22074604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geometric-computing","geometric-shapes","geometry","geometry-library","geometry-processing","matlab","matlab-geometry-toolbox","mesh","mesh-processing","polygon"],"created_at":"2024-10-03T21:45:21.410Z","updated_at":"2026-02-19T15:07:45.582Z","avatar_url":"https://github.com/mattools.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MatGeom\nMATLAB geometry processing library in 2D/3D.\n\n[![View matGeom on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://fr.mathworks.com/matlabcentral/fileexchange/107370-matgeom)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7799184.svg)](https://doi.org/10.5281/zenodo.5768192)\n\n**MatGeom** is a library for geometry processing / geometric computing with MATLAB in 2D and 3D. \nMatGeom is a “function-based” library: it contains several hundreds of functions for the creation,\nmanipulation and display of 2D and 3D shapes such as point sets, lines, ellipses, polygons, \n3D polygonal meshes...\nThe official homepage for the project is http://github.com/mattools/matGeom. \n\nA [user manual](https://github.com/mattools/matGeom/releases/download/v1.2.8/matGeom-manual-1.2.8.pdf) \ncontaining a large number of illustrations and examples is available.\nStarting from February 2022, the HTML pages of the functions (obtained with m2html) are available \n[here](https://mattools.github.io/matGeom/api/index.html).\n\nThe MatGeom library corresponds to the concatenation of the \n\"[geom2d](https://fr.mathworks.com/matlabcentral/fileexchange/7844-geom2d)\" \nand \n\"[geom3d](https://fr.mathworks.com/matlabcentral/fileexchange/24484-geom3d)\" \nlibraries that were distributed on the FileExchange. Distribution as a single library greatly \nfacilitates the interoperability of the functions.\n\nThanks to the work of other people (mostly Juan Pablo Carbajal),\na port of MatGeom for the [GNU Octave](https://www.octave.org/) language is available at https://gnu-octave.github.io/packages/matgeom/.\n\nIf you use MatGeom for your research, please be kind enough to cite the following article:\n* [Legland, D. MatGeom: A toolbox for geometry processing with MATLAB](https://www.sciencedirect.com/science/article/pii/S2352711024003546). \n*SoftwareX*, **29**, 101984, (**2025**). DOI:10.1016/j.softx.2024.101984\n\n\n## Package organization\nThe library is organized into several modules:\n* [geom2d](https://github.com/mattools/matGeom/wiki/geom2d \"geom2d Wiki page\") - General functions in Euclidean plane\n* [polygons2d](https://github.com/mattools/matGeom/wiki/polygons2d \"polygons2d Wiki page\") - Functions operating on polygons and polylines represented as list of vertices\n* [graphs](https://github.com/mattools/matGeom/wiki/graphs \"graphs Wiki page\") - Manipulation of geometric graphs\n* [geom3d](https://github.com/mattools/matGeom/wiki/geom3d \"geom3d Wiki page\") - General functions in 3D Euclidean space\n* [meshes3d](https://github.com/mattools/matGeom/wiki/meshes3d \"meshes3d Wiki page\") - Manipulation of 3D polygonal meshes (trimesh, quadmesh, or more generic meshes)\n\n## Quick overview\n\n### Fit geometries to point data\nBasic functionalities comprise creation of simple geometries such as points, lines, ellipses... \nA simple example is provided with the following script.\n\n```matlab\n% load data\niris = load('fisheriris');\npts = iris.meas(:, [3 1]);\n% display\nfigure; axis equal; hold on; axis([0 8 3 9]);\ndrawPoint(pts, 'bx');\n% Fit line\nline = fitLine(pts);\ndrawLine(line, 'color', 'k', 'linewidth', 2);\n% Draw oriented box of whole data set\nobox = orientedBox(pts);\ndrawOrientedBox(obox, 'color', 'k', 'linewidth', 1);\n% identifiy species index\n[labels, ~, inds]= unique(iris.species);\n% for ech species, compute equivalent ellipse and display with axes\ncolors = [1 0 0; 0 0.8 0; 0 0 1];\nfor i = 1:3\n    pts_i = pts(inds == i, :);\n    drawPoint(pts_i, 'marker', 'x', 'color', colors(i,:), 'linewidth', 2);\n    elli = equivalentEllipse(pts_i);\n    drawEllipse(elli, 'color', colors(i,:), 'linewidth', 2)\n    drawEllipseAxes(elli, 'color', colors(i,:), 'linewidth', 2)\nend\n```\n![Computation of equivalent ellipses, oriented box, and fitting line from set of points](docs/images/demo_geom2d_iris.png)\n\n### Polygon data processing\n\nIt is possible to work with more complex shapes such as polygonal lines (\"polylines\") or polygons.\nCommon operations comprise smoothing, simplification (retaining only a selection of vertices), \ncomputation of convex hull or of intersections with other geometric primitives. \nA summary of typical operations in presented in the following script.\n```matlab\n% read polygon data as a numeric N-by-2 array\npoly = load('leaf_poly.txt');\n\n% display the polygon using basic color option\nfigure; axis equal; hold on; axis([0 600 0 400]);\ndrawPolygon(poly, 'k');\n\n% Bounding box of the polygon\npoly_bnd = boundingBox(poly);\ndrawBox(poly_bnd, 'k');\n\n% computes convex hull of polygon vertices\npoly_hull = convexHull(poly);\ndrawPolygon(poly_hull, 'LineWidth', 2, 'Color', 'k');\n\n% applies smoothing to the original polygon.\npoly_smooth = smoothPolygon(poly, 51);\ndrawPolygon(poly_smooth, 'color', 'b', 'linewidth', 2);\n\n% Computes a simplified version of the polygon\npoly_simpl = simplifyPolygon(poly, 20);\ndrawPolygon(poly_simpl, 'color', 'r', 'linewidth', 2);\ndrawVertices(poly_simpl, 'Color', 'k', 'Marker', 's', 'MarkerFaceColor', 'w');\n\n% compute intersections with an arbitrary line\nline = createLine([0 250], [600 350]);\ndrawLine(line, 'k');\ninters = intersectLinePolygon(line, poly_simpl);\ndrawPoint(inters, 'Color', 'r', 'Marker', 'o', 'MarkerFaceColor', 'w', 'linewidth', 2);\n```\n![Summary of polygon processing operations: smoothing, simplification, convex hull, intersection with lines.](docs/images/leafPoly_variousOps.png)\n\n### Polygon mesh processing\n\nThe MatGeom library also provides features for polygon mesh processing.\nMesh data can be retrieved from common mesh file formats, \nor generated from simple data,\nand various operations can be performed: intersections (with lines or planes), clipping by plane, \ndistance to point... \nSeveral measurements on meshes are also provided: main curvatures, surface area, bounding box...\n\n![Summary of polygon mesh processing operations: smoothing, simplification, convex hull, intersection with lines.](docs/images/bunnyMesh_variousOps.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattools%2Fmatgeom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattools%2Fmatgeom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattools%2Fmatgeom/lists"}