Home > matGeom > geom3d > distancePointCircle3d.m

distancePointCircle3d

PURPOSE ^

DISTANCEPOINTCIRCLE3D Distance between 3D points and 3D circle.

SYNOPSIS ^

function d = distancePointCircle3d(points, circle)

DESCRIPTION ^

DISTANCEPOINTCIRCLE3D Distance between 3D points and 3D circle.

   D = distancePointCircle3d(POINTS, CIRCLE)
   Returns the euclidean distance D between POINTS and CIRCLE

   Example
     figure('color','w'); hold on; axis equal tight; view(3)
     circle = [10 20 30 50 90 45 60];
     drawCircle3d(circle)
     % Get some points on the circle
     pts = circle3dPoint(circle, 10:10:280);
     drawPoint3d(pts,'.r')
     % Get the normal of the circle
     circleNormal = normalizeVector3d(transformVector3d([0 0 1], ...
         eulerAnglesToRotation3d(circle(6), circle(5), circle(7), 'ZYZ')));
     drawArrow3d(circle(1:3), circleNormal*25)
     % Move points along the circle normal by 10 units
     pts2 = pts + 10 * circleNormal;
     drawPoint3d(pts2,'.g')
     drawEdge3d([pts, pts2])
     uniquetol(distancePointCircle3d(pts2, circle))
     % Decrease the circle radius by 5 units
     uniquetol(distancePointCircle3d(pts, [circle(1:3) circle(4)-5 circle(5:7)]))
   
   See also
   circles3d, projPointOnCircle3d

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function d = distancePointCircle3d(points, circle)
0002 %DISTANCEPOINTCIRCLE3D Distance between 3D points and 3D circle.
0003 %
0004 %   D = distancePointCircle3d(POINTS, CIRCLE)
0005 %   Returns the euclidean distance D between POINTS and CIRCLE
0006 %
0007 %   Example
0008 %     figure('color','w'); hold on; axis equal tight; view(3)
0009 %     circle = [10 20 30 50 90 45 60];
0010 %     drawCircle3d(circle)
0011 %     % Get some points on the circle
0012 %     pts = circle3dPoint(circle, 10:10:280);
0013 %     drawPoint3d(pts,'.r')
0014 %     % Get the normal of the circle
0015 %     circleNormal = normalizeVector3d(transformVector3d([0 0 1], ...
0016 %         eulerAnglesToRotation3d(circle(6), circle(5), circle(7), 'ZYZ')));
0017 %     drawArrow3d(circle(1:3), circleNormal*25)
0018 %     % Move points along the circle normal by 10 units
0019 %     pts2 = pts + 10 * circleNormal;
0020 %     drawPoint3d(pts2,'.g')
0021 %     drawEdge3d([pts, pts2])
0022 %     uniquetol(distancePointCircle3d(pts2, circle))
0023 %     % Decrease the circle radius by 5 units
0024 %     uniquetol(distancePointCircle3d(pts, [circle(1:3) circle(4)-5 circle(5:7)]))
0025 %
0026 %   See also
0027 %   circles3d, projPointOnCircle3d
0028 
0029 % ------
0030 % Author: oqilipo
0031 % E-mail: N/A
0032 % Created: 2023-07-25, using Matlab 9.13.0.2080170 (R2022b) Update 1
0033 % Copyright 2023-2024
0034 
0035 % Project the points on the circle
0036 pointsProj2Circle = projPointOnCircle3d(points, circle);
0037 
0038 % Calculate the distance between the points and the projected points
0039 d = distancePoints3d(points, pointsProj2Circle);

Generated on Thu 21-Nov-2024 11:30:22 by m2html © 2003-2022