From: Hywel T. <hy...@co...> - 2008-06-02 10:24:30
|
This patch corrects the TicksAngle code in Axis.cs Files affected: Axis.cs, PlotSurface2DDemo.cs TicksAngle is defined to be anti-clockwise from the axis direction for a positive angle (as is conventional for 2D coordinates). However, because the physical (pixel) origin in System.Drawing.Graphics is at the top left of the screen, rotations (as in RotateTransform) are clockwise. This has caused some confusion when drawing the Ticks, and the code uses both the negative of the TicksAngle and the (A-B) trignometrical formula to rotate the tick. The above changes have been made, the formulae have been rearranged, and some additional comments added to the code to clarify it (hopefully!) In addition, it is conventional to place ticks *outside* the plot area (ie to the left of the positive Y_axis and below the positive X-axis) so that the default values for a new Axis should be:- TicksAngle_ = 3.0f * PI / 2.0f; // or -PI/2.0f TickTextNextToAxis = false; and these changes have been made to the Axis constructor routine. The axis constructors in PlotSurface2D.cs have the correct TicksAngle defined and do not need changing. Only one of the demo routines (Mockup demo) uses specific values for TicksAngle, and the default values will now be correct. Lines have been removed from PlotSurface2DDemo.cs to allow the default values to stand. Note that in all demos, the Ticks are now drawn outside the plot area (which is the convention), and if the original appearance is preferred, TicksAngle must be set to PI/2.0f specifically. |