File Exchange

image thumbnail

geom2d

version 1.25 (427 KB) by David Legland
Geometry library for matlab. Performs geometric computations on points, lines, circles, polygons...

32.7K Downloads

Updated 26 Sep 2019

View License

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 (2021). geom2d (https://www.mathworks.com/matlabcentral/fileexchange/7844-geom2d), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!

geom2d/demos-geom2d/triangle

geom2d/demos-polygons2d

geom2d/demos-polynomialCurves2d

geom2d/geom2d

geom2d/geom2d/private

geom2d/polygons2d

geom2d/polygons2d/private

geom2d/polynomialCurves2d

geom2d/utils