geom2d
Editor's Note: This file was selected as MATLAB Central Pick of the Week
Geometry library to handle and visualize geometric primitives such as points, lines, circles and ellipses, polylines and polygons...
The goal is to provide a low-level library for manipulating geometrical primitives, making easier the development of more complex geometric algorithms.
The library proposes functions to:
* create various shapes (points, circles, lines, ellipses, polylines, polygons) using an intuitive syntax. Ex: createCircle(p1, p2, p3) to create a circle through 3 points, create parallel and perpendicular lines
* compute intersections between 2 lines, between a line and a circle
* work on polylines and polygons: compute centroid and area, expand, clip with half-plane...
* measure distances (between points, a point and a line, a point and a group of points), angle (of a line, between 3 points), or test geometry (point on a line, on a circle).
* manipulate planar transformations. Ex: P2 = transformPoint(P1, createRotation(CENTER, THETA));
* draw shapes easily. Ex: drawCircle([50 50], 25), drawLine([X0 Y0 DX DY]). Some clipping is performed for infinite shapes such as lines or rays.
Additional help is provided in geom/Contents.m file, as well as summary files like 'points2d.m' or 'lines2d.m'.
Note: the project has merged with the geom3d library (FeX 24484), and is now hosted on GitHub: https://github.com/mattools/matGeom
Cite As
David Legland (2022). geom2d (https://www.mathworks.com/matlabcentral/fileexchange/7844-geom2d), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired by: Minimum Enclosing Circle, Curve intersections
Inspired: Split Line Segments (Edges), Geometric and Topological Methods for Significance Testing in Wavelet Analysis, Cumulative Areawise Testing in Wavelet Analysis, Chord Length Distribution from Binary 2D Images, image ellipsoid 3D, imMinkowski, Generate random line segments without intersecting
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.