Plotting x = x(t), y = y(t), z = z(t)

In this section:

The following code was extracted from simdem23.f95 in the Simdem package, in order to demonstrate how easy it is to plot parametric curves in space, where x, y and z are double precision arrays. Of course, x, y, and z do not have to be defined parametrically and any sets of x,y,z triples can be plotted.


!
! Define t
!
      n = nmax/2
      t(1) = zero
      t(n) = two*pi
      delta = (t(n) - t(1))/(dble(n) - one)
      do i = 2, n - 1
         t(i) = t(i - 1) + delta
      enddo
!
! Define x, y, z as a helix
!
      x(1) = one
      y(1) = zero
      z(1) = one
      do i = 2, n - 1
         delta = two*t(i)
         x(i) = cos(delta)
         y(i) = sin(delta)
         z(i) = dble(i)
      enddo
      x(n) = x(1)
      y(n) = y(1)
      z(n) = dble(n)
!
! Display the space curve
!
      call space0 (n, nmax, x, xtemp, y, ytemp, z)
      

The following plot is then displayed and can be edited to add further features, printed, or archived as a graphics file.

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited