From d6bb200a9c1d0e08bdb52e63ece3127e983c3c36 Mon Sep 17 00:00:00 2001 From: dlegland Date: Mon, 2 Aug 2021 12:03:59 +0200 Subject: [PATCH] geom3d/drawPlane3d.m: add support for drawing multiple planes at once --- matGeom/geom3d/drawPlane3d.m | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/matGeom/geom3d/drawPlane3d.m b/matGeom/geom3d/drawPlane3d.m index 724f0ce2..98955ab3 100644 --- a/matGeom/geom3d/drawPlane3d.m +++ b/matGeom/geom3d/drawPlane3d.m @@ -1,16 +1,19 @@ function h = drawPlane3d(plane, varargin) -%DRAWPLANE3D Draw a plane clipped by the current axes. +% Draw a plane clipped by the current axes. % % drawPlane3d(PLANE) draws a plane of the format: % [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2] % -% drawPlane3d(...,'PropertyName',PropertyValue,...) sets the value of the -% specified patch property. Multiple property values can be set with -% a single statement. See function patch for details. +% drawPlane3d(..., 'PropertyName', PropertyValue,...) +% Sets the value of the specified patch property. Multiple property +% values can be set with a single statement. See the function "patch" for +% details. % -% drawPlane3d(AX,...) plots into AX instead of GCA. +% drawPlane3d(AX,...) +% plots into AX instead of GCA. % -% H = drawPlane3d(...) returns a handle H to the patch object. +% H = drawPlane3d(...) +% returns a handle H to the patch object. % % Example % @@ -25,11 +28,11 @@ % set(gcf, 'renderer', 'zbuffer'); % % See also -% planes3d, createPlane, patch +% planes3d, createPlane, patch % ------ % Author: David Legland -% e-mail: david.legland@inra.fr +% e-mail: david.legland@inrae.fr % INRA - TPV URPOI - BIA IMASTE % created the 17/02/2005. % @@ -39,6 +42,21 @@ % 2011-07-19 fix a bug for param by Xin KANG (Ben) % +% add support for drawing multiple planes at once +if size(plane, 1) > 1 + nPlanes = size(plane, 1); + hp = zeros(nPlanes, 1); + for iPlane = 1:nPlanes + hp(iPlane) = drawPlane3d(plane(iPlane, :), varargin{:}); + end + + if nargout > 0 + h = hp; + end + + return; +end + % Parse and check inputs valFun = @(x) size(x,1)==1 && isPlane(x); defOpts.FaceColor = 'm';