-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpolyloop_arclength_nd.f90
More file actions
65 lines (56 loc) · 1.39 KB
/
Copy pathpolyloop_arclength_nd.f90
File metadata and controls
65 lines (56 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
subroutine polyloop_arclength_nd ( dim_num, nk, pk, sk )
!*****************************************************************************80
!
!! POLYLOOP_ARCLENGTH_ND computes the arclength of points on a polyloop in ND.
!
! Discussion:
!
! A polyloop of order NK is the geometric structure consisting of
! the NK line segments that lie between successive elements of a list
! of NK points, with the last point joined to the first.
!
! Warning: I just made up the word "polyloop", so don't go repeating it!
!
! Licensing:
!
! This code is distributed under the GNU LGPL license.
!
! Modified:
!
! 28 February 2005
!
! Author:
!
! John Burkardt
!
! Parameters:
!
! Input, integer DIM_NUM, the spatial dimension.
!
! Input, integer NK, the number of points defining the polyloop.
!
! Input, double precision PK(DIM_NUM,NK), the points defining the polyloop.
!
! Output, double precision SK(NK+1), the arclength coordinates
! of each point. The first point has two arc length values,
! namely SK(1) = 0 and SK(NK+1) = LENGTH.
!
implicit none
integer dim_num
integer nk
integer i
integer j
double precision pk(dim_num,nk)
double precision sk(nk+1)
sk(1) = 0.0D+00
do i = 2, nk + 1
if ( i <= nk ) then
j = i
else
j = 1
end if
sk(i) = sk(i-1) &
+ sqrt ( sum ( ( pk(1:dim_num,j) - pk(1:dim_num,i-1) )**2 ) )
end do
return
end