⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gm_circ_approx.m

📁 算断裂的
💻 M
字号:
function [verts,codes] = gm_circ_approx(startang, endang, numsubdiv) % gm_circ_approx: produce bezier curves to approximate a circular arc%   [vtx,code] = gm_circ_approx(startang, endang, numsubdiv)% startang, endang are the starting and ending angles of the% arc (in radians), numsubdiv is the number of divisions.% Produce a degree-3 bezier spline curve approximating a unit% circle arc.totalarc = endang - startang;onearc = totalarc / numsubdiv;p = 1.0 / tan(onearc / 2);p1 = 1 + 1 / p^2;alpha = (sqrt(3 * p1 + 1) - 1) / (1.5 * p1);r1 = sqrt((1-alpha)^2 + (p + alpha / p)^2) / sqrt(1 + p^2);a1 = atan(alpha / p);verts = zeros(numsubdiv * 3 + 1, 2);codes = zeros(numsubdiv * 3 + 1, 1);for j = 1 : numsubdiv  baseang = startang + onearc * (j - 1);  ang1 = baseang + a1;  ang2 = baseang + onearc - a1;  verts(3 * j - 2, :) = [cos(baseang), sin(baseang)];  verts(3 * j - 1, :) = [r1 * cos(ang1), r1 * sin(ang1)];  verts(3 * j, :) = [r1 * cos(ang2), r1 * sin(ang2)];  if j == 1    codes(3 * j - 2 : 3 * j) = [1;3;3];  else    codes(3 * j - 2 : 3 * j) = [2;3;3];  end  verts(3 * numsubdiv + 1,:) = [cos(endang),sin(endang)];  codes(3 * numsubdiv + 1) = 1;end % ------------------------------------------------------------------% Copyright (c) 1999 by Cornell University.  All rights reserved.% See the accompanying file 'Copyright' for authorship information,% the terms of the license governing this software, and disclaimers% concerning this software.% ------------------------------------------------------------------% This file is part of the QMG software.  % Version 2.0 of QMG, release date September 3, 1999% ------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -