Arborescent曲线

来源:互联网 发布:iptv管理系统源码下载 编辑:程序博客网 时间:2024/06/11 19:53

讲道理,我不确定有没有这东西,不过名字什么的并不重要。

以钝角三角形为单位,将原三角形中间减一个裂口,分为两个与原三角形相似的小三角形,不断重复下去得到Arborescent曲线。


function draw_Arborescent_Curve(P1, P2, P3, N, options)% Arboresent_Curve 的基本单位是等腰钝角三角形% P1是三角形顶点(必须是1*2的向量),P2,P3 是底边的两端点,N是递归层数% options(1):线段宽度% options(2:4):线段颜色default_options = [3 0 1 0];if nargin == 4options = default_options;endLineWidth = options(1);Color = options(2:4);if N == 1    plot([P1(1) P2(1) P3(1) P1(1)], [P1(2) P2(2) P3(2) P1(2)], ...        'Color', Color, 'LineWidth', LineWidth, 'EraseMode', 'none');else    mid = (P3 - P2) * sum((P1-P2).^2) / sum((P2-P3).^2);    L = P2 + mid;    R = P3 - mid;    draw_Arboresent_Curve(L, P2, P1, N-1, options);    draw_Arboresent_Curve(R, P3, P1, N-1, options);end

两条对称的Arborescent曲线就构成了Arborescent肺。


function Arborescent_Lung(N)% N 是迭代次数fig = figure('NumberTitle','off','name','Arborescent肺','MenuBar','none');set(fig, 'color', [255 235 215]/255);axis equal;axis off; hold on;alpha = pi/25;beta = pi*2/9;A = [cos(beta) sin(beta); -sin(beta) cos(beta) ];P1 = [sin(alpha+beta) cos(alpha+beta)];P2 = [0 0];P3 = P1 * A * 2*cos(beta);draw_Arborescent_Curve(P1, P2, P3, N);draw_Arborescent_Curve(P1.*[-1 1], P2.*[-1 1], P3.*[-1 1], N);

其实仔细观察一下,Arborescent曲线就是扩展的Kohn曲线。


fig = figure('NumberTitle','off','name','对比','MenuBar','none');set(fig, 'color', [255 235 215]/255);axis equal;axis off; hold on;alpha = pi/25;beta = pi*2/9;draw_Kohn_Curve([sin(alpha) cos(alpha)], [0 0], N, [3 2*beta 0 1 0]);draw_Kohn_Curve([0 0], [-sin(alpha) cos(alpha)], N, [3 2*beta 0 1 0]);


0 0