Home > matGeom > geom3d > circle3dPoint.m

circle3dPoint

PURPOSE ^

CIRCLE3DPOINT Coordinates of a point on a 3D circle from its position.

SYNOPSIS ^

function point = circle3dPoint(circle, pos)

DESCRIPTION ^

CIRCLE3DPOINT Coordinates of a point on a 3D circle from its position.

   output = circle3dPoint(input)

   Example
   % Draw some points on a 3D circle
     figure('color','w'); hold on; view(130,-10);
     circle = [10 20 30 50 90 45 0];
     drawCircle3d(circle)
     % origin point
     pos1 = 0;
     drawPoint3d(circle3dPoint(circle, pos1), 'ro')
     % few points regularly spaced
     drawPoint3d(circle3dPoint(circle, 10:10:40), '+')
     % Draw point opposite to origin
     drawPoint3d(circle3dPoint(circle, 180), 'k*')
   

   See also
   circles3d, circle3dPosition

 ------
 Author: David Legland
 e-mail: david.legland@grignon.inra.fr
 Created: 2011-06-21,    using Matlab 7.9.0.529 (R2009b)
 Copyright 2011 INRA - Cepia Software Platform.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function point = circle3dPoint(circle, pos)
0002 %CIRCLE3DPOINT Coordinates of a point on a 3D circle from its position.
0003 %
0004 %   output = circle3dPoint(input)
0005 %
0006 %   Example
0007 %   % Draw some points on a 3D circle
0008 %     figure('color','w'); hold on; view(130,-10);
0009 %     circle = [10 20 30 50 90 45 0];
0010 %     drawCircle3d(circle)
0011 %     % origin point
0012 %     pos1 = 0;
0013 %     drawPoint3d(circle3dPoint(circle, pos1), 'ro')
0014 %     % few points regularly spaced
0015 %     drawPoint3d(circle3dPoint(circle, 10:10:40), '+')
0016 %     % Draw point opposite to origin
0017 %     drawPoint3d(circle3dPoint(circle, 180), 'k*')
0018 %
0019 %
0020 %   See also
0021 %   circles3d, circle3dPosition
0022 %
0023 % ------
0024 % Author: David Legland
0025 % e-mail: david.legland@grignon.inra.fr
0026 % Created: 2011-06-21,    using Matlab 7.9.0.529 (R2009b)
0027 % Copyright 2011 INRA - Cepia Software Platform.
0028 
0029 pos=pos(:);
0030 
0031 % extract circle coordinates
0032 xc  = circle(1);
0033 yc  = circle(2);
0034 zc  = circle(3);
0035 r   = circle(4);
0036 
0037 theta   = circle(5);
0038 phi     = circle(6);
0039 psi     = circle(7);
0040 
0041 % convert position to angle
0042 t = pos * pi / 180;
0043 
0044 % compute position on base circle
0045 x   = r * cos(t);
0046 y   = r * sin(t);
0047 z   = zeros(length(pos),1);
0048 pt0 = [x y z];
0049 
0050 % compute transformation from local basis to world basis
0051 trans   = localToGlobal3d(xc, yc, zc, theta, phi, psi);
0052 
0053 % compute points of transformed circle
0054 point   = transformPoint3d(pt0, trans);
0055

Generated on Wed 16-Feb-2022 15:10:47 by m2html © 2003-2019