/*
	Test program for C code from An Introduction to NURBS
	by David F. Rogers. Copyright (C) 2000 David F. Rogers,
	All rights reserved.
	
	Name: tknot.c
	Purpose: Test program for knot.c to generate an open knot vector.
	Language: C
	Subroutines called: tknot.c
	Book reference: Section 3.3, p. 49 for test examples with n=5, c=2,3,4
*/

#include	<stdio.h>

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

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

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

	nplusc = n + c;

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

