image thumbnail

Curve intersections

versión 1.5.0.0 (2.47 KB) por NS
Fast computation of intersections and self-intersections of curves using vectorization.

25,7K descargas

Actualizada24 Sep 2010

VER LICENCIA

While a few other functions already exist in FEX that compute the intersection points of curves, this short piece of code was written with speed being the highest priority. No loops are used throughout, taking full advantage of MATLAB's vectorization capabilities

我欢迎任何评论,建议,错误报告等。

----------------------------------------------------------------------------------------------------------------------------

INTERX Intersection of curves
P = Interx(L1,L2)返回两条曲线L1的交点
and L2. The curves L1,L2 can be either closed or open and are described
by two-row-matrices, where each row contains its x- and y- coordinates.
The intersection of groups of curves (e.g. contour lines, multiply
connected regions etc) can also be computed by separating them with a
NAN的列如

L = [x11 x12 x13 ... NaN x21 x22 x23 ...;
y11 y12 y13 ... NaN y21 y22 y23 ...]

P has the same structure as L1 and L2, and its rows correspond to the
x- and y- coordinates of the intersection points of L1 and L2. If no
intersections are found, the returned P is empty.

P = Interx(L1)返回L1的自我交流点。保持
代码简单,曲线与本身相切的点是
not included. P = INTERX(L1,L1) returns all the points of the curve
together with any self-intersection points.

Example:
t = linspace(0,2*pi);
r1 = sin(4*t)+2; x1 = r1.*cos(t); y1 = r1.*sin(t);
r2 = sin(8*t)+2; x2 = r2.*cos(t); y2 = r2.*sin(t);
P = InterX([x1;y1],[x2;y2]);
plot(x1,y1,x2,y2,P(1,:),P(2,:),'ro')

Citar como

NS(2022)。Curve intersections(//www.tianjin-qmedu.com/matlabcentral/fileexchange/22441-curve-intersections),matlab中央文件交换。recuperado.

Compatibilidad con la versión de MATLAB
Se creó con R2008a
Compatible con cualquier versión
Compatibilidad con las plataformas
视窗 macOS Linux

Community Treasure Hunt

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

开始狩猎!