com.metsci.glimpse.support.projection
Class PolarProjection

java.lang.Object
  extended by com.metsci.glimpse.support.projection.PolarProjection
All Implemented Interfaces:
InvertibleProjection, Projection

public class PolarProjection
extends java.lang.Object
implements Projection, InvertibleProjection

A projection which maps a texture into a circle or annulus (or an angular wedge of the above).

Author:
ulman

Constructor Summary
PolarProjection(double minRange, double maxRange, double startTheta, double endTheta)
           
PolarProjection(double minRange, double maxRange, double startTheta, double endTheta, boolean rangeIsX)
           
PolarProjection(double centerX, double centerY, double minRange, double maxRange, double startTheta, double endTheta)
           
PolarProjection(double centerX, double centerY, double minRange, double maxRange, double startTheta, double endTheta, boolean rangeIsX)
           
 
Method Summary
 double diffTheta(double startTheta, double endTheta)
           
 double getCenterX()
           
 double getCenterY()
           
 double getEndTheta()
           
 double getMaxRange()
           
 double getMinRange()
           
 int getSizeX(int textureSizeX)
          Returns the number of quads in the x direction that the array of data (the texture) should be broken into.
 int getSizeY(int textureSizeY)
           
 double getStartTheta()
           
 double getTextureFractionX(double vertexX, double vertexY)
          Given a position in physical units, return the corresponding location within a rectangular array of data.
 double getTextureFractionY(double vertexX, double vertexY)
           
 void getVertexXY(double textureFractionX, double textureFractionY, float[] resultXY)
          Given a position in a rectangular array of data (the texture), return the corresponding location in physical units.
 void getVertexXYZ(double textureFractionX, double textureFractionY, float[] resultXYZ)
          Given a position in a rectangular array of data (the texture), return the corresponding location in physical units.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolarProjection

public PolarProjection(double centerX,
                       double centerY,
                       double minRange,
                       double maxRange,
                       double startTheta,
                       double endTheta,
                       boolean rangeIsX)

PolarProjection

public PolarProjection(double centerX,
                       double centerY,
                       double minRange,
                       double maxRange,
                       double startTheta,
                       double endTheta)

PolarProjection

public PolarProjection(double minRange,
                       double maxRange,
                       double startTheta,
                       double endTheta,
                       boolean rangeIsX)

PolarProjection

public PolarProjection(double minRange,
                       double maxRange,
                       double startTheta,
                       double endTheta)
Method Detail

diffTheta

public double diffTheta(double startTheta,
                        double endTheta)

getMinRange

public double getMinRange()

getMaxRange

public double getMaxRange()

getStartTheta

public double getStartTheta()

getEndTheta

public double getEndTheta()

getCenterX

public double getCenterX()

getCenterY

public double getCenterY()

getVertexXY

public void getVertexXY(double textureFractionX,
                        double textureFractionY,
                        float[] resultXY)
Description copied from interface: Projection
Given a position in a rectangular array of data (the texture), return the corresponding location in physical units. The position is given as relative coordinates, with 0.0 indicating the 0th data index and 1.0 indicating the last data index.

This method computes the physical coordinate of the data at (textureFractionX, textureFractionY), and stores them in the resultXY output parameter.

Specified by:
getVertexXY in interface Projection
Parameters:
textureFractionX - a relative x index (from 0.0 to 1.0) into the data array
textureFractionY - a relative y index (from 0.0 to 1.0) into the data array
resultXY - output parameter to be populated with physical coords of the data

getVertexXYZ

public void getVertexXYZ(double textureFractionX,
                         double textureFractionY,
                         float[] resultXYZ)
Description copied from interface: Projection
Given a position in a rectangular array of data (the texture), return the corresponding location in physical units. The position is given as relative coordinates, with 0.0 indicating the 0th data index and 1.0 indicating the last data index.

This method computes the physical coordinate of the data at (textureFractionX, textureFractionY), and stores them in the resultXYZ output parameter.

Assigning z coordinates to vertices can be useful even for 2D graphics. For example, it can be used together with z-clipping to avoid rendering some facets.

Specified by:
getVertexXYZ in interface Projection
Parameters:
textureFractionX - a relative x index (from 0.0 to 1.0) into the data array
textureFractionY - a relative y index (from 0.0 to 1.0) into the data array
resultXYZ - output parameter to be populated with physical coords of the data

getSizeX

public int getSizeX(int textureSizeX)
Description copied from interface: Projection
Returns the number of quads in the x direction that the array of data (the texture) should be broken into. If the projection is linear in the x direction (for example, if the data/texture is simply being displayed on a rectangle) then only one quad is needed.

For more complicated projections, the value returned essentially defines the granularity or resolution of the projection (since the projection will ultimately be approximated when displayed by drawing a set of small quads).

Specified by:
getSizeX in interface Projection
Parameters:
textureSizeX - the length of the data array (the texture) in the x direction
Returns:
the number of quads in the x direction to draw

getSizeY

public int getSizeY(int textureSizeY)
Specified by:
getSizeY in interface Projection
Parameters:
textureSizeY - the length of the data array (the texture) in the y direction
Returns:
the number of quads in the y direction to draw
See Also:
Projection.getSizeX( int )

getTextureFractionX

public double getTextureFractionX(double vertexX,
                                  double vertexY)
Description copied from interface: InvertibleProjection
Given a position in physical units, return the corresponding location within a rectangular array of data. The corresponding location is returned in relative coordinates, with 0.0 indicating the 0th data index and 1.0 indicating the last data index.

This method returns the first (row) index of the data at (vertexX, vertexY).

Specified by:
getTextureFractionX in interface InvertibleProjection
Parameters:
vertexX - a x coordinate in physical space
vertexY - a y coordinate in physical space
Returns:
a relative index (from 0.0 to 1.0) into the data array

getTextureFractionY

public double getTextureFractionY(double vertexX,
                                  double vertexY)
Specified by:
getTextureFractionY in interface InvertibleProjection
Parameters:
vertexX - a x coordinate in physical space
vertexY - a y coordinate in physical space
Returns:
the relative y index (from 0.0 to 1.0) into the data array
See Also:
InvertibleProjection.getTextureFractionX( double, double )


Copyright © 2012 Metron, Inc.. All Rights Reserved.