HTML5 Canvas 2D Library
 

taccGL Library Coordinate System

For 2D operation taccgl™ uses the same coordinates as HTML. Coordintes are measured in pixes starting with 0 in the top left corner of the document. So x coordinates grow from left to right and y coordinates from top to bottom (in contrast to mathematics where y coordintas usually grow bottom up). Although (in 2D) points with negative coordinates are invisible taccgl™ is still capable of processing negative coordinates. Coordinates are all floating point values and so transitions can also be positioned at subpixel level.

taccgl™ uses a fixed sized canvas for drawing of textures (currently per default 1200*1424 pixels) and so HTML elements outside this range need to be mapped. See Texture Canvas for details. This limitation only applies to textures not generally for coordinates of transitions.

taccgl™ always operates in a 3D space; 2D operation just means that z-coordinates are 0. All HTML elements sit in a plane with z-coordinate 0. Positive z-coordinates run away from the user, denote objects behind the screen and behind the other HTML elements. Negative z-coordintates describe objects between the user and the screen. The user is supposed to be sitting (per default) at coordinates (0,0,-5000) looking towards (0,0,0) at the objects on the screen from top, left.

The 3D mapping used by taccgl™ is chosen in a very special way, so that all objects in the z=0 plane are mapped onto themselves, i.e. to the same x and y coordinates. This way HTML elements drawn by the browser fit into a 3D scene drawn on the canvas and always stay readable without any perspective distortion.

The eye point can be changed slightly, e.g. positioning the user below or to the right of the screen. However, the user always looks in the (0,0,1) direction with is othogonal to the screen and the z=0 plane. Even if the eye point is moved, the projection is still moved and scaled in a way that the z=0 plane is mapped onto itself as described above.

So taccgl™ as it stands right now is not (and unlike many other canvas 3D / WebGL™ libraries) made for games that show a user moving and turing around in a 3D model, but instead the idea of taccgl™ is to show moving 2D and 3D objects on the screen, keeping the user, the screen, and other HTML elements is a fixed position. This limitation makes it possible to combine HTML elements and animations in one scene and so to really animate an HTML page rather than having a more or less independent animation.

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:Texture Canvas
Previous Page: Canvas Operation