#!/usr/bin/perl -w
use strict;

use Math::Vector::Real;

my $lin_len = 10;
my $sine_len = 8;
my $sine_height = 6;

my @i_sections = qw(ball0   6
		    sine0  10
		    lin0    2
		    circle 20
		    lin1    2
		    sine1  10
		    lin2    2
		    ball2   6);

sub point ($$) {
    my ($ip,$it, $jp,$jt) = @_;

    my ($i_offset, $i_outward);

    $i_outward = V( 0,
		  ($ip =~ m/0$/ ? -1 : +1),
		  0 );

    if ($ip =~ m/^lin[01]$/) {
	$i_offset = V( $lin_len * ($ip =~ m/1/ ? $it : 1-$it),
		       0,
		       0 );
    } elsif ($ip =~ m/^circle$/) {
	$i_offset = V( 0,0,0 );
	$i_outward = V(  sin($ip / PI),
			 -cos($ip / PI),
			 0 );
    } elsif ($ip =~ m/^lin2$/) {
	$i_offset = V( -$lin_len -$sine_len,
		       0,
		       +1 );
    } elsif ($ip =~ m/^sine[01]$/) {
	$i_offset = V( -$lin_len -$it*$sine_len,
		       0,
		       $sine_height * ( 0.5 - 0.5*cos( $it*PI ) )
		     );
    } else {
	die "$ip ?";
    }
    
