/*
	Test program for C code from An Introduction to NURBS
	by David F. Rogers. Copyright (C) 2000 David F. Rogers,
	All rights reserved.
	
	Name: tknotu.c
	Purpose: To test knotu.c for generating a uniform periodic knot vector
	Language: C
	Subroutines called: tknotu.c
	Book reference: Section 3.3, p. 53 Ex. 3.1 with n=4, c=3
*/

#include	<stdio.h>

main()
{
	int x[22];
	int n,c,nplusc;
	int i;

	for (i = 0; i <= 21; i++){
		x[i] = 0;
	}

	printf("Input number of polygon points and order separated by space n c ");
	scanf("%d %d",&n,&c);

	nplusc = n + c;

	if (nplusc <= 21){
		knotu(n,c,x);
		printf("knot vector is \n");
		for (i = 1; i <= nplusc; i++){
			printf(" %d %d \n", i,x[i]);
		}
	}
	else
		{
		printf("Program limits exceeded. n+c > 21.\n");
 		printf("Knot vector not calculated.\n");
	}
}

