************80
! PARAMETERIZE_ARC_LENGTH parameterizes data by pseudo-arclength.
Discussion:
A parameterization is required for the interpolation.
This routine provides a parameterization by computing the
pseudo-arclength of the data, that is, the Euclidean distance
between successive points.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
19 May 2007
Author:
John Burkardt
Parameters:
Input, integer ( kind = 4 ) DIM_NUM, the spatial dimension.
Input, integer ( kind = 4 ) DATA_NUM, the number of data points.
Input, real ( kind = 8 ) P_DATA(DIM_NUM,DATA_NUM), the data values.
Output, real ( kind = 8 ) T_DATA(DATA_NUM), parameter values
assigned to the data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=4) | :: | dim_num | ||||
integer(kind=4) | :: | data_num | ||||
real(kind=8) | :: | p_data(dim_num,data_num) | ||||
real(kind=8) | :: | t_data(data_num) |
subroutine parameterize_arc_length ( dim_num, data_num, p_data, t_data ) !*****************************************************************************80 ! !! PARAMETERIZE_ARC_LENGTH parameterizes data by pseudo-arclength. ! ! Discussion: ! ! A parameterization is required for the interpolation. ! ! This routine provides a parameterization by computing the ! pseudo-arclength of the data, that is, the Euclidean distance ! between successive points. ! ! Licensing: ! ! This code is distributed under the GNU LGPL license. ! ! Modified: ! ! 19 May 2007 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) DIM_NUM, the spatial dimension. ! ! Input, integer ( kind = 4 ) DATA_NUM, the number of data points. ! ! Input, real ( kind = 8 ) P_DATA(DIM_NUM,DATA_NUM), the data values. ! ! Output, real ( kind = 8 ) T_DATA(DATA_NUM), parameter values ! assigned to the data. ! implicit none integer ( kind = 4 ) data_num integer ( kind = 4 ) dim_num integer ( kind = 4 ) j real ( kind = 8 ) p_data(dim_num,data_num) real ( kind = 8 ) t_data(data_num) t_data(1) = 0.0D+00 do j = 2, data_num t_data(j) = t_data(j-1) & + sqrt ( sum ( ( p_data(1:dim_num,j) - p_data(1:dim_num,j-1) )**2 ) ) end do return end subroutine parameterize_arc_length