bugs: Increase invariant variety in incremental renderer.
[Ale.git] / ale_pos.h
blobdc6b027b8e57a1d06c8e182d6c9e5f2cf701e4e2
1 // Copyright 2002, 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __ale_pos_h__
22 #define __ale_pos_h__
24 #include "ale_fixed.h"
26 #define SINGLE 1
27 #define DOUBLE 2
28 #define FIXED16 3
29 #define FIXED32 4
32 * Real-valued type used to represent coordinates in an image domain.
35 #if ALE_COORDINATES == SINGLE
37 typedef float ale_pos;
39 #define ALE_POS_PRECISION_STRING "SINGLE"
41 #define ale_pos_disable_casting()
42 #define ale_pos_enable_casting()
43 #define ale_pos_casting_status() 1
45 #elif ALE_COORDINATES == DOUBLE
47 typedef double ale_pos;
49 #define ALE_POS_PRECISION_STRING "DOUBLE"
51 #define ale_pos_disable_casting()
52 #define ale_pos_enable_casting()
53 #define ale_pos_casting_status() 1
55 #elif ALE_COORDINATES == FIXED32
57 typedef ale_fixed<ale_fixed_32,16> ale_pos;
59 #define ALE_POS_PRECISION_STRING "FIXED32"
61 #define ale_pos_disable_casting() ale_pos::disable_casting()
62 #define ale_pos_enable_casting() ale_pos::enable_casting()
63 #define ale_pos_casting_status() ale_pos::casting_status()
65 #elif ALE_COORDINATES == FIXED16
67 typedef ale_fixed<ale_fixed_16_calc,10> ale_pos;
69 #define ALE_POS_PRECISION_STRING "FIXED16"
71 #define ale_pos_disable_casting() ale_pos::disable_casting()
72 #define ale_pos_enable_casting() ale_pos::enable_casting()
73 #define ale_pos_casting_status() ale_pos::casting_status()
75 #else
77 #warning Unknown positional precision in ale_pos.h: Choosing PPRECISION=SINGLE.
79 typedef float ale_pos;
81 #define ALE_POS_PRECISION_STRING "SINGLE"
83 #define ale_pos_disable_casting()
84 #define ale_pos_enable_casting()
85 #define ale_pos_casting_status() 1
87 #endif
89 const ale_pos ale_pos_0 = (ale_pos) 0;
91 #if ALE_COLORS == FIXED && ALE_COORDINATES == FIXED
93 #define ale_pos_to_real(x) (x)
94 #define ale_real_to_pos(x) (x)
96 #else
98 #define ale_pos_to_real(x) (x)
99 #define ale_real_to_pos(x) (x)
101 #endif
103 #undef SINGLE
104 #undef DOUBLE
105 #undef HALF
106 #undef FIXED16
107 #undef FIXED32
109 #endif