matlab
# MatGeom
MATLAB geometry processing library in 2D/3D.
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7799184.svg)](https://doi.org/10.5281/zenodo.7799184)
**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](https://github.com/mattools/matGeom/releases/download/v1.2.7/matGeom-manual-1.2.7.pdf)
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](https://mattools.github.io/matGeom/api/index.html).
The MatGeom library corresponds to the concatenation of the
"[geom2d](https://fr.mathworks.com/matlabcentral/fileexchange/7844-geom2d)"
and
"[geom3d](https://fr.mathworks.com/matlabcentral/fileexchange/24484-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](https://github.com/mattools/matGeom/wiki/geom2d "geom2d Wiki page") - General functions in Euclidean plane
* [polygons2d](https://github.com/mattools/matGeom/wiki/polygons2d "polygons2d Wiki page") - Functions operating on polygons and polylines represented as list of vertices
* [graphs](https://github.com/mattools/matGeom/wiki/graphs "graphs Wiki page") - Manipulation of geometric graphs
* [geom3d](https://github.com/mattools/matGeom/wiki/geom3d "geom3d Wiki page") - General functions in 3D Euclidean space
* [meshes3d](https://github.com/mattools/matGeom/wiki/meshes3d "meshes3d Wiki page") - 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](https://github.com/mattools/matGeom/blob/master/docs/images/demo_geom2d_iris.png)
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.](https://github.com/mattools/matGeom/blob/master/docs/images/leafPoly_variousOps.png)
没有合适的资源?快使用搜索试试~ 我知道了~
2D3D几何计算的Matlab几何工具箱.zip
共1278个文件
m:944个
png:255个
html:36个
0 下载量 130 浏览量
2024-03-08
00:18:48
上传
评论 1
收藏 4.68MB ZIP 举报
温馨提示
matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!
资源推荐
资源详情
资源评论
收起资源包目录
2D3D几何计算的Matlab几何工具箱.zip (1278个子文件)
matGeom.bib 13KB
exempleVoronoi.eps 13KB
testGraph03.eps 10KB
testGraph02.eps 10KB
testGraph01.eps 10KB
exempleCracks.eps 9KB
exemplePoissonLines.eps 8KB
exempleVoronoi.fig 17KB
exempleCracks.fig 4KB
lines3d.fig 3KB
exemplePoissonLines.fig 3KB
demoCutMeshByPlane.html 14KB
demo_polygons_leaf.html 11KB
triangleDemo.html 11KB
demoRevolutionSurface.html 10KB
drawSoccerBall.html 10KB
drawSampleGraphs.html 10KB
demo_ellipse_creation.html 9KB
demoRemoveMeshFaces.html 9KB
demoInertiaEllipsoid.html 8KB
demo_geom2d_iris.html 8KB
demo_registerPoints3d_icp_bunny.html 8KB
demoIntersectPlaneMesh.html 8KB
demoGeom3d.html 8KB
demoTriangulatePolygonPair3d_SquareStar.html 8KB
demo_intersectPlaneMesh_bunny.html 8KB
demoVoronoiCell.html 8KB
demoIntersectLineMesh3d.html 7KB
createTrefoilKnot.html 7KB
demoExpandPolygon.html 7KB
demoPolyhedra.html 7KB
check_subdivideMesh.html 6KB
demoNapoleon.html 6KB
drawPoissonLines.html 5KB
demoDrawTubularMesh.html 5KB
demoOnionPeeling.html 5KB
drawCrackPattern2.html 5KB
drawCrackPattern.html 5KB
drawVoronoi.html 4KB
demoTriangulateFaces.html 4KB
demoMedialAxis.html 4KB
showTestGraph03.html 4KB
showTestGraph02.html 4KB
checkClipLine.html 4KB
checkClipRay.html 4KB
showTestGraph01.html 4KB
checkClipPoints.html 4KB
matGeom-manual.lyx 300KB
Contents.m 15KB
readMesh_ply.m 15KB
checkHeader.m 13KB
Contents.m 12KB
registerPoints3d_icp.m 12KB
distancePointMesh.m 11KB
Contents.m 10KB
fitEllipse3d.m 10KB
Contents.m 10KB
clipMesh2dPolygon.m 10KB
meshReduce.m 10KB
test_eulerAngles.m 9KB
intersectPlaneMesh.m 8KB
Contents.m 8KB
meshCurvatures.m 8KB
test_polygonSecondAreaMoments.m 7KB
clipPolygonByLine.m 7KB
rotation3dToEulerAngles.m 7KB
minDistancePoints.m 7KB
drawCircle3d.m 6KB
centroidalVoronoi2d_MC.m 6KB
drawArrow3d.m 6KB
drawGraph.m 6KB
drawEllipse3d.m 6KB
subdivideMesh.m 6KB
drawEllipsoid.m 6KB
triangulatePolygonPair3d.m 6KB
clipGraph.m 6KB
distancePointTriangle3d.m 6KB
polylineSelfIntersections.m 6KB
mergeCoplanarFaces.m 6KB
drawCylinder.m 5KB
drawDome.m 5KB
readMesh_obj.m 5KB
test_clipEdge.m 5KB
fitCircle3d.m 5KB
test_distancePointMesh.m 5KB
crackPattern.m 5KB
grShortestPath.m 5KB
intersectLinePolygon.m 5KB
drawMesh.m 5KB
intersectPolylines.m 5KB
createPlane.m 5KB
drawCapsule.m 5KB
imageGraph.m 5KB
intersectEdges.m 5KB
polygonSkeleton.m 5KB
createLine.m 5KB
centroidalVoronoi2d.m 5KB
test_intersectEdges.m 4KB
test_intersectLineCylinder.m 4KB
intersectLineCylinder.m 4KB
共 1278 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
若明天不见
- 粉丝: 1w+
- 资源: 272
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功