PARALLELPLANE Parallel to a plane through a point or at a given distance. PL2 = parallelPlane(PL, PT) Constructs the plane parallel to plane PL and containing the point PT. PL2 = parallelPlane(PL, D) Constructs the plane parallel to plane PL, and located at the given signed distance D. Example % Create a plane normal to the 3D vector DIR dir = [3 4 5]; plane = createPlane([3 4 5], dir); % Create plane at a specific distance plane2 = parallelPlane(plane, 5); % Create a line perpendicular to both planes line = [2 4 1 3 4 5]; pi1 = intersectLinePlane(line, plane); pi2 = intersectLinePlane(line, plane2); % check the distance between intersection points distancePoints3d(pi1, pi2) ans = 5 See also geom3d, parallelLine3d ------ Author: David Legland e-mail: david.legland@grignon.inra.fr Created: 2012-08-22, using Matlab 7.9.0.529 (R2009b) Copyright 2012 INRA - Cepia Software Platform.
0001 function res = parallelPlane(plane, point) 0002 %PARALLELPLANE Parallel to a plane through a point or at a given distance. 0003 % 0004 % PL2 = parallelPlane(PL, PT) 0005 % Constructs the plane parallel to plane PL and containing the point PT. 0006 % 0007 % PL2 = parallelPlane(PL, D) 0008 % Constructs the plane parallel to plane PL, and located at the given 0009 % signed distance D. 0010 % 0011 % Example 0012 % % Create a plane normal to the 3D vector DIR 0013 % dir = [3 4 5]; 0014 % plane = createPlane([3 4 5], dir); 0015 % % Create plane at a specific distance 0016 % plane2 = parallelPlane(plane, 5); 0017 % % Create a line perpendicular to both planes 0018 % line = [2 4 1 3 4 5]; 0019 % pi1 = intersectLinePlane(line, plane); 0020 % pi2 = intersectLinePlane(line, plane2); 0021 % % check the distance between intersection points 0022 % distancePoints3d(pi1, pi2) 0023 % ans = 0024 % 5 0025 % 0026 % See also 0027 % geom3d, parallelLine3d 0028 % 0029 % ------ 0030 % Author: David Legland 0031 % e-mail: david.legland@grignon.inra.fr 0032 % Created: 2012-08-22, using Matlab 7.9.0.529 (R2009b) 0033 % Copyright 2012 INRA - Cepia Software Platform. 0034 0035 if size(point, 2) == 1 0036 % use a distance. Compute position of point located at distance DIST on 0037 % the line normal to the plane. 0038 normal = normalizeVector3d(planeNormal(plane)); 0039 point = plane(:, 1:3) + bsxfun(@times, point, normal); 0040 end 0041 0042 % change origin, and keep direction vectors 0043 res = [point plane(:, 4:9)];