1## Copyright (C) 2021 David Legland 2## All rights reserved. 3## 4## Redistribution and use in source and binary forms, with or without 5## modification, are permitted provided that the following conditions are met: 6## 7## 1 Redistributions of source code must retain the above copyright notice, 8## this list of conditions and the following disclaimer. 9## 2 Redistributions in binary form must reproduce the above copyright 10## notice, this list of conditions and the following disclaimer in the 11## documentation and/or other materials provided with the distribution. 12## 13## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS'' 14## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16## ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 17## ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23## 24## The views and conclusions contained in the software and documentation are 25## those of the authors and should not be interpreted as representing official 26## policies, either expressed or implied, of the copyright holders. 27 28function drawPartialPatch(u, v, z, varargin) 29%DRAWPARTIALPATCH draw surface patch, with 2 parametrized surfaces. 30% 31% usage : 32% drawSurfPatch(u, v, zuv) 33% where u, v, and zuv are three matrices the same size, u and 34% corresponding to each parameter, and zuv being equal to a function of u 35% and v. 36% 37% drawSurfPatch(u, v, zuv, p0) 38% If p0 is specified, two lines with u(p0(1)) and v(p0(2)) are drawn on 39% the surface 40% 41% 42% --------- 43% 44% author : David Legland 45% INRA - TPV URPOI - BIA IMASTE 46% created the 24/05/2005. 47% 48 49% HISTORY 50% 2005-06-08 add doc. 51% 2007-01-04 remove unused variables and change function name 52% 2010-03-08 code cleanup, use drawPolyline3d 53 54% prepare figure 55hold on; 56 57% draw the surface interior 58surf(u, v, z, 'FaceColor', 'g', 'EdgeColor', 'none'); 59 60% draw the surface boundaries 61drawPolyline3d(u(1,:), v(1,:), z(1,:)) 62drawPolyline3d(u(end,:), v(end,:), z(end,:)) 63drawPolyline3d(u(:,end), v(:,end), z(:,end)) 64drawPolyline3d(u(:,1), v(:,1), z(:,1)) 65 66% eventually draw two perpendicular lines on the surface 67if ~isempty(varargin) 68 pos = varargin{1}; 69 drawPolyline3d(u(pos(1),:), v(pos(1),:), z(pos(1),:)); 70 drawPolyline3d(u(:,pos(2)), v(:,pos(2)), z(:,pos(2))); 71end 72