Main Page   Class Hierarchy   Compound List   File List   Compound Members  

GlIsoMath Class Reference

A utility class for performing math transformations in an Isometric view. More...

#include <glisomath.h>

List of all members.

Public Methods

 GlIsoMath (int tileWidth, int tileHeight)
 A more useable transformation object. More...

void SetScreenBaseToOrigin (int screenW, int screenH)
 Set the screen so that the bottom center of the screen is at tile 0,0.

void SetScreenCenterToTile (int screenW, int screenH, int tileX, int tileY, int tileZ)
 Set the screen center so that it "looks" at the given tile.

void SetScreenToTile (int screenX, int screenY, int tileX, int tileY, int tileZ)
 Set an arbitrary screen point to an arbitrary tile.

void TileToScreen (GlFixed tileX, GlFixed tileY, GlFixed tileZ, int *screenX, int *screenY) const
 Coverts from tile coordinates to screen coordinates.

void ScreenToFlatTile (int screenX, int screenY, GlFixed tileZ, GlFixed *tileX, GlFixed *tileY) const
 Converts from screen to map, for a known mapZ = worldZ. More...


Static Public Methods

void TileToScreen (GlFixed tileX, GlFixed tileY, GlFixed tileZ, int tileWidth, int tileHeight, int screenOffsetX, int screenOffsetY, GlFixed *screenX, GlFixed *screenY)
 Transform tile to screen.

void ScreenToFlatTile (GlFixed screenX, GlFixed screenY, GlFixed tileZ, int tileWidth, int tileHeight, int screenOffsetX, int screenOffsetY, GlFixed *tileX, GlFixed *tileY)
 Transform from screen coordinates to tile coordinates, if you know the tileZ of the transform, as input.

void TileToWorld (GlFixed tileX, GlFixed tileY, GlFixed tileZ, GlFixed *worldX, GlFixed *worldY, GlFixed *worldZ)
 Tile to world. More...


Detailed Description

A utility class for performing math transformations in an Isometric view.

An Iso view is a quasi-3D view of tiles and cubes in 3-D space. In screen view, the cube is exactly twice as wide is it is high.

The coordinate spaces referenced are:

Tile: Cubic tile space, or map space. So a "10x10 map" would be equivalent to 10 by 10 "tiles". Tile space is true 3D and has fixed point coordinates.

World: An intermediate coordinate system. World coordinates are rotated 45 degrees from tile coordinates, but have the same dimensions.

View: An intermediate coordinate system. View coordinates are rotated to world, but aligned with the screen.

Screen: A 2-D coordinate system. Pixel coordinates.

The class can be used via its static functions, which provide general transforms. It is usually easier, however, to construct an isoMath object and use the "normal" methods.


Constructor & Destructor Documentation

GlIsoMath::GlIsoMath int    tileWidth,
int    tileHeight
 

A more useable transformation object.

Should be followed by SetScreen... in order to view in a useful way.


Member Function Documentation

void GlIsoMath::ScreenToFlatTile int    screenX,
int    screenY,
GlFixed    tileZ,
GlFixed   tileX,
GlFixed   tileY
const
 

Converts from screen to map, for a known mapZ = worldZ.

The map doesn't have to be flat, just the area of transformation.

void GlIsoMath::TileToWorld GlFixed    tileX,
GlFixed    tileY,
GlFixed    tileZ,
GlFixed   worldX,
GlFixed   worldY,
GlFixed   worldZ
[static]
 

Tile to world.

Generally an internal transformation. Note that this can introduct rounding errors!


The documentation for this class was generated from the following file:
Generated on Mon Sep 15 12:01:11 2003 for Kyra by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001