aboutsummaryrefslogtreecommitdiff
path: root/generic/Geo.h
diff options
context:
space:
mode:
authorlecoanet2000-01-12 13:58:32 +0000
committerlecoanet2000-01-12 13:58:32 +0000
commit3ed3940af059b1e822a7871216e70fad9d4399b8 (patch)
treea08db4901d0814c7a53a4a5a11beb7f62902d081 /generic/Geo.h
parent24df859cbc6bb1661abfa7bbe52cfc3dd1b14120 (diff)
downloadtkzinc-3ed3940af059b1e822a7871216e70fad9d4399b8.zip
tkzinc-3ed3940af059b1e822a7871216e70fad9d4399b8.tar.gz
tkzinc-3ed3940af059b1e822a7871216e70fad9d4399b8.tar.bz2
tkzinc-3ed3940af059b1e822a7871216e70fad9d4399b8.tar.xz
Renommage des fichiers d'entetes
Diffstat (limited to 'generic/Geo.h')
-rw-r--r--generic/Geo.h239
1 files changed, 239 insertions, 0 deletions
diff --git a/generic/Geo.h b/generic/Geo.h
new file mode 100644
index 0000000..28e3dae
--- /dev/null
+++ b/generic/Geo.h
@@ -0,0 +1,239 @@
+/*
+ * Geo.h -- Header for common geometric routines.
+ *
+ * Authors : Patrick Lecoanet.
+ * Creation date :
+ *
+ * $Id$
+ */
+
+/*
+ * Copyright (c) 1993 - 1999 CENA, Patrick Lecoanet --
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this code; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _Geo_h
+#define _Geo_h
+
+
+#include "Types.h"
+#include "Attrs.h"
+#include "List.h"
+
+#include <math.h>
+#include <limits.h>
+
+
+#ifndef MIN
+#define MIN(a, b) ((a) <= (b) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a, b) ((a) >= (b) ? (a) : (b))
+#endif
+#ifndef ABS
+#define ABS(a) ((a) < 0 ? -(a) : (a))
+#endif
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#ifndef M_PI_2
+#define M_PI_2 1.57079632679489661923
+#endif
+#ifndef M_PI_4
+#define M_PI_4 0.78539816339744830962
+#endif
+
+#define PRECISION_LIMIT 1.0e-6
+#define X_PRECISION_LIMIT 5.0e-2
+#define LINE_END_POINTS 6
+
+#define DegreesToRadian(angle) \
+ (M_PI * (double) (angle) / 180.0)
+
+#define REAL_TO_INT(double) \
+ (((int) ((double) + (((double) > 0) ? 0.5 : -0.5))))
+
+
+void
+Anchor2Origin(RadarPoint *position,
+ RadarDim width,
+ RadarDim height,
+ RadarAnchor anchor,
+ RadarPoint *origin);
+void
+Origin2Anchor(RadarPoint *origin,
+ RadarDim width,
+ RadarDim height,
+ RadarAnchor anchor,
+ RadarPoint *position);
+void
+BBox2XRect(RadarBBox *bbox,
+ XRectangle *rect);
+void
+GetStringBBox(char *str,
+ RadarFont font,
+ RadarPos x,
+ RadarPos y,
+ RadarBBox *str_bbox);
+void
+ResetBBox(RadarBBox *bbox);
+void
+CopyBBox(RadarBBox *bbox_from,
+ RadarBBox *bbox_to);
+void
+IntersectBBox(RadarBBox *bbox1,
+ RadarBBox *bbox2,
+ RadarBBox *bbox_inter);
+RadarBool
+IsEmptyBBox(RadarBBox *bbox);
+void
+AddBBoxToBBox(RadarBBox *bbox,
+ RadarBBox *bbox2);
+void
+AddPointToBBox(RadarBBox *bbox,
+ RadarPos px,
+ RadarPos py);
+void
+AddPointsToBBox(RadarBBox *bbox,
+ RadarPoint *points,
+ int num_points);
+void
+AddStringToBBox(RadarBBox *bbox,
+ char *str,
+ RadarFont font,
+ RadarPos cx,
+ RadarPos cy);
+RadarBool
+PointInBBox(RadarBBox *bbox,
+ RadarPos x,
+ RadarPos y);
+
+int
+LineInBBox(RadarPoint *p1,
+ RadarPoint *p2,
+ RadarBBox *bbox);
+
+int
+BBoxInBBox(RadarBBox *bbox1,
+ RadarBBox *bbox2);
+
+int
+PolylineInBBox(RadarPoint *points,
+ int num_points,
+ int width,
+ int cap_style,
+ int join_style,
+ RadarBBox *bbox);
+
+int
+PolygonInBBox(RadarPoint *points,
+ int num_points,
+ RadarBBox *bbox);
+
+int
+OvalInBBox(RadarPoint *center,
+ int width,
+ int height,
+ RadarBBox *bbox);
+
+RadarBool
+PointInAngle(int start_angle,
+ int angle_extent,
+ RadarPoint *p);
+
+double
+RectangleToPointDist(RadarBBox *bbox,
+ RadarPoint *p);
+double
+LineToPointDist(RadarPoint *p1,
+ RadarPoint *p2,
+ RadarPoint *p);
+
+double
+PolygonToPointDist(RadarPoint *points,
+ int num_points,
+ RadarPoint *p);
+
+double
+PolylineToPointDist(RadarPoint *points,
+ int num_points,
+ int width,
+ int cap_style,
+ int join_style,
+ RadarPoint *p);
+
+double
+OvalToPointDist(RadarPoint *center,
+ int width,
+ int height,
+ unsigned int line_width,
+ RadarPoint *p);
+
+void
+GetButtPoints(RadarPoint *p1,
+ RadarPoint *p2,
+ int width,
+ RadarBool projecting,
+ RadarPoint *c1,
+ RadarPoint *c2);
+
+RadarBool
+GetMiterPoints(RadarPoint *p1,
+ RadarPoint *p2,
+ RadarPoint *p3,
+ int width,
+ RadarPoint *c1,
+ RadarPoint *c2);
+
+RadarBool
+IntersectLines(RadarPoint *a1,
+ RadarPoint *a2,
+ RadarPoint *b1,
+ RadarPoint *b2,
+ RadarPoint *pi);
+
+void
+ShiftLine(RadarPoint *p1,
+ RadarPoint *p2,
+ RadarReal dist,
+ RadarPoint *p3,
+ RadarPoint *p4);
+
+void
+InsetPolygon(RadarPoint *p,
+ int num_points,
+ RadarDim inset);
+
+void
+SmoothPathWithBezier(RadarList from_points,
+ RadarList to_points);
+
+void
+GetBezierPath(RadarList from_points,
+ RadarList to_points);
+
+void
+GetLineEnd(RadarPoint *p1,
+ RadarPoint *p2,
+ unsigned int line_width,
+ int cap_style,
+ LineEnd end_style,
+ RadarPoint *points);
+
+
+#endif /* _Geo_h */