Home > matGeom > polygons2d > cart2geod.m

cart2geod

PURPOSE ^

CART2GEOD Convert cartesian coordinates to geodesic coord.

SYNOPSIS ^

function point = cart2geod(src, curve)

DESCRIPTION ^

CART2GEOD Convert cartesian coordinates to geodesic coord.

   PT2 = cart2geod(PT1, CURVE)
   PT1 is the point to transform, in Cartesian coordinates (same system
   used for the curve).
   CURVE is a N-by-2 array which represents coordinates of curve vertices.

   The function first compute the projection of PT1 on the curve. Then,
   the first geodesic coordinate is the length of the curve to the
   projected point, and the second geodesic coordinate is the 
   distance between PT1 and it projection.


   See also
   polylines2d, geod2cart, curveLength

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function point = cart2geod(src, curve)
0002 %CART2GEOD Convert cartesian coordinates to geodesic coord.
0003 %
0004 %   PT2 = cart2geod(PT1, CURVE)
0005 %   PT1 is the point to transform, in Cartesian coordinates (same system
0006 %   used for the curve).
0007 %   CURVE is a N-by-2 array which represents coordinates of curve vertices.
0008 %
0009 %   The function first compute the projection of PT1 on the curve. Then,
0010 %   the first geodesic coordinate is the length of the curve to the
0011 %   projected point, and the second geodesic coordinate is the
0012 %   distance between PT1 and it projection.
0013 %
0014 %
0015 %   See also
0016 %   polylines2d, geod2cart, curveLength
0017 %
0018 
0019 % ------
0020 % Author: David Legland
0021 % E-mail: david.legland@inrae.fr
0022 % Created: 2004-04-08
0023 % Copyright 2004-2024 INRA - Cepia Software Platform
0024 
0025 % parametrization approximation
0026 t = parametrize(curve);
0027 
0028 % compute distance between each src point and the curve
0029 [dist, ind] = minDistancePoints(src, curve);
0030 
0031 % convert to 'geodesic' coordinate
0032 point = [t(ind) dist];
0033 
0034 % Old version:
0035 % for i=1:size(pt1, 1)
0036 %     [dist, ind] = minDistance(src(i,:), curve);
0037 %     point(i,:) = [t(ind) dist];
0038 % end

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