Subversion Repositories gelsvn

Rev

Rev 210 | Rev 596 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 210 Rev 216
1
GEL README, Andreas Bærentzen, February 2006.
1
GEL README, Andreas Bærentzen, February 2006.
2
==========
2
==========
3
 
3
 
4
This README describes the GEL project. GEL stands for Geometry and Linear 
4
This README describes the GEL project. GEL stands for Geometry and Linear 
5
Algebra which are the constituents we will mostly put into this library.
5
Algebra which are the constituents we will mostly put into this library. It is
-
 
6
intended as a library for computer graphics and computer vision tasks with a
-
 
7
strong emphasis on the handling of shape and geometry. 
6
 
8
 
7
There are a good many tools for computational geometry processing: A
9
GEL is broken down into a number of libraries, and the overall structure is as
8
voxel grid and a simple triangle mesh data structure. There is also halfedge 
-
 
9
based polygonal mesh data structure called HMesh. There is a very
-
 
10
useful data structure known as a k-D tree and many other things. 
10
follows:
11
 
11
 
-
 
12
- CGLA is a library targeted at vectors and matrices of dimensions 2,3, and
12
Also found are two packages for linear algebra: CGLA is strictly for
13
  4. CGLA is useful in computer graphics where small efficient vectors are
-
 
14
	everywhere.
-
 
15
- LinAlg is a very simple Lapack wrapper which simplifies solving (large)
-
 
16
  linear systems. 
-
 
17
- Geometry contains (mostly) Spatial data structures. There are voxel grid
13
small vectors and matrices. LinAlg is a Lapack wrapper for slightly
18
	class templates and a K-D tree template. There is also a triangle mesh class
-
 
19
	useful for real time rendering.
-
 
20
- HMesh is a half edge based polygonal mesh data structure. This is useful for
14
larger problems. At this point, it is fairly simple. 
21
	algorithms which change mesh connectivity.
-
 
22
- GLGraphics contains Tools for visualization. There is a trackball and some
-
 
23
	other OpenGL compatible tools.
-
 
24
- Util contains various utilities such as hash table classes, a tool for
-
 
25
	command line arguments, a 2D grid class, a resource manager and other
-
 
26
	miscellany.  
15
 
27
 
16
Finally there are some utilities in Util: Getting command line
-
 
17
arguments, hash table classes, a 2D grid class, a resource manager and
-
 
18
other miscellany. 
-
 
19
 
-
 
20
GEL is intended for use both under a  variety of unix platforms (Linux
28
GEL is intended for use both under a variety of unix platforms (Linux
21
and OSX in particular) and  under windows. This README is mostly for
29
and OSX in particular) and  under windows. This README is mostly for
22
unix users. Windows users should also consult README_MSVC
30
unix users. Windows users should also consult README_MSVC
23
 
31
 
24
Dependencies: GEL depends on the Developers Image Library DevIL,
32
Dependencies: GEL depends on the Developers Image Library DevIL,
25
Lapack, and OpenGL and GLUT. However, most of GEL does not require
33
Lapack, and OpenGL and GLUT. However, most of GEL does not require
26
these dependencies. In particular, you do not need DevIL except if you
34
these dependencies. In particular, you do not need DevIL except if you
27
want the OBJ viewer example program.
35
want the OBJ viewer example program.
28
 
36
 
29
Who made GEL
37
Who made GEL
30
==========
38
==========
31
 
39
 
32
GEL is mostly the work of Andreas Bærentzen, but other people
40
GEL is mostly the work of Andreas Bærentzen, but other people
33
contribute. In particular, Jeppe Frisvad, Bjarke Jakobsen, Henrik
41
contribute. In particular, Jeppe Frisvad, Bjarke Jakobsen, Henrik
34
Aanæs, and Bent D. Larsen. We are all from Informatics and
42
Aanæs, and Bent D. Larsen. We are all from Informatics and
35
Mathematical Modelling, a department of the Technical University of
43
Mathematical Modelling, a department of the Technical University of
36
Denmark. 
44
Denmark. 
37
 
45
 
38
Regarding LICENSE.
46
Regarding LICENSE.
39
==========
47
==========
40
 
48
 
41
I was considering putting GEL under the LGPL. But it is a long complex
49
I was considering putting GEL under the LGPL. But it is a long complex
42
text. The longer any kind of document, the more chances for loopholes
50
text. The longer any kind of document, the more chances for loopholes
43
in my opinion. Instead, I list a few simple rules below. The most
51
in my opinion. Instead, I list a few simple rules below. The most
44
important one is that if you want to use GEL for some purpose, and it
52
important one is that if you want to use GEL for some purpose, and it
45
is not crystal clear whether it is against the rules, contact me. As
53
is not crystal clear whether it is against the rules, contact me. As
46
for the rules:
54
for the rules:
47
 
55
 
48
You are allowed to use GEL for academic or commercial purposes. In
56
You are allowed to use GEL for academic or commercial purposes. In
49
particular, you are welcome to give GEL to students as a basis for 
57
particular, you are welcome to give GEL to students as a basis for 
50
academic work or to use it for your own applications.
58
academic work or to use it for your own applications.
51
 
59
 
52
The biggest limitation that I want to impose is that you cannot repackage
60
The biggest limitation that I want to impose is that you cannot repackage
53
GEL in any way. You are not allowed to distribute another library which
61
GEL in any way. You are not allowed to distribute another library which
54
contains GEL or parts of GEL unless you make it clear that this other
62
contains GEL or parts of GEL unless you make it clear that this other
55
library contains GEL. You are also not allowed to redistribute GEL in a
63
library contains GEL. You are also not allowed to redistribute GEL in a
56
changed form. If you want changes to be made, contact me.
64
changed form. If you want changes to be made, contact me.
57
 
65
 
58
Of course, neither I nor my employer will give you any money or be
66
Of course, neither I nor my employer will give you any money or be
59
held responsible in any way, under any circumstances what so ever - no
67
held responsible in any way, under any circumstances what so ever - no
60
matter what sort of damage GEL might inflict upon you. Not that I can
68
matter what sort of damage GEL might inflict upon you. Not that I can
61
foresee GEL causing you any damage :-) 
69
foresee GEL causing you any damage :-) 
62
 
70
 
63
If anything is unclear, please contact me. In fact, if you want to use
71
If anything is unclear, please contact me. In fact, if you want to use
64
GEL for a bigger project, I'd appreciate an email to jab@imm.dtu.dk
72
GEL for a bigger project, I'd appreciate an email to jab@imm.dtu.dk
65
 
73
 
66
In a project such as this, it is almost impossible to completely avoid
74
In a project such as this, it is almost impossible to completely avoid
67
building upon fragments of other peoples source code. GEL includes an
75
building upon fragments of other peoples source code. GEL includes an
68
obj loader based on work by Nate Robins. Some pieces of source code
76
obj loader based on work by Nate Robins. Some pieces of source code
69
from Graphics Gems have also been used. All of this amounts to only a
77
from Graphics Gems have also been used. All of this amounts to only a
70
small fraction of the GEL source code and it should not be in
78
small fraction of the GEL source code and it should not be in
71
violation of any license. Should you disagree, contact me, and I will
79
violation of any license. Should you disagree, contact me, and I will
72
rectify the situation.
80
rectify the situation.
73
 
81
 
74
----------------------------------------------------------------------
82
----------------------------------------------------------------------
75
1. INTRODUCTION
83
1. INTRODUCTION
76
----------------------------------------------------------------------
84
----------------------------------------------------------------------
77
 
85
 
78
In the following, I discuss the structure of the source code and how to
86
In the following, I discuss the structure of the source code and how to
79
add new directories to the framework. 
87
add new directories to the framework. 
80
 
88
 
81
The idea is that this framework should be a) simple to use and b) let 
89
The idea is that this framework should be a) simple to use and b) let 
82
people easily compile the same source code under various unix platforms.
90
people easily compile the same source code under various unix platforms.
83
A seperate configuration is kept for each combination of OS, architecture, 
91
A seperate configuration is kept for each combination of OS, architecture, 
84
and compiler. It is possible to specify targets release or debug.
92
and compiler. It is possible to specify targets release or debug.
85
 
93
 
86
Source files are compiled in build directories, and separate build 
94
Source files are compiled in build directories, and separate build 
87
directories are kept for each unique combination of 
95
directories are kept for each unique combination of 
88
 
96
 
89
os architecture compiler target
97
os architecture compiler target
90
 
98
 
91
such as
99
such as
92
 
100
 
93
Linux_i686_g++3_debug
101
Linux_i686_g++3_debug
94
 
102
 
95
this makes it easier to work in a heterogenous environment or to 
103
this makes it easier to work in a heterogenous environment or to 
96
experiment with seperate compilers or just to switch between debug mode 
104
experiment with seperate compilers or just to switch between debug mode 
97
and optimized.
105
and optimized.
98
 
106
 
99
To see how to use the framework, you may skip to section 5.
107
To see how to use the framework, you may skip to section 5.
100
 
108
 
101
----------------------------------------------------------------------
109
----------------------------------------------------------------------
102
2. DIRECTORY STRUCTURE
110
2. DIRECTORY STRUCTURE
103
----------------------------------------------------------------------
111
----------------------------------------------------------------------
104
 
112
 
105
The directories under the root of the source tree (where you find this 
113
The directories under the root of the source tree (where you find this 
106
README) are
114
README) are
107
 
115
 
108
src        - Source code for GEL libraries
116
src        - Source code for GEL libraries
109
apps       - Source code for applications
117
apps       - Source code for applications
110
apps       - Source code for test programs
118
apps       - Source code for test programs
111
doc        - Documentation
119
doc        - Documentation
112
bin        - Executables
120
bin        - Executables
113
lib        - Libraries
121
lib        - Libraries
114
makefiles  - As the name suggests, makefiles
122
makefiles  - As the name suggests, makefiles
115
 
123
 
116
src contains a number of subdirectories each of which represents a 
124
src contains a number of subdirectories each of which represents a 
117
link library. apps  also contains subdirectories, however each of these
125
link library. apps  also contains subdirectories, however each of these
118
is supposed to contain source code for an executable.
126
is supposed to contain source code for an executable.
119
 
127
 
120
----------------------------------------------------------------------
128
----------------------------------------------------------------------
121
3. FILE NAMES
129
3. FILE NAMES
122
----------------------------------------------------------------------
130
----------------------------------------------------------------------
123
 
131
 
124
source files are *.c or *.cpp depending on whether it is C or C++
132
source files are *.c or *.cpp depending on whether it is C or C++
125
header files are named *.h
133
header files are named *.h
126
 
134
 
127
----------------------------------------------------------------------
135
----------------------------------------------------------------------
128
4. MAKEFILES
136
4. MAKEFILES
129
----------------------------------------------------------------------
137
----------------------------------------------------------------------
130
 
138
 
131
Some defintions:
139
Some defintions:
132
----------------
140
----------------
133
 
141
 
134
The PLATFORM is a string concatenation of the os cpu and compiler, e.g.
142
The PLATFORM is a string concatenation of the os cpu and compiler, e.g.
135
 
143
 
136
Linux_i686_g++
144
Linux_i686_g++
137
 
145
 
138
The TARGET is either `debug' or `release'. By default it is debug. It is
146
The TARGET is either `debug' or `release'. By default it is debug. It is
139
recommended that you do _not_ hardwire your own default into the makefiles
147
recommended that you do _not_ hardwire your own default into the makefiles
140
as I did for many years. It seems better to define the variable when running
148
as I did for many years. It seems better to define the variable when running
141
make, using "make TARGET=release" or by setting the target variable in the
149
make, using "make TARGET=release" or by setting the target variable in the
142
environment.
150
environment.
143
 
151
 
144
 
152
 
145
Make'ing from the source root
153
Make'ing from the source root
146
-----------------------------
154
-----------------------------
147
 
155
 
148
Just typing
156
Just typing
149
> make 
157
> make 
150
 
158
 
151
from the root of the source tree will cause first every library and
159
from the root of the source tree will cause first every library and
152
then every application to be remade. However, there are several
160
then every application to be remade. However, there are several
153
targets.
161
targets.
154
 
162
 
155
make all			 - equivalent to "make lib shared test app"
163
make all			 - equivalent to "make lib shared test app"
156
 
164
 
157
make lib       - make all libraries
165
make lib       - make all libraries
158
 
166
 
159
make shared    - For the current target platform combination, a shared library
167
make shared    - For the current target platform combination, a shared library
160
								 is created by stringing together the compiled static libraries
168
								 is created by stringing together the compiled static libraries
161
 
169
 
162
make app       - make all applications
170
make app       - make all applications
163
 
171
 
164
make clean     - clean all library directories and app directories.
172
make clean     - clean all library directories and app directories.
165
                 this removes only files pertaining to the current
173
                 this removes only files pertaining to the current
166
                 platform and target (release/debug). This also
174
                 platform and target (release/debug). This also
167
                 removes generated libraries. 
175
                 removes generated libraries. 
168
 
176
 
169
make distclean - cleans and completely removes all build directories. 
177
make distclean - cleans and completely removes all build directories. 
170
 
178
 
171
make platform  - copies a template to OS_CPU_COMPILER.mk in the
179
make platform  - copies a template to OS_CPU_COMPILER.mk in the
172
                 makefiles directory. Use this only if you know what you
180
                 makefiles directory. Use this only if you know what you
173
								 are doing.
181
								 are doing.
174
 
182
 
175
make install   - Copies header files and libraries to the appropriate place
183
make install   - Copies header files and libraries to the appropriate place
176
							   which is PREFIX=/usr/local by default. The libraries which
184
							   which is PREFIX=/usr/local by default. The libraries which
177
								 are copied are either the debug or release versions depending
185
								 are copied are either the debug or release versions depending
178
								 on the active target. 
186
								 on the active target. 
179
 
187
 
180
								 Install does not install applications since many are little
188
								 Install does not install applications since many are little
181
								 test programs that do not belong in your path.
189
								 test programs that do not belong in your path.
182
 
190
 
183
 
191
 
184
Make'ing in subdirectories
192
Make'ing in subdirectories
185
--------------------------
193
--------------------------
186
 
194
 
187
Go to a subdirectory of src, say src/somedir. 
195
Go to a subdirectory of src, say src/somedir. 
188
Here you have the following options:
196
Here you have the following options:
189
 
197
 
190
make
198
make
191
make lib
199
make lib
192
make clean
200
make clean
193
 
201
 
194
The first two invocations are identical and will rebuild all sourcefiles and
202
The first two invocations are identical and will rebuild all sourcefiles and
195
put them in a library directory. The latter will remove all object and
203
put them in a library directory. The latter will remove all object and
196
dependency files (but only for the current platform
204
dependency files (but only for the current platform
197
(e.g. Linux_i686_g++_debug) The default target is lib.
205
(e.g. Linux_i686_g++_debug) The default target is lib.
198
 
206
 
199
Go to a subdirectory of apps, say apps/somedir. 
207
Go to a subdirectory of apps, say apps/somedir. 
200
Here you have the following options:
208
Here you have the following options:
201
 
209
 
202
make
210
make
203
 
211
 
204
or
212
or
205
 
213
 
206
make app
214
make app
207
 
215
 
208
will recompile the source files in the current directory and build the 
216
will recompile the source files in the current directory and build the 
209
programs. This is the default target. When compiled, the application is
217
programs. This is the default target. When compiled, the application is
210
moved to wherever/GEL/bin
218
moved to wherever/GEL/bin
211
 
219
 
212
make force
220
make force
213
 
221
 
214
does the same but tries first to recompile all libraries that the 
222
does the same but tries first to recompile all libraries that the 
215
applications in somedir depend on. This is the safe way to recompile,
223
applications in somedir depend on. This is the safe way to recompile,
216
but it takes a few seconds more, so if you are sure the libraries are
224
but it takes a few seconds more, so if you are sure the libraries are
217
up to date, just go make.
225
up to date, just go make.
218
 
226
 
219
make clean
227
make clean
220
 
228
 
221
works like above. 
229
works like above. 
222
 
230
 
223
Makefiles in subdirectories under apps should generally be edited.
231
Makefiles in subdirectories under apps should generally be edited.
224
When create by `make makefiles' the Makefile in apps/somedir looks
232
When create by `make makefiles' the Makefile in apps/somedir looks
225
like this 
233
like this 
226
 
234
 
227
PROGRAMS 	= prog1 prog2
235
PROGRAMS 	= prog1 prog2
228
OWN_LIBS 	= Lib1 Lib2
236
OWN_LIBS 	= Lib1 Lib2
229
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
237
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
230
 
238
 
231
Add something like this
239
Add something like this
232
 
240
 
233
PROGRAMS 	= prog1 prog2
241
PROGRAMS 	= prog1 prog2
234
OWN_LIBS 	= Lib1 Lib2
242
OWN_LIBS 	= Lib1 Lib2
235
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
243
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
236
 
244
 
237
where prog1 and prog2 are programs you wish to create. These must 
245
where prog1 and prog2 are programs you wish to create. These must 
238
correspond to source files with the same name and suffix .cpp. In
246
correspond to source files with the same name and suffix .cpp. In
239
other words, 
247
other words, 
240
 
248
 
241
prog1.cpp 
249
prog1.cpp 
242
prog2.cpp
250
prog2.cpp
243
 
251
 
244
must exist (and contain a main function)
252
must exist (and contain a main function)
245
 
253
 
246
Lib1 and Lib2 are libraries that must also be in the directory structure,
254
Lib1 and Lib2 are libraries that must also be in the directory structure,
247
i.e. under src there are subdirectories 
255
i.e. under src there are subdirectories 
248
 
256
 
249
src/Lib1
257
src/Lib1
250
src/Lib2
258
src/Lib2
251
 
259
 
252
the files in these subdirectories will be compiled and put in library 
260
the files in these subdirectories will be compiled and put in library 
253
files named libLib1.a under lib. More precisely it will be put here:
261
files named libLib1.a under lib. More precisely it will be put here:
254
 
262
 
255
lib/PLATFORM_TARGET/
263
lib/PLATFORM_TARGET/
256
 
264
 
257
PLATFORM and TARGET are defined above. Another library directory are for
265
PLATFORM and TARGET are defined above. Another library directory are for
258
precompiled libraries whose source code is not a part of this tree. Put
266
precompiled libraries whose source code is not a part of this tree. Put
259
such libraries here:
267
such libraries here:
260
 
268
 
261
lib/PLATFORM/
269
lib/PLATFORM/
262
 
270
 
263
this directory is created by 
271
this directory is created by 
264
 
272
 
265
make platform from the source root.
273
make platform from the source root.
266
 
274
 
267
----------------------------------------------------------------------
275
----------------------------------------------------------------------
268
5. CONFIGURATION
276
5. CONFIGURATION
269
----------------------------------------------------------------------
277
----------------------------------------------------------------------
270
 
278
 
271
When you add a new project to this framework, you should go through
279
When you add a new project to this framework, you should go through
272
the following steps:
280
the following steps:
273
 
281
 
274
Add directories for libraries under src. E.g. add 
282
Add directories for libraries under src. E.g. add 
275
 
283
 
276
mkdir src/somelib
284
mkdir src/somelib
277
 
285
 
278
Then add directories for applications:
286
Then add directories for applications:
279
 
287
 
280
mkdir apps/someapp
288
mkdir apps/someapp
281
 
289
 
282
Copy appropriate source files to these directories and then edit
290
Copy appropriate source files to these directories and then edit
283
 
291
 
284
makefiles/config.mk
292
makefiles/config.mk
285
 
293
 
286
to tell us which compiler to use (leave blank to use default) 
294
to tell us which compiler to use (leave blank to use default) 
287
 
295
 
288
Finally, from the source root type 
296
Finally, from the source root type 
289
 
297
 
290
make platform
298
make platform
291
 
299
 
292
Depending on your compiler you may now have to edit the makefile called
300
Depending on your compiler you may now have to edit the makefile called
293
 
301
 
294
makefiles/PLATFORM.mk 
302
makefiles/PLATFORM.mk 
295
 
303
 
296
to set special compile flags. No go 
304
to set special compile flags. No go 
297
 
305
 
298
make makefiles
306
make makefiles
299
 
307
 
300
Finally you are all set. Go
308
Finally you are all set. Go
301
 
309
 
302
make
310
make
303
 
311
 
304
 
312
 
305
----------------------------------------------------------------------
313
----------------------------------------------------------------------
306
6. DEPENDENCIES IN GEL
314
6. DEPENDENCIES IN GEL
307
----------------------------------------------------------------------
315
----------------------------------------------------------------------
308
 
316
 
309
Each directory under src represents a library. There are some dependencies
317
Each directory under src represents a library. There are some dependencies
310
between these libraries.
318
between these libraries.
311
 
319
 
312
 
320
 
313
 
321
 
314
lib						depends on
322
lib						depends on
315
-----------------------------------
323
-----------------------------------
316
CGLA 					nothing 
324
CGLA 					nothing 
317
 
325
 
318
Util 					CGLA
326
Util 					CGLA
319
 
327
 
320
LinAlg 				CGLA
328
LinAlg 				CGLA
321
 
329
 
322
Geometry 			LinAlg, CGLA
330
Geometry 			LinAlg, CGLA
323
 
331
 
324
HMesh					CGLA, Util, Geometry, LinAlg (indirectly)
332
HMesh					CGLA, Util, Geometry, LinAlg (indirectly)
325
 
333
 
326
GLGraphics		Everything (since it contains general rendering
334
GLGraphics		Everything (since it contains general rendering
327
							facilities)
335
							facilities)
328
 
336
 
329
 
337
 
330
----------------------------------------------------------------------
338
----------------------------------------------------------------------
331
7. TODO
339
7. TODO
332
----------------------------------------------------------------------
340
----------------------------------------------------------------------
333
 
341
 
334
- No real testing of blended C and C++.
342
- No real testing of blended C and C++.
335
- No dependency computation for .c 
343
- No dependency computation for .c 
336
 
344
 
337
 
345
 
338
 
346
 
339
 
347
 
340
 
348
 
341
 
349
 
342
 
350