hi guys,
I had write a patch to support drawing eclipse rotated in 5.9.6, pls
check attachment enclosed.
--
l.f.hwang
2011-08-03
_________________________________________________________
diff -cr plplot-5.9.6/bindings/c++/plstream.cc plplot-5.9.6_p1/bindings/c++/plstream.cc
*** plplot-5.9.6/bindings/c++/plstream.cc 2010-06-06 00:11:39.000000000 +0800
--- plplot-5.9.6_p1/bindings/c++/plstream.cc 2010-09-24 09:53:24.056339651 +0800
***************
*** 328,333 ****
--- 328,343 ----
plarc( x, y, a, b, angle1, angle2, fill );
}
+
+ void
+ plstream::arcr( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, PLFLT rotate,
+ PLBOOL fill )
+ {
+ set_stream();
+
+ plarcr( x, y, a, b, angle1, angle2, rotate, fill );
+ }
+
void
plstream::arrows( PLFLT * u, PLFLT * v, PLFLT * x, PLFLT * y, PLINT n,
PLFLT scale, PLFLT dx, PLFLT dy )
diff -cr plplot-5.9.6/bindings/c++/plstream.h plplot-5.9.6_p1/bindings/c++/plstream.h
*** plplot-5.9.6/bindings/c++/plstream.h 2010-06-06 00:11:39.000000000 +0800
--- plplot-5.9.6_p1/bindings/c++/plstream.h 2010-09-24 09:53:25.856319962 +0800
***************
*** 123,128 ****
--- 123,134 ----
void arc( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2,
PLBOOL fill );
+
+ // Plot an rotate arc
+
+ void arcr( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, PLFLT rotate,
+ PLBOOL fill );
+
// Simple arrow plotter
void arrows( PLFLT *u, PLFLT *v, PLFLT *x, PLFLT *y, PLINT n,
diff -cr plplot-5.9.6/include/plplot.h plplot-5.9.6_p1/include/plplot.h
*** plplot-5.9.6/include/plplot.h 2010-06-06 00:11:39.000000000 +0800
--- plplot-5.9.6_p1/include/plplot.h 2010-09-24 09:37:53.036314838 +0800
***************
*** 623,628 ****
--- 623,629 ----
#define pl_setcontlabelparam c_pl_setcontlabelparam
#define pladv c_pladv
#define plarc c_plarc
+ #define plarcr c_plarcr
#define plaxes c_plaxes
#define plbin c_plbin
#define plbop c_plbop
***************
*** 839,845 ****
--- 840,852 ----
PLDLLIMPEXP void
c_plarc( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2,
PLBOOL fill );
+
+ /* Plot an rotated arc */
+ PLDLLIMPEXP void
+ c_plarcr( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, PLFLT rotate,
+ PLBOOL fill );
+
/* This functions similarly to plbox() except that the origin of the axes */
/* is placed at the user-specified point (x0, y0). */
diff -cr plplot-5.9.6/src/plarc.c plplot-5.9.6_p1/src/plarc.c
*** plplot-5.9.6/src/plarc.c 2010-06-06 00:11:39.000000000 +0800
--- plplot-5.9.6_p1/src/plarc.c 2010-11-02 13:01:16.260160438 +0800
***************
*** 141,143 ****
--- 141,242 ----
}
}
+
+ /*-------------------------------------------------------------------------
+ * c_plarcr : Plot an arc with rotate supportd.
+ *
+ * Takes the following arguments:
+ *
+ * x, y:
+ * x and y coordinates for the center of the arc
+ *
+ * a, b:
+ * Radius of the arc's major and minor axes
+ *
+ * angle1:
+ * Start angle (degrees)
+ *
+ * angle2:
+ * End angle (degrees)
+ *
+ * rotate:
+ * rotate angle ( degrees )
+ *
+ * fill:
+ * Should the arc be filled?
+ *
+ *-------------------------------------------------------------------------*/
+
+ void
+ plarcr_approx( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, PLFLT rotate, PLBOOL fill )
+ {
+
+ PLINT i;
+ PLFLT theta0, theta_step, theta, d_angle;
+
+ /* rotatd angle */
+ PLFLT alpha = DEG_TO_RAD( rotate );
+
+ PLFLT cos_alpha = cos( alpha );
+ PLFLT sin_alpha = sin( alpha );
+
+ PLFLT tmp_x;
+ PLFLT tmp_y;
+
+ PLINT segments;
+ PLFLT xs[CIRCLE_SEGMENTS], ys[CIRCLE_SEGMENTS];
+
+ /* The difference between the start and end angles */
+ d_angle = DEG_TO_RAD( angle2 - angle1 );
+ if ( fabs( d_angle ) > M_PI * 2.0 )
+ d_angle = M_PI * 2.0;
+
+ /* The number of line segments used to approximate the arc */
+ segments = d_angle / ( 2.0 * M_PI ) * CIRCLE_SEGMENTS;
+ /* Always use at least 2 arc points, otherwise fills will break. */
+ if ( segments < 2 )
+ segments = 2;
+ /* The start angle in radians and number of radians in each approximating
+ * segment. */
+ theta0 = DEG_TO_RAD( angle1 );
+
+ theta_step = d_angle / ( segments - 1 );
+
+ /* The coordinates for the circle outline */
+ for ( i = 0; i < segments; i++ )
+ {
+ theta = theta0 + theta_step * (PLFLT) i;
+
+ tmp_x = a * cos( theta );
+ tmp_y = b * sin( theta );
+
+ xs[i] = tmp_x * cos_alpha - tmp_y * sin_alpha + x;
+ ys[i] = tmp_y * cos_alpha + tmp_x * sin_alpha + y;
+ //xs[i] = a * ( cos( theta ) * cos_alpha - sin( theta ) * sin_alpha ) + x;
+ //ys[i] = b * ( cos( theta ) * sin_alpha + sin( theta ) * cos_alpha ) + y;
+ }
+
+ if ( fill )
+ {
+ /* Add the center point if we aren't drawing a circle */
+ if ( fabs( d_angle ) < M_PI * 2.0 )
+ {
+ xs[segments - 1] = x;
+ ys[segments - 1] = y;
+ }
+ /* Draw a filled arc */
+ plfill( segments, xs, ys );
+ }
+ else
+ {
+ /* Draw the arc outline */
+ plline( segments, xs, ys );
+ }
+ }
+
+ void
+ c_plarcr( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, PLFLT rotate, PLBOOL fill )
+ {
+ plarcr_approx( x, y, a, b, angle1, angle2, rotate, fill );
+ }
+
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel