[mapguide-commits] r1354 - trunk/MgDev/Common/Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Mar 22 22:34:29 EDT 2007


Author: jasonnogar
Date: 2007-03-22 22:34:29 -0400 (Thu, 22 Mar 2007)
New Revision: 1354

Modified:
   trunk/MgDev/Common/Stylization/SE_Matrix.h
Log:
Symbology:
Add SE_Matrix::rotate function that takes cosine,sine instead of calculating it.

Modified: trunk/MgDev/Common/Stylization/SE_Matrix.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Matrix.h	2007-03-23 01:54:26 UTC (rev 1353)
+++ trunk/MgDev/Common/Stylization/SE_Matrix.h	2007-03-23 02:34:29 UTC (rev 1354)
@@ -22,6 +22,11 @@
 
 #define SE_INLINE inline
 
+/* For the points P0, P1, P2, true if P2 is left of (P0, P1), 
+ * as indicated by sign of the cross product (P0, P1) X (P0, P2) */
+#define PointLeft(pt0x, pt0y, pt1x, pt1y, pt2x, pt2y) \
+    (((pt1x - pt0x)*(pt2y - pt0y) - (pt2x - pt0x)*(pt1y - pt0y)) > 0)
+
 struct SE_Matrix
 {
     double x0, x1, x2, y0, y1, y2;
@@ -43,6 +48,7 @@
     SE_INLINE void translateY(double y);
     SE_INLINE void translate(double x, double y);
     SE_INLINE void rotate(double angle);
+    SE_INLINE void rotate(double angle_sine, double angle_cosine);
 
     SE_INLINE void premultiply(const SE_Matrix& matrix);
     SE_INLINE void postmultiply(const SE_Matrix& matrix);
@@ -167,6 +173,23 @@
     y0 = a10; y1 = a11; y2 = a12;
 }
 
+void SE_Matrix::rotate(double angle_sine, double angle_cosine)
+{
+    double a00, a01, a02, a10, a11, a12;
+
+    a00 = x0*angle_cosine - y0*angle_sine;
+    a10 = y0*angle_cosine + x0*angle_sine;
+
+    a01 = x1*angle_cosine - y1*angle_sine;
+    a11 = y1*angle_cosine + x1*angle_sine;
+
+    a02 = x2*angle_cosine - y2*angle_sine;
+    a12 = y2*angle_cosine + x2*angle_sine;
+
+    x0 = a00; x1 = a01; x2 = a02;
+    y0 = a10; y1 = a11; y2 = a12;
+}
+
 void SE_Matrix::premultiply(const SE_Matrix & matrix)
 {
     double a00, a01, a02, a10, a11, a12;



More information about the mapguide-commits mailing list