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

📄 gmviz.m

📁 算断裂的
💻 M
字号:
function gmviz(obj, color, vizdim)%% GMVIZ: plot a brep or simplicial complex in matlab or VRML%% gmviz(obj {, color {, vizdim }});%% Displays an object.  The object is either a brep or simplicial%% complex.  The object is either displayed in the%% matlab graphics window or is sent to a file in VRML1.0 format, %% and may be automatically loaded by a web browser.  The%% selection of the graphics engine is controlled by gmvizgui.%% Argument color is either a string with%% one or more color letters, e.g., 'rw' for%% red white, or a matrix with a 4-element color spec per row.%% vizdim is the dimension or dimensions to plot.  The number%% of colors specified must be the same as the number of dimensions%% specified.  See the documentation for more information.%% A second calling format is %% gmviz({simpcomp,brep} {, vizcolor {, vizdim}})%% in which case the simplicial complex colors are derived%% from the brep color specifications.if nargin < 1  error('gmviz requires at least one argument');end[l1,l2] = size(obj);if l1 * l2 == 2  pair = 1;  vizobj = obj{1};  obj2 = obj{2};else  pair = 0;  vizobj = obj;endif ~isa(vizobj,'zba')  error('Object passed to gmviz not a zba');endif length(vizobj) < 1  error('Object passed to gmviz not an simpcomp or brep');endglobal GM_BREP_TYPE_CODEglobal GM_SIMPCOMP_TYPE_CODEtypecode = double(vizobj{0});if strcmpi(typecode, GM_BREP_TYPE_CODE)  objtype = 1;elseif  strcmpi(typecode, GM_SIMPCOMP_TYPE_CODE)  objtype = 2;else  error('Object passed to gmviz not an simpcomp or brep');endif pair & objtype == 1  error('In calling format gmviz({a,b}), a must be a simpcomplex');enderrmsg2 = 'In calling format gmviz({a,b}), b must be a brep';if pair == 1  if ~isa(obj2, 'zba')    error(errmsg2)  end  if length(obj2) < 1    error(errmsg2)  end  if ~strcmpi(double(obj2{0}), GM_BREP_TYPE_CODE)    error(errmsg2)  endenddi = double(vizobj{2});gdim = double(vizobj{1});if gdim < 0  error('Object to plot has no faces')endif di ~= 2 & di ~= 3  error('Object to gmviz must have dimension 2 or 3')endbbox = 1e307 * [ones(di,1),-ones(di,1)];[engine, filename, filestat, notify, format, ... thickness, default_color, beziersub] = gmvizgui_get_state(di);if nargin < 2  color = default_color;endif nargin < 3  vizdim = min(gdim, di - 1);endfor p = 1 : length(vizdim)  if vizdim(p) < 0 | vizdim(p) > gdim    error('Viz dimension out of range')  endendif (isstr(color))  colorn = [];  for j = 1 : length(color)    if color(j) == 'y'      color1 = [1,1,0,1];    elseif color(j) == 'm'      color1 = [1,0,1,1];    elseif color(j) == 'c'      color1 = [0,1,1,1];    elseif color(j) == 'r'      color1 = [1,0,0,1];    elseif color(j) == 'g'      color1 = [0,1,0,1];    elseif color(j) == 'b'      color1 = [0,0,1,1];    elseif color(j) == 'w'      color1 = [1,1,1,1];    elseif color(j) == 'k'      color1 = [0,0,0,1];    elseif color(j) == 'i'      color1 = [0,0,0,0];    else      error('Unknown color name')    end    colorn = [colorn; color1];  endelse  colorn = color;end[colrow,colcol] = size(colorn);if colcol ~= 4   error('color spec must have 4 entries')endif colrow ~= length(vizdim)  error('Number of colors must equal number of dimensions')endfor k = 1 : length(vizdim)  if pair    [pts,simps,cols] = gm_vizp(vizobj, obj2, colorn(k,:), ...                               vizdim(k), beziersub);  else    [pts,simps,cols] = gm_vizp(vizobj,  colorn(k,:), ...                               vizdim(k), beziersub);  end  bbox = gmviz_update_bbox(bbox, pts);endif bbox(1,1) > bbox(1,2)  error('No objects to plot')endif strcmpi(engine,'local')  handle1 = gmviz_init_matlabplot(bbox);else  handle1 = gmviz_init_vrmlplot(bbox, filename, filestat);endfor k = 1 : length(vizdim)  if pair    [pts,simps,cols] = gm_vizp(vizobj, obj2, colorn(k,:), ...                               vizdim(k), beziersub);  else    [pts,simps,cols] = gm_vizp(vizobj,  colorn(k,:), ...                               vizdim(k), beziersub);  end  if strcmpi(engine,'local')    gmviz_matlabplot(handle1, bbox, pts, simps, cols, vizdim(k), thickness);  else    gmviz_vrmlplot(handle1, bbox, pts, simps, cols, vizdim(k), thickness);  endendif strcmpi(engine,'local')  gmviz_terminate_matlabplot(handle1);else  gmviz_terminate_vrmlplot(handle1, filename, notify);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 + -