1 %% Copyright (c) 2011, INRA
2 %% 2007-2011, David Legland <david.legland@grignon.inra.fr>
3 %% 2011 Adapted to Octave by Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
5 %% All rights reserved.
6 %% (simplified BSD License)
8 %% Redistribution and use in source and binary forms, with or without
9 %% modification, are permitted provided that the following conditions are met:
11 %% 1. Redistributions of source code must retain the above copyright notice, this
12 %% list of conditions and the following disclaimer.
14 %% 2. Redistributions in binary form must reproduce the above copyright notice,
15 %% this list of conditions and the following disclaimer in the documentation
16 %% and/or other materials provided with the distribution.
18 %% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 %% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 %% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 %% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 %% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 %% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 %% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 %% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 %% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 %% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 %% POSSIBILITY OF SUCH DAMAGE.
30 %% The views and conclusions contained in the software and documentation are
31 %% those of the authors and should not be interpreted as representing official
32 %% policies, either expressed or implied, of copyright holder.
35 %% @deftypefn {Function File} geom2d_Contents ()
36 %% Geometry 2D Toolbox
37 %% Version 1.2.0 21-Oct-2011 .
39 %% Library to handle and visualize geometric primitives such as points,
40 %% lines, circles and ellipses, polygons...
42 %% The goal is to provide a low-level library for manipulating geometrical
43 %% primitives, making easier the development of more complex geometric
46 %% Most functions works for planar shapes, but some ones have been
47 %% extended to 3D or to any dimension.
50 %% points2d - Description of functions operating on points
51 %% clipPoints - Clip a set of points by a box
52 %% centroid - Compute centroid (center of mass) of a set of points
53 %% midPoint - Middle point of two points or of an edge
54 %% isCounterClockwise - Compute relative orientation of 3 points
55 %% polarPoint - Create a point from polar coordinates (rho + theta)
56 %% angle2Points - Compute horizontal angle between 2 points
57 %% angle3Points - Compute oriented angle made by 3 points
58 %% angleSort - Sort points in the plane according to their angle to origin
59 %% distancePoints - Compute distance between two points
60 %% minDistancePoints - Minimal distance between several points
61 %% transformPoint - Transform a point with an affine transform
62 %% drawPoint - Draw the point on the axis.
65 %% vectors2d - Description of functions operating on plane vectors
66 %% createVector - Create a vector from two points
67 %% vectorNorm - Compute norm of a vector, or of a set of vectors
68 %% vectorAngle - Angle of a vector, or between 2 vectors
69 %% normalizeVector - Normalize a vector to have norm equal to 1
70 %% isPerpendicular - Check orthogonality of two vectors
71 %% isParallel - Check parallelism of two vectors
72 %% transformVector - Transform a vector with an affine transform
73 %% rotateVector - Rotate a vector by a given angle
76 %% lines2d - Description of functions operating on planar lines
77 %% createLine - Create a straight line from 2 points, or from other inputs
78 %% medianLine - Create a median line between two points
79 %% cartesianLine - Create a straight line from cartesian equation coefficients
80 %% orthogonalLine - Create a line orthogonal to another one.
81 %% parallelLine - Create a line parallel to another one.
82 %% intersectLines - Return all intersection points of N lines in 2D
83 %% lineAngle - Computes angle between two straight lines
84 %% linePosition - Position of a point on a line
85 %% lineFit - Fit a straight line to a set of points
86 %% clipLine - Clip a line with a box
87 %% reverseLine - Return same line but with opposite orientation
88 %% transformLine - Transform a line with an affine transform
89 %% drawLine - Draw the line on the current axis
91 %% Edges (line segments between 2 points)
92 %% edges2d - Description of functions operating on planar edges
93 %% createEdge - Create an edge between two points, or from a line
94 %% edgeToLine - Convert an edge to a straight line
95 %% edgeAngle - Return angle of edge
96 %% edgeLength - Return length of an edge
97 %% midPoint - Middle point of two points or of an edge
98 %% edgePosition - Return position of a point on an edge
99 %% clipEdge - Clip an edge with a rectangular box
100 %% reverseEdge - Intervert the source and target vertices of edge
101 %% intersectEdges - Return all intersections between two set of edges
102 %% intersectLineEdge - Return intersection between a line and an edge
103 %% transformEdge - Transform an edge with an affine transform
104 %% drawEdge - Draw an edge given by 2 points
105 %% drawCenteredEdge - Draw an edge centered on a point
108 %% rays2d - Description of functions operating on planar rays
109 %% createRay - Create a ray (half-line), from various inputs
110 %% bisector - Return the bisector of two lines, or 3 points
111 %% clipRay - Clip a ray with a box
112 %% drawRay - Draw a ray on the current axis
114 %% Relations between points and lines
115 %% distancePointEdge - Minimum distance between a point and an edge
116 %% distancePointLine - Minimum distance between a point and a line
117 %% projPointOnLine - Project of a point orthogonally onto a line
118 %% pointOnLine - Create a point on a line at a given position on the line
119 %% isPointOnLine - Test if a point belongs to a line
120 %% isPointOnEdge - Test if a point belongs to an edge
121 %% isPointOnRay - Test if a point belongs to a ray
122 %% isLeftOriented - Test if a point is on the left side of a line
125 %% circles2d - Description of functions operating on circles
126 %% createCircle - Create a circle from 2 or 3 points
127 %% createDirectedCircle - Create a directed circle
128 %% intersectCircles - Intersection points of two circles
129 %% intersectLineCircle - Intersection point(s) of a line and a circle
130 %% circleAsPolygon - Convert a circle into a series of points
131 %% circleArcAsCurve - Convert a circle arc into a series of points
132 %% isPointInCircle - Test if a point is located inside a given circle
133 %% isPointOnCircle - Test if a point is located on a given circle.
134 %% enclosingCircle - Find the minimum circle enclosing a set of points.
135 %% radicalAxis - Compute the radical axis (or radical line) of 2 circles
136 %% drawCircle - Draw a circle on the current axis
137 %% drawCircleArc - Draw a circle arc on the current axis
140 %% ellipses2d - Description of functions operating on ellipses
141 %% inertiaEllipse - Inertia ellipse of a set of points
142 %% isPointInEllipse - Check if a point is located inside a given ellipse
143 %% ellipseAsPolygon - Convert an ellipse into a series of points
144 %% drawEllipse - Draw an ellipse on the current axis
145 %% drawEllipseArc - Draw an ellipse arc on the current axis
147 %% Geometric transforms
148 %% transforms2d - Description of functions operating on transforms
149 %% createTranslation - Create the 3*3 matrix of a translation
150 %% createRotation - Create the 3*3 matrix of a rotation
151 %% createScaling - Create the 3*3 matrix of a scaling in 2 dimensions
152 %% createHomothecy - Create the the 3x3 matrix of an homothetic transform
153 %% createBasisTransform - Compute matrix for transforming a basis into another basis
154 %% createLineReflection - Create the the 3x3 matrix of a line reflection
155 %% fitAffineTransform2d - Fit an affine transform using two point sets
158 %% angles2d - Description of functions for manipulating angles
159 %% normalizeAngle - Normalize an angle value within a 2*PI interval
160 %% angleAbsDiff - Absolute difference between two angles
161 %% angleDiff - Difference between two angles
162 %% deg2rad - Convert angle from degrees to radians
163 %% rad2deg - Convert angle from radians to degrees
166 %% boxes2d - Description of functions operating on bounding boxes
167 %% intersectBoxes - Intersection of two bounding boxes
168 %% mergeBoxes - Merge two boxes, by computing their greatest extent
169 %% randomPointInBox - Generate random point within a box
170 %% drawBox - Draw a box defined by coordinate extents
172 %% Various drawing functions
173 %% drawBezierCurve - Draw a cubic bezier curve defined by 4 control points
174 %% drawParabola - Draw a parabola on the current axis
175 %% drawOrientedBox - Draw centered oriented rectangle
176 %% drawRect - Draw rectangle on the current axis
177 %% drawArrow - Draw an arrow on the current axis
178 %% drawLabels - Draw labels at specified positions
179 %% drawShape - Draw various types of shapes (circles, polygons...)
182 %% squareGrid - Generate equally spaces points in plane.
183 %% hexagonalGrid - Generate hexagonal grid of points in the plane.
184 %% triangleGrid - Generate triangular grid of points in the plane.
185 %% crackPattern - Create a (bounded) crack pattern tessellation
186 %% crackPattern2 - Create a (bounded) crack pattern tessellation
190 %% * function 'enclosingCircle' rewritten from a file from Yazan Ahed
191 %% , available on Matlab File Exchange
195 function geom2d_Contents ()
197 help('geom2d_Contents');
199 %% Deprecated functions
201 % createMedian - create a median line
202 % minDistance - compute minimum distance between a point and a set of points
203 % homothecy - create a homothecy as an affine transform
204 % rotation - return 3*3 matrix of a rotation
205 % translation - return 3*3 matrix of a translation
206 % scaling - return 3*3 matrix of a scaling in 2 dimensions
207 % lineSymmetry - create line symmetry as 2D affine transform
208 % vecnorm - compute norm of vector or of set of vectors
209 % normalize - normalize a vector
210 % onCircle - test if a point is located on a given circle.
211 % inCircle - test if a point is located inside a given circle.
212 % onEdge - test if a point belongs to an edge
213 % onLine - test if a point belongs to a line
214 % onRay - test if a point belongs to a ray
215 % invertLine - return same line but with opposite orientation
216 % clipLineRect - clip a line with a polygon
217 % formatAngle - Ensure an angle value is comprised between 0 and 2*PI
221 % drawRect2 - Draw centered rectangle on the current axis