Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/28/09 23:12:10 (15 years ago)
Author:
mstoeger
Message:

Added Xml comments for IShape, WorldShape and Transforms. (#406)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization/Transform.cs

    r931 r1234  
    22
    33namespace HeuristicLab.Visualization {
     4  /// <summary>
     5  /// GDI (or screen) coordinate system
     6  ///   The GDI coordinate system is specified in pixels. X goes from left to right
     7  ///   and Y goes from top to bottom.
     8  ///
     9  /// World coordinate system
     10  ///   A world coordinate system can be freely specified. X goes from left to
     11  ///   right and Y goes from bottom to top.
     12  ///
     13  /// The transformation between world- and screen-coordinate systems is done using
     14  /// a view port and a clipping area.
     15  /// </summary>
    416  public static class Transform {
    5 
    617    /// <summary>
    7     /// Screen to world transformations
     18    /// Transforms a rectangle in screen coordinates to world coordinates
    819    /// </summary>
    9     /// <param name="rect"></param>
    10     /// <param name="viewport"></param>
    11     /// <param name="clippingArea"></param>
    12     /// <returns></returns>
     20    /// <param name="rect">The rectangle in screen coordinates that should be transformed</param>
     21    /// <param name="viewport">The target view port</param>
     22    /// <param name="clippingArea">The target clipping area</param>
     23    /// <returns>The rectangle rect transformed to world coordinates</returns>
    1324    public static RectangleD ToWorld(Rectangle rect, Rectangle viewport, RectangleD clippingArea) {
    1425      double x1 = ToWorldX(rect.Left, viewport, clippingArea);
     
    1930    }
    2031
     32    /// <summary>
     33    /// Transforms a 2d point in screen coordinates to world coordinates
     34    /// </summary>
     35    /// <param name="point">The point in screen coordinates that should be transformed</param>
     36    /// <param name="viewport">The target view port</param>
     37    /// <param name="clippingArea">The target clipping area</param>
     38    /// <returns>The point transformed to world coordinates</returns>
    2139    public static PointD ToWorld(Point point, Rectangle viewport, RectangleD clippingArea) {
    2240      double x = ToWorldX(point.X, viewport, clippingArea);
     
    2543    }
    2644
     45    /// <summary>
     46    /// Transforms a point on the X-axis in screen coordinates to world coordinates
     47    /// </summary>
     48    /// <param name="x">The point on the X-axis in screen coordinates that should be transformed</param>
     49    /// <param name="viewport">The target view port</param>
     50    /// <param name="clippingArea">The target clipping area</param>
     51    /// <returns>The point transformed to world coordinates</returns>
    2752    public static double ToWorldX(int x, Rectangle viewport, RectangleD clippingArea) {
    2853      return clippingArea.X1 + clippingArea.Width/viewport.Width*(x - viewport.Left);
    2954    }
    3055
     56    /// <summary>
     57    /// Transforms a point on the Y-axis in screen coordinates to world coordinates
     58    /// </summary>
     59    /// <param name="y">The point on the Y-axis in screen coordinates that should be transformed</param>
     60    /// <param name="viewport">The target view port</param>
     61    /// <param name="clippingArea">The target clipping area</param>
     62    /// <returns>The point transformed to world coordinates</returns>
    3163    public static double ToWorldY(int y, Rectangle viewport, RectangleD clippingArea) {
    3264      return clippingArea.Y1 - clippingArea.Height/viewport.Height*(y - viewport.Bottom);
     
    3466
    3567    /// <summary>
    36     /// World to screen transformations
     68    /// Transforms a rectangle in world coordinates to screen coordinates
    3769    /// </summary>
    38     /// <param name="rect"></param>
    39     /// <param name="viewport"></param>
    40     /// <param name="clippingArea"></param>
    41     /// <returns></returns>
     70    /// <param name="rect">The rectangle in world coordinates that should be transformed</param>
     71    /// <param name="viewport">The target view port</param>
     72    /// <param name="clippingArea">The target clipping area</param>
     73    /// <returns>The rectangle rect transformed to screen coordinates</returns>
    4274    public static Rectangle ToScreen(RectangleD rect, Rectangle viewport, RectangleD clippingArea) {
    4375      int left = ToScreenX(rect.X1, viewport, clippingArea);
     
    4880    }
    4981
     82    /// <summary>
     83    /// Transforms a 2d point in world coordinates to screen coordinates
     84    /// </summary>
     85    /// <param name="point">The point in world coordinates that should be transformed</param>
     86    /// <param name="viewport">The target view port</param>
     87    /// <param name="clippingArea">The target clipping area</param>
     88    /// <returns>The point transformed to screen coordinates</returns>
    5089    public static Point ToScreen(PointD point, Rectangle viewport, RectangleD clippingArea) {
    5190      int x = ToScreenX(point.X, viewport, clippingArea);
     
    5493    }
    5594
     95    /// <summary>
     96    /// Transforms a point on the X-axis in world coordinates to screen coordinates
     97    /// </summary>
     98    /// <param name="x">The point on the X-axis in world coordinates that should be transformed</param>
     99    /// <param name="viewport">The target view port</param>
     100    /// <param name="clippingArea">The target clipping area</param>
     101    /// <returns>The point transformed to screen coordinates</returns>
    56102    public static int ToScreenX(double x, Rectangle viewport, RectangleD clippingArea) {
    57103      return (int)(viewport.Left + viewport.Width/clippingArea.Width*(x - clippingArea.X1));
    58104    }
    59105
     106    /// <summary>
     107    /// Transforms a point on the Y-axis in world coordinates to screen coordinates
     108    /// </summary>
     109    /// <param name="y">The point on the Y-axis in world coordinates that should be transformed</param>
     110    /// <param name="viewport">The target view port</param>
     111    /// <param name="clippingArea">The target clipping area</param>
     112    /// <returns>The point transformed to screen coordinates</returns>
    60113    public static int ToScreenY(double y, Rectangle viewport, RectangleD clippingArea) {
    61114      return (int)(viewport.Bottom - viewport.Height/clippingArea.Height*(y - clippingArea.Y1));
Note: See TracChangeset for help on using the changeset viewer.