/*-------------------------------------------------------------------------*/ /** @file poly2d.h @author N. Devillard @date 22 Jun 1999 @version $Revision: 1.11 $ @brief 2D polynomial handling */ /*--------------------------------------------------------------------------*/ /* $Id: poly2d.h,v 1.11 2001/11/07 14:55:14 yjung Exp $ $Author: yjung $ $Date: 2001/11/07 14:55:14 $ $Revision: 1.11 $ */ #ifndef _POLY2D_H_ #define _POLY2D_H_ /*--------------------------------------------------------------------------- Includes ---------------------------------------------------------------------------*/ #include #include #include #include "ipow.h" #include "xmemory.h" /*--------------------------------------------------------------------------- New types ---------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /** @brief 2d Polynomial object. The following structure defines a 2d polynomial. 'deg' is the highest degree in the polynomial. \begin{itemize} \item 'nc' contains the number of coefficients in px, py, and c. \item 'px' and 'py' contain the powers of resp. x and y. \item 'c' contains the coefficients themselves. \end{itemize} For example, if you want to store the following polynomial: \begin{verbatim} p(x,y) = p0 + p1.x + p2.y + p3.x.y + p4.x^2 + p5.y^2 \end{verbatim} You would have: \begin{verbatim} nc = 6 (from 0 to 5 incl.) px contains: 0 1 0 1 2 0 py contains: 0 0 1 1 0 2 c contains: p0 p1 p2 p3 p4 p5 So that given x0 and y0, computing the polynomial is done with: poly2d p ; int i ; double x0, y0, poly ; poly = 0.00 ; for (i=0 ; i