Example #1
0
void sip_add_to_header(qfits_header* hdr, const sip_t* sip) {
	wcs_hdr_common(hdr, &(sip->wcstan));
	if (sip->wcstan.sin) {
		qfits_header_add_after(hdr, "WCSAXES", "CTYPE2", "DEC--SIN-SIP", "SIN projection + SIP distortions", NULL);
		qfits_header_add_after(hdr, "WCSAXES", "CTYPE1", "RA---SIN-SIP", "SIN projection + SIP distortions", NULL);
	} else {
		qfits_header_add_after(hdr, "WCSAXES", "CTYPE2", "DEC--TAN-SIP", "TAN (gnomic) projection + SIP distortions", NULL);
		qfits_header_add_after(hdr, "WCSAXES", "CTYPE1", "RA---TAN-SIP", "TAN (gnomic) projection + SIP distortions", NULL);
	}

	fits_header_add_int(hdr, "A_ORDER", sip->a_order, "Polynomial order, axis 1");
	add_polynomial(hdr, "A_%i_%i", sip->a_order, (double*)sip->a, SIP_MAXORDER);

	fits_header_add_int(hdr, "B_ORDER", sip->b_order, "Polynomial order, axis 2");
	add_polynomial(hdr, "B_%i_%i", sip->b_order, (double*)sip->b, SIP_MAXORDER);

	fits_header_add_int(hdr, "AP_ORDER", sip->ap_order, "Inv polynomial order, axis 1");
	add_polynomial(hdr, "AP_%i_%i", sip->ap_order, (double*)sip->ap, SIP_MAXORDER);

	fits_header_add_int(hdr, "BP_ORDER", sip->bp_order, "Inv polynomial order, axis 2");
	add_polynomial(hdr, "BP_%i_%i", sip->bp_order, (double*)sip->bp, SIP_MAXORDER);
}
/*----------------main function---------------------------*/
void main()
{	
	
	struct node *root[] = {NULL, NULL};
	struct node *point1, *point2;
	int i;
	int coef, exp;
	for(i = 0; i < 2; i ++) {
		printf("ENTER POLYNOMIAL no:%d (COEFFICIENT AND EXPONENT):\n",i);
		while(scanf("%d%d", &coef, &exp) != EOF)
			root[i] = addlist(root[i], coef, exp);
	}
	struct node *result = NULL;
	result = add_polynomial(root[0], root[1], result);
	print_result_poly(result);	
}
Example #3
0
int main()
{
	polynomial poly1 = create_poly();
	insert_node(poly1,10,1000);
	insert_node(poly1,5,14);
	insert_node(poly1,1,0);
	print_poly(poly1);

	polynomial poly2 = create_poly();
	insert_node(poly2,3,1990);
	insert_node(poly2,-2,14);
	print_poly(poly2);
	
	polynomial poly3 = create_poly();

	add_polynomial(poly1,poly2,poly3);

	print_poly(poly3);
	/*free the memory*/
	dispose_poly(poly1);
	dispose_poly(poly2);
	dispose_poly(poly3);
}