diff options
Diffstat (limited to 'generic/Geo.h')
-rw-r--r-- | generic/Geo.h | 380 |
1 files changed, 190 insertions, 190 deletions
diff --git a/generic/Geo.h b/generic/Geo.h index 1e3ac90..a833141 100644 --- a/generic/Geo.h +++ b/generic/Geo.h @@ -1,8 +1,8 @@ /* * Geo.h -- Header for common geometric routines. * - * Authors : Patrick Lecoanet. - * Creation date : + * Authors : Patrick Lecoanet. + * Creation date : * * $Id$ */ @@ -39,18 +39,18 @@ #ifndef M_PI -#define M_PI 3.14159265358979323846264338327 +#define M_PI 3.14159265358979323846264338327 #endif #ifndef M_PI_2 -#define M_PI_2 1.57079632679489661923 +#define M_PI_2 1.57079632679489661923 #endif #ifndef M_PI_4 -#define M_PI_4 0.78539816339744830962 +#define M_PI_4 0.78539816339744830962 #endif -#define PRECISION_LIMIT 1.0e-10 -#define X_PRECISION_LIMIT 5.0e-2 -#define ZN_LINE_END_POINTS 6 +#define PRECISION_LIMIT 1.0e-10 +#define X_PRECISION_LIMIT 5.0e-2 +#define ZN_LINE_END_POINTS 6 /* * Constants used to specify circle approximation quality. @@ -69,11 +69,11 @@ * points has doubles. */ typedef struct { - double x, y; + double x, y; } ZnPoint; typedef struct { - double x, y, w, h; + double x, y, w, h; } ZnRect; /* @@ -87,14 +87,14 @@ typedef struct { * always axes aligned. */ typedef struct { - ZnPoint orig, corner; + ZnPoint orig, corner; } ZnBBox; typedef struct { - unsigned int num_points; - ZnPoint *points; - char *controls; - ZnBool cw; + unsigned int num_points; + ZnPoint *points; + char *controls; + ZnBool cw; } ZnContour; /* @@ -102,9 +102,9 @@ typedef struct { * without having to alloc the contours array. */ typedef struct { - unsigned int num_contours; - ZnContour *contours; - ZnContour contour1; + unsigned int num_contours; + ZnContour *contours; + ZnContour contour1; } ZnPoly; /* @@ -116,30 +116,30 @@ typedef enum { } ZnContourCmd; typedef struct { - unsigned int num_points; - ZnPoint *points; - ZnBool fan; /* When using a fan, all contour vertices must be - * included to describe the contour as a polygon - * (clipping code use that to speed up region - * rendering) and the center must be the first - * vertex. */ + unsigned int num_points; + ZnPoint *points; + ZnBool fan; /* When using a fan, all contour vertices must be + * included to describe the contour as a polygon + * (clipping code use that to speed up region + * rendering) and the center must be the first + * vertex. */ } ZnStrip; typedef struct { - unsigned int num_strips; - ZnStrip *strips; - ZnStrip strip1; + unsigned int num_strips; + ZnStrip *strips; + ZnStrip strip1; } ZnTriStrip; #ifndef MIN -#define MIN(a, b) ((a) <= (b) ? (a) : (b)) +#define MIN(a, b) ((a) <= (b) ? (a) : (b)) #endif #ifndef MAX -#define MAX(a, b) ((a) >= (b) ? (a) : (b)) +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) #endif #ifndef ABS -#define ABS(a) ((a) < 0 ? -(a) : (a)) +#define ABS(a) ((a) < 0 ? -(a) : (a)) #endif #define ZnDegRad(angle) \ @@ -153,243 +153,243 @@ typedef struct { (((int) ((d) + (((d) > 0) ? 0.5 : -0.5)))) void -ZnPolyInit(ZnPoly *poly); +ZnPolyInit(ZnPoly *poly); void -ZnPolyContour1(ZnPoly *poly, - ZnPoint *pts, - unsigned int num_pts, - ZnBool cw); +ZnPolyContour1(ZnPoly *poly, + ZnPoint *pts, + unsigned int num_pts, + ZnBool cw); void -ZnPolySet(ZnPoly *poly1, - ZnPoly *poly2); +ZnPolySet(ZnPoly *poly1, + ZnPoly *poly2); void -ZnPolyFree(ZnPoly *poly); +ZnPolyFree(ZnPoly *poly); void -ZnTriStrip1(ZnTriStrip *tristrip, - ZnPoint *pts, - unsigned int num_pts, - ZnBool fan); +ZnTriStrip1(ZnTriStrip *tristrip, + ZnPoint *pts, + unsigned int num_pts, + ZnBool fan); void -ZnTriFree(ZnTriStrip *tristrip); +ZnTriFree(ZnTriStrip *tristrip); void -ZnAnchor2Origin(ZnPoint *position, - ZnDim width, - ZnDim height, - Tk_Anchor anchor, - ZnPoint *origin); +ZnAnchor2Origin(ZnPoint *position, + ZnDim width, + ZnDim height, + Tk_Anchor anchor, + ZnPoint *origin); void -ZnOrigin2Anchor(ZnPoint *origin, - ZnDim width, - ZnDim height, - Tk_Anchor anchor, - ZnPoint *position); +ZnOrigin2Anchor(ZnPoint *origin, + ZnDim width, + ZnDim height, + Tk_Anchor anchor, + ZnPoint *position); void ZnRectOrigin2Anchor(ZnPoint *rect, Tk_Anchor anchor, ZnPoint *position); void -ZnBBox2XRect(ZnBBox *bbox, - XRectangle *rect); +ZnBBox2XRect(ZnBBox *bbox, + XRectangle *rect); void -ZnGetStringBBox(char *str, - Tk_Font font, - ZnPos x, - ZnPos y, - ZnBBox *str_bbox); +ZnGetStringBBox(char *str, + Tk_Font font, + ZnPos x, + ZnPos y, + ZnBBox *str_bbox); void ZnResetBBox(ZnBBox *bbox); void ZnCopyBBox(ZnBBox *bbox_from, - ZnBBox *bbox_to); + ZnBBox *bbox_to); void ZnIntersectBBox(ZnBBox *bbox1, - ZnBBox *bbox2, - ZnBBox *bbox_inter); + ZnBBox *bbox2, + ZnBBox *bbox_inter); ZnBool ZnIsEmptyBBox(ZnBBox *bbox); void ZnAddBBoxToBBox(ZnBBox *bbox, - ZnBBox *bbox2); + ZnBBox *bbox2); void -ZnAddPointToBBox(ZnBBox *bbox, - ZnPos px, - ZnPos py); +ZnAddPointToBBox(ZnBBox *bbox, + ZnPos px, + ZnPos py); void ZnAddPointsToBBox(ZnBBox *bbox, - ZnPoint *points, - unsigned int num_points); + ZnPoint *points, + unsigned int num_points); void -ZnAddStringToBBox(ZnBBox *bbox, - char *str, - Tk_Font font, - ZnPos cx, - ZnPos cy); +ZnAddStringToBBox(ZnBBox *bbox, + char *str, + Tk_Font font, + ZnPos cx, + ZnPos cy); ZnBool -ZnPointInBBox(ZnBBox *bbox, - ZnPos x, - ZnPos y); +ZnPointInBBox(ZnBBox *bbox, + ZnPos x, + ZnPos y); int -ZnLineInBBox(ZnPoint *p1, - ZnPoint *p2, - ZnBBox *bbox); +ZnLineInBBox(ZnPoint *p1, + ZnPoint *p2, + ZnBBox *bbox); int -ZnBBoxInBBox(ZnBBox *bbox1, - ZnBBox *bbox2); +ZnBBoxInBBox(ZnBBox *bbox1, + ZnBBox *bbox2); int -ZnPolylineInBBox(ZnPoint *points, - unsigned int num_points, - ZnDim width, - int cap_style, - int join_style, - ZnBBox *bbox); +ZnPolylineInBBox(ZnPoint *points, + unsigned int num_points, + ZnDim width, + int cap_style, + int join_style, + ZnBBox *bbox); int -ZnPolygonInBBox(ZnPoint *points, - unsigned int num_points, - ZnBBox *bbox, - ZnBool *area_enclosed); +ZnPolygonInBBox(ZnPoint *points, + unsigned int num_points, + ZnBBox *bbox, + ZnBool *area_enclosed); int -ZnOvalInBBox(ZnPoint *center, - ZnDim width, - ZnDim height, - ZnBBox *bbox); +ZnOvalInBBox(ZnPoint *center, + ZnDim width, + ZnDim height, + ZnBBox *bbox); ZnBool -ZnHorizLineToArc(ZnReal x1, - ZnReal x2, - ZnReal y, - ZnReal rx, - ZnReal ry, - int start_angle, - int angle_extent); +ZnHorizLineToArc(ZnReal x1, + ZnReal x2, + ZnReal y, + ZnReal rx, + ZnReal ry, + int start_angle, + int angle_extent); ZnBool -ZnVertLineToArc(ZnReal x, - ZnReal y1, - ZnReal y2, - ZnReal rx, - ZnReal ry, - int start_angle, - int angle_extent); +ZnVertLineToArc(ZnReal x, + ZnReal y1, + ZnReal y2, + ZnReal rx, + ZnReal ry, + int start_angle, + int angle_extent); ZnBool -ZnPointInAngle(int start_angle, - int angle_extent, - ZnPoint *p); +ZnPointInAngle(int start_angle, + int angle_extent, + ZnPoint *p); void -ZnPointPolarToCartesian(ZnReal heading, - ZnReal rho, - ZnReal theta, - ZnReal *delta_x, - ZnReal *delta_y); +ZnPointPolarToCartesian(ZnReal heading, + ZnReal rho, + ZnReal theta, + ZnReal *delta_x, + ZnReal *delta_y); ZnReal -ZnProjectionToAngle(ZnReal dx, - ZnReal dy); +ZnProjectionToAngle(ZnReal dx, + ZnReal dy); ZnDim -ZnRectangleToPointDist(ZnBBox *bbox, - ZnPoint *p); +ZnRectangleToPointDist(ZnBBox *bbox, + ZnPoint *p); ZnDim ZnLineToPointDist(ZnPoint *p1, ZnPoint *p2, ZnPoint *p, ZnPoint *closest); ZnDim -ZnPolygonToPointDist(ZnPoint *points, - unsigned int num_points, - ZnPoint *p); +ZnPolygonToPointDist(ZnPoint *points, + unsigned int num_points, + ZnPoint *p); ZnDim -ZnPolylineToPointDist(ZnPoint *points, - unsigned int num_points, - ZnDim width, - int cap_style, - int join_style, - ZnPoint *p); +ZnPolylineToPointDist(ZnPoint *points, + unsigned int num_points, + ZnDim width, + int cap_style, + int join_style, + ZnPoint *p); ZnDim -ZnOvalToPointDist(ZnPoint *center, - ZnDim width, - ZnDim height, - ZnDim line_width, - ZnPoint *p); +ZnOvalToPointDist(ZnPoint *center, + ZnDim width, + ZnDim height, + ZnDim line_width, + ZnPoint *p); void -ZnGetButtPoints(ZnPoint *p1, - ZnPoint *p2, - ZnDim width, - ZnBool projecting, - ZnPoint *c1, - ZnPoint *c2); +ZnGetButtPoints(ZnPoint *p1, + ZnPoint *p2, + ZnDim width, + ZnBool projecting, + ZnPoint *c1, + ZnPoint *c2); ZnBool -ZnGetMiterPoints(ZnPoint *p1, - ZnPoint *p2, - ZnPoint *p3, - ZnDim width, - ZnPoint *c1, - ZnPoint *c2); +ZnGetMiterPoints(ZnPoint *p1, + ZnPoint *p2, + ZnPoint *p3, + ZnDim width, + ZnPoint *c1, + ZnPoint *c2); ZnBool -ZnIntersectLines(ZnPoint *a1, - ZnPoint *a2, - ZnPoint *b1, - ZnPoint *b2, - ZnPoint *pi); +ZnIntersectLines(ZnPoint *a1, + ZnPoint *a2, + ZnPoint *b1, + ZnPoint *b2, + ZnPoint *pi); void -ZnShiftLine(ZnPoint *p1, - ZnPoint *p2, - ZnDim dist, - ZnPoint *p3, - ZnPoint *p4); +ZnShiftLine(ZnPoint *p1, + ZnPoint *p2, + ZnDim dist, + ZnPoint *p3, + ZnPoint *p4); void -ZnInsetPolygon(ZnPoint *p, - unsigned int num_points, - ZnDim inset); +ZnInsetPolygon(ZnPoint *p, + unsigned int num_points, + ZnDim inset); void -ZnSmoothPathWithBezier(ZnPoint *from_points, - unsigned int num_points, - ZnList to_points); +ZnSmoothPathWithBezier(ZnPoint *from_points, + unsigned int num_points, + ZnList to_points); void -ZnGetBezierPoints(ZnPoint *p1, - ZnPoint *c1, - ZnPoint *c2, - ZnPoint *p2, - ZnList to_points, - double eps); +ZnGetBezierPoints(ZnPoint *p1, + ZnPoint *c1, + ZnPoint *c2, + ZnPoint *p2, + ZnList to_points, + double eps); void -ZnGetBezierPath(ZnList from_points, - ZnList to_points); +ZnGetBezierPath(ZnList from_points, + ZnList to_points); ZnPoint * -ZnGetCirclePoints(int type, - int quality, - ZnReal start_angle, - ZnReal angle_extent, - unsigned int *num_points, - ZnList point_list); +ZnGetCirclePoints(int type, + int quality, + ZnReal start_angle, + ZnReal angle_extent, + unsigned int *num_points, + ZnList point_list); void -ZnGetArcPath(ZnReal start_angle, - ZnReal end_angle, - int type, - ZnList to_points); +ZnGetArcPath(ZnReal start_angle, + ZnReal end_angle, + int type, + ZnList to_points); void -ZnFitBezier(ZnPoint *pts, - unsigned int num_points, - ZnReal error, - ZnList controls); +ZnFitBezier(ZnPoint *pts, + unsigned int num_points, + ZnReal error, + ZnList controls); ZnBool -ZnTestCCW(ZnPoint *p, - unsigned int num_points); +ZnTestCCW(ZnPoint *p, + unsigned int num_points); -#endif /* _Geo_h */ +#endif /* _Geo_h */ |