/* * =================================================================== * polygon.h : Header file for library of polygons. * * Copyright (C) 1994-96 by Mark Austin and David Mazzoni. * * This software is provided "as is" without express or implied warranty. * Permission is granted to use this software on any computer system, * and to redistribute it freely, subject to the following restrictions: * * 1. The authors are not responsible for the consequences of use of * this software, even if they arise from defects in the software. * 2. The origin of this software must not be misrepresented, either * by explicit claim or by omission. * 3. Altered versions must be plainly marked as such, and must not * be misrepresented as being the original software. * 4. This notice is to remain intact. * * Written by: Mark Austin March 1994 * =================================================================== */ #ifndef _POLYGON_H #define _POLYGON_H /* Data Structure for polygons */ typedef struct vertex { float fXcoord, fYcoord, fZcoord, fWcoord; } VERTEX; typedef struct param { float fA, fB, fC; } PARAM; typedef struct edge { PARAM sParam; /* Parameters for edge */ VERTEX *spVertex; /* Pointer to vertex */ struct edge *spNext; /* Pointer to next edge */ struct polygon *spPolygon; /* Pointer from edge to parent polygon */ } EDGE; typedef enum { Perimeter = 1, Hole = 2 } TYPEOFLOOP; typedef struct polygon { char *cpName; /* Name of polygon */ struct polygon *spNext; /* Next polygon in list */ struct edge *spEdge; /* Circular List of segments */ TYPEOFLOOP eTypeOfLoop; /* Type of loop */ union { struct polygon *spChild; /* Not Hole : pointer to child polygon */ struct polygon *spParent; /* Case Hole : pointer to polygon parent */ } uPolygon; } POLYGON; /* External Interface for Polygon Functions */ VERTEX *polyAllocVertex(); EDGE *polyAllocEdge(); EDGE *polyCreateEdge( float fXcoord, float fYcoord, float fZcoord ); POLYGON *polyAlloc(); POLYGON *polyCreate( char *, EDGE * ); void polyAddEdge( POLYGON *, EDGE * ); void polyPrint( POLYGON * ); void polyPrintMember( POLYGON * ); void polyAddHole( POLYGON *, POLYGON * ); void polyAppend( POLYGON *, POLYGON * ); /* Function declarations for Engineering Properties of Polygons */ float polyProperty( float (*EngPropertyPtr)( float, float, float, float ), POLYGON * ); float polyPropertyOfLoop( float (*EngPropertyPtr)( float, float, float, float ), EDGE * ); float polyPropertyArea( float, float, float, float ); float polyPropertyIxx( float, float, float, float ); float polyPropertyIyy( float, float, float, float ); float polyPropertyIxy( float, float, float, float ); #endif /* end case POLYGON_H */