Class GeoReprojection
- java.lang.Object
-
- com.metsci.glimpse.core.support.projection.GeoReprojection
-
- All Implemented Interfaces:
Projection
public class GeoReprojection extends Object implements Projection
-
-
Constructor Summary
Constructors Constructor Description GeoReprojection(Projection flat, GeoProjection from, GeoProjection to, double sizeDownsample)
Builds a projection which maps a texture which was rendered in one GeoProjection space into another GeoProjection space.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
void
getVertexXY(double dataFractionX, double dataFractionY, float[] resultXY)
Given a position in a rectangular array of data (the texture), return the corresponding location in physical units.void
getVertexXYZ(double dataFractionX, double dataFractionY, float[] resultXYZ)
Given a position in a rectangular array of data (the texture), return the corresponding location in physical units.
-
-
-
Constructor Detail
-
GeoReprojection
public GeoReprojection(Projection flat, GeoProjection from, GeoProjection to, double sizeDownsample)
Builds a projection which maps a texture which was rendered in one GeoProjection space into another GeoProjection space.
A common usage. This would take a texture which had been
GeoProjection from = new TangentPlane( LatLonGeo.fromDegrees( 0, 0 ) ); Axis2D axis = new Axis2D( ); Projection flat = new FlatProjection( ... ); GeoProjection to = new MercatorProjection( ); new GeoReprojection( flat, from, to );
- Parameters:
flat
- mapping from texture space to flat projection spacefrom
- current mapping from flat projection space to lat/lon spaceto
- desired mapping from flat projection space to lat/lon spacesizeX
- the discretization of the reprojection in the x directionsizeY
- the discretization of the reprojection in the y direction
-
-
Method Detail
-
getVertexXY
public void getVertexXY(double dataFractionX, double dataFractionY, 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 interfaceProjection
- Parameters:
dataFractionX
- a relative x index (from 0.0 to 1.0) into the data arraydataFractionY
- a relative y index (from 0.0 to 1.0) into the data arrayresultXY
- output parameter to be populated with physical coords of the data
-
getVertexXYZ
public void getVertexXYZ(double dataFractionX, double dataFractionY, 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 interfaceProjection
- Parameters:
dataFractionX
- a relative x index (from 0.0 to 1.0) into the data arraydataFractionY
- a relative y index (from 0.0 to 1.0) into the data arrayresultXYZ
- 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 interfaceProjection
- 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 interfaceProjection
- 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 )
-
-