Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## nl.tudelft.simulation.dsol.animation.D2
Class Renderable2DInterface.Util

    java.lang.Object
      nl.tudelft.simulation.dsol.animation.D2.Renderable2DInterface.Util

Enclosing class:
  Renderable2DInterface

public static class Renderable2DInterface.Util
extends java.lang.Object

A Util
(c) copyright 2003 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: General Public License (GPL) , no warranty

Version:
  1.0 Mar 1, 2004
Author:
  Peter Jacobs

Constructor Summary
`protected` | `Renderable2DInterface.Util()` constructs a new Util

Method Summary
`static java.awt.geom.Rectangle2D` | `computeVisibleExtent(java.awt.geom.Rectangle2D extent, java.awt.Dimension screen)` computes the visible extent
`static double` | `getScale(java.awt.geom.Rectangle2D extent, java.awt.Dimension screen)` returns the scale of a screen compared to an extent.
`static java.awt.geom.Point2D` | `getScreenCoordinates(java.awt.geom.Point2D worldCoordinates, java.awt.geom.Rectangle2D extent, java.awt.Dimension screen)` returns the frame xy-coordinates of a point in world coordinates.
`static java.awt.geom.Point2D` | `getWorldCoordinates(java.awt.geom.Point2D screenCoordinates, java.awt.geom.Rectangle2D extent, java.awt.Dimension screen)` returns the frame xy-coordinates of a point in screen coordinates.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Renderable2DInterface.Util

    protected Renderable2DInterface.Util()

  constructs a new Util

Method Detail

### getScale

    public static double getScale(java.awt.geom.Rectangle2D extent,
                                  java.awt.Dimension screen)

  returns the scale of a screen compared to an extent. The scale can only be computed if the xScale and yScale are equal. If this is not the case, Double.NaN is returned. In order to overcome estimation errors, this equality is computed with Math.abs(yScale-xScale) <0.005xScale. If the height or the width of the screen are <0 Double.NaN is returned.

  Parameters:
    `extent` - the extent
    `screen` - the screen
  Returns:
    double the scale. Can return Double.NaN

### computeVisibleExtent

    public static java.awt.geom.Rectangle2D computeVisibleExtent(java.awt.geom.Rectangle2D extent,
                                                                 java.awt.Dimension screen)

  computes the visible extent

  Parameters:
    `extent` - the extent
    `screen` - the screen
  Returns:
    a new extent or null if parameters are null or screen is invalid ( <0)

### getScreenCoordinates

    public static java.awt.geom.Point2D getScreenCoordinates(java.awt.geom.Point2D worldCoordinates,
                                                             java.awt.geom.Rectangle2D extent,
                                                             java.awt.Dimension screen)

  returns the frame xy-coordinates of a point in world coordinates. If parameters are invalid (i.e. screen.size <0) a null value is returned. If parameter combinations (i.e !extent.contains(point)) are invalid a null value is returned.

  Parameters:
    `worldCoordinates` - the world coordinates
    `extent` - the extent of this
    `screen` - the screen
  Returns:
    Point2D (x,y) on screen. Can be null

### getWorldCoordinates

    public static java.awt.geom.Point2D getWorldCoordinates(java.awt.geom.Point2D screenCoordinates,
                                                            java.awt.geom.Rectangle2D extent,
                                                            java.awt.Dimension screen)

  returns the frame xy-coordinates of a point in screen coordinates. If parameters are invalid (i.e. screen.size <0) a null value is returned. If parameter combinations (i.e !screen.contains(point)) are invalid a null value is returned.

  Parameters:
    `screenCoordinates` - the screen coordinates
    `extent` - the extent of this
    `screen` - the screen
  Returns:
    Point2D (x,y) on screen

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2004 Delft University of Technology, the Netherlands. All Rights Reserved.