org.xith3d.ui.hud
Class HUDCoordinatesConverter

java.lang.Object
  extended by org.xith3d.ui.hud.HUDCoordinatesConverter

public class HUDCoordinatesConverter
extends java.lang.Object

The coordinates converter converts sizes and locations from and to different coortinate spaces.


Constructor Summary
HUDCoordinatesConverter(HUD hud)
           
 
Method Summary
 void getAbsoluteLocationOnHUD(Widget widget, org.openmali.vecmath2.Tuple2f buffer)
          Computes the absolute position of the given Widget on the HUD.
 float getEqualHeight(float width)
          Calculates a height that's visually equal to the given width.
 float getEqualWidth(float height)
           
 HUD getHUD()
           
<Tuple2i_ extends org.openmali.vecmath2.Tuple2i>
Tuple2i_
getLocationHUD2Pixels(float x, float y, Tuple2i_ buffer)
          Calculates pixel location from these HUD-values.
<Tuple2f_ extends org.openmali.vecmath2.Tuple2f>
Tuple2f_
getLocationHUD2SG(float x, float y, Tuple2f_ buffer)
          Calculates scenegraph location from these HUD-values.
<Tuple2f_ extends org.openmali.vecmath2.Tuple2f>
Tuple2f_
getLocationPixels2HUD(int x, int y, Tuple2f_ buffer)
          Calculates HUD location from these pixel-values.
<Tuple2f_ extends org.openmali.vecmath2.Tuple2f>
Tuple2f_
getLocationSG2HUD(float x, float y, Tuple2f_ buffer)
          Calculates HUD location from these scenegraph-values.
<Dim2i_ extends org.openmali.types.twodee.Dim2i>
Dim2i_
getSizeHUD2Pixels(float w, float h, Dim2i_ buffer)
          Calculates pixel size from these HUD-values.
<Dim2f_ extends org.openmali.types.twodee.Dim2f>
Dim2f_
getSizeHUD2SG(float w, float h, Dim2f_ buffer)
          Calculates scenegraph width and height from these HUD-values.
<Dim2f_ extends org.openmali.types.twodee.Dim2f>
Dim2f_
getSizeOfPixels(int x, int y, Dim2f_ buffer)
          Retrieves the size these pixels have on this WidgetContainer.
<Dim2f_ extends org.openmali.types.twodee.Dim2f>
Dim2f_
getSizePixels2HUD(int w, int h, Dim2f_ buffer)
          Calculates HUD size from these pixel-values.
<Dim2f_ extends org.openmali.types.twodee.Dim2f>
Dim2f_
getSizeSG2HUD(float w, float h, Dim2f_ buffer)
          Calculates HUD size from these scenegraph-values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HUDCoordinatesConverter

public HUDCoordinatesConverter(HUD hud)
Method Detail

getHUD

public final HUD getHUD()

getEqualWidth

public final float getEqualWidth(float height)
Parameters:
height - the height to calculate a visually equal width
Returns:
a width that's visually equal to the given width

getEqualHeight

public final float getEqualHeight(float width)
Calculates a height that's visually equal to the given width.

Parameters:
width - the width to calculate a visually equal height
Returns:
the buffer back again

getSizePixels2HUD

public final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizePixels2HUD(int w,
                                                                                       int h,
                                                                                       Dim2f_ buffer)
Calculates HUD size from these pixel-values.

Parameters:
w - the canvas-x-value to transform
h - the canvas-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getLocationPixels2HUD

public final <Tuple2f_ extends org.openmali.vecmath2.Tuple2f> Tuple2f_ getLocationPixels2HUD(int x,
                                                                                             int y,
                                                                                             Tuple2f_ buffer)
Calculates HUD location from these pixel-values.

Parameters:
x - the canvas-x-value to transform
y - the canvas-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getSizeHUD2Pixels

public final <Dim2i_ extends org.openmali.types.twodee.Dim2i> Dim2i_ getSizeHUD2Pixels(float w,
                                                                                       float h,
                                                                                       Dim2i_ buffer)
Calculates pixel size from these HUD-values.

Parameters:
w - the HUD-x-value to transform
h - the HUD-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getLocationHUD2Pixels

public final <Tuple2i_ extends org.openmali.vecmath2.Tuple2i> Tuple2i_ getLocationHUD2Pixels(float x,
                                                                                             float y,
                                                                                             Tuple2i_ buffer)
Calculates pixel location from these HUD-values.

Parameters:
x - the HUD-x-value to transform
y - the HUD-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getSizeHUD2SG

public final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizeHUD2SG(float w,
                                                                                   float h,
                                                                                   Dim2f_ buffer)
Calculates scenegraph width and height from these HUD-values.

Parameters:
w - the HUD-x-value to transform
h - the HUD-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getLocationHUD2SG

public final <Tuple2f_ extends org.openmali.vecmath2.Tuple2f> Tuple2f_ getLocationHUD2SG(float x,
                                                                                         float y,
                                                                                         Tuple2f_ buffer)
Calculates scenegraph location from these HUD-values.

Parameters:
x - the HUD-x-value to transform
y - the HUD-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getSizeSG2HUD

public final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizeSG2HUD(float w,
                                                                                   float h,
                                                                                   Dim2f_ buffer)
Calculates HUD size from these scenegraph-values.

Parameters:
w - the scenegraph-x-value to transform
h - the scenegraph-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getLocationSG2HUD

public final <Tuple2f_ extends org.openmali.vecmath2.Tuple2f> Tuple2f_ getLocationSG2HUD(float x,
                                                                                         float y,
                                                                                         Tuple2f_ buffer)
Calculates HUD location from these scenegraph-values.

Parameters:
x - the scenegraph-x-value to transform
y - the scenegraph-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getSizeOfPixels

public final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizeOfPixels(int x,
                                                                                     int y,
                                                                                     Dim2f_ buffer)
Retrieves the size these pixels have on this WidgetContainer.

Parameters:
x - the x-count of pixels
y - the y-count of pixels
buffer - the buffer to write the values to
Returns:
the buffer back again

getAbsoluteLocationOnHUD

public final void getAbsoluteLocationOnHUD(Widget widget,
                                           org.openmali.vecmath2.Tuple2f buffer)
Computes the absolute position of the given Widget on the HUD.

Parameters:
widget -
buffer -