aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/include/ode
diff options
context:
space:
mode:
authordan miller2007-10-19 05:24:38 +0000
committerdan miller2007-10-19 05:24:38 +0000
commitf205de7847da7ae1c10212d82e7042d0100b4ce0 (patch)
tree9acc9608a6880502aaeda43af52c33e278e95b9c /libraries/ode-0.9/include/ode
parenttrying to fix my screwup part deux (diff)
downloadopensim-SC-f205de7847da7ae1c10212d82e7042d0100b4ce0.zip
opensim-SC-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.gz
opensim-SC-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.bz2
opensim-SC-f205de7847da7ae1c10212d82e7042d0100b4ce0.tar.xz
from the start... checking in ode-0.9
Diffstat (limited to 'libraries/ode-0.9/include/ode')
-rw-r--r--libraries/ode-0.9/include/ode/Makefile.am23
-rw-r--r--libraries/ode-0.9/include/ode/Makefile.in448
-rw-r--r--libraries/ode-0.9/include/ode/README18
-rw-r--r--libraries/ode-0.9/include/ode/collision.h1386
-rw-r--r--libraries/ode-0.9/include/ode/collision_space.h76
-rwxr-xr-xlibraries/ode-0.9/include/ode/collision_trimesh.h205
-rw-r--r--libraries/ode-0.9/include/ode/common.h388
-rw-r--r--libraries/ode-0.9/include/ode/compatibility.h40
-rw-r--r--libraries/ode-0.9/include/ode/config.h176
-rw-r--r--libraries/ode-0.9/include/ode/config.h.in377
-rw-r--r--libraries/ode-0.9/include/ode/contact.h103
-rw-r--r--libraries/ode-0.9/include/ode/error.h63
-rw-r--r--libraries/ode-0.9/include/ode/export-dif.h32
-rw-r--r--libraries/ode-0.9/include/ode/mass.h125
-rw-r--r--libraries/ode-0.9/include/ode/matrix.h194
-rw-r--r--libraries/ode-0.9/include/ode/memory.h59
-rw-r--r--libraries/ode-0.9/include/ode/misc.h85
-rw-r--r--libraries/ode-0.9/include/ode/objects.h1966
-rw-r--r--libraries/ode-0.9/include/ode/ode.h47
-rw-r--r--libraries/ode-0.9/include/ode/odecpp.h712
-rw-r--r--libraries/ode-0.9/include/ode/odecpp_collision.h346
-rw-r--r--libraries/ode-0.9/include/ode/odemath.h330
-rw-r--r--libraries/ode-0.9/include/ode/rotation.h70
-rw-r--r--libraries/ode-0.9/include/ode/timer.h76
24 files changed, 7345 insertions, 0 deletions
diff --git a/libraries/ode-0.9/include/ode/Makefile.am b/libraries/ode-0.9/include/ode/Makefile.am
new file mode 100644
index 0000000..1cc6caa
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/Makefile.am
@@ -0,0 +1,23 @@
1libglitch_includedir = $(includedir)/ode
2libglitch_include_HEADERS = collision_trimesh.h \
3 mass.h \
4 odecpp.h \
5 common.h \
6 matrix.h \
7 odecpp_collision.h \
8 compatibility.h \
9 memory.h \
10 contact.h \
11 misc.h \
12 odemath.h \
13 collision.h \
14 error.h \
15 objects.h \
16 rotation.h \
17 collision_space.h \
18 export-dif.h \
19 ode.h \
20 timer.h \
21 config.h
22
23EXTRA_DIST = config.h.in
diff --git a/libraries/ode-0.9/include/ode/Makefile.in b/libraries/ode-0.9/include/ode/Makefile.in
new file mode 100644
index 0000000..8458adb
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/Makefile.in
@@ -0,0 +1,448 @@
1# Makefile.in generated by automake 1.10 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6# This Makefile.in is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13# PARTICULAR PURPOSE.
14
15@SET_MAKE@
16
17VPATH = @srcdir@
18pkgdatadir = $(datadir)/@PACKAGE@
19pkglibdir = $(libdir)/@PACKAGE@
20pkgincludedir = $(includedir)/@PACKAGE@
21am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
22install_sh_DATA = $(install_sh) -c -m 644
23install_sh_PROGRAM = $(install_sh) -c
24install_sh_SCRIPT = $(install_sh) -c
25INSTALL_HEADER = $(INSTALL_DATA)
26transform = $(program_transform_name)
27NORMAL_INSTALL = :
28PRE_INSTALL = :
29POST_INSTALL = :
30NORMAL_UNINSTALL = :
31PRE_UNINSTALL = :
32POST_UNINSTALL = :
33build_triplet = @build@
34host_triplet = @host@
35target_triplet = @target@
36subdir = include/ode
37DIST_COMMON = README $(libglitch_include_HEADERS) \
38 $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
39 $(srcdir)/config.h.in
40ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
41am__aclocal_m4_deps = $(top_srcdir)/configure.in
42am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
43 $(ACLOCAL_M4)
44mkinstalldirs = $(install_sh) -d
45CONFIG_HEADER = config.h
46CONFIG_CLEAN_FILES =
47SOURCES =
48DIST_SOURCES =
49am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
50am__vpath_adj = case $$p in \
51 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
52 *) f=$$p;; \
53 esac;
54am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
55am__installdirs = "$(DESTDIR)$(libglitch_includedir)"
56libglitch_includeHEADERS_INSTALL = $(INSTALL_HEADER)
57HEADERS = $(libglitch_include_HEADERS)
58ETAGS = etags
59CTAGS = ctags
60DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
61ACLOCAL = @ACLOCAL@
62ALLOCA = @ALLOCA@
63AMTAR = @AMTAR@
64ARCHFLAGS = @ARCHFLAGS@
65AUTOCONF = @AUTOCONF@
66AUTOHEADER = @AUTOHEADER@
67AUTOMAKE = @AUTOMAKE@
68AWK = @AWK@
69CC = @CC@
70CCDEPMODE = @CCDEPMODE@
71CFLAGS = @CFLAGS@
72CPP = @CPP@
73CPPFLAGS = @CPPFLAGS@
74CXX = @CXX@
75CXXDEPMODE = @CXXDEPMODE@
76CXXFLAGS = @CXXFLAGS@
77CYGPATH_W = @CYGPATH_W@
78DEFS = @DEFS@
79DEPDIR = @DEPDIR@
80DRAWSTUFF = @DRAWSTUFF@
81ECHO_C = @ECHO_C@
82ECHO_N = @ECHO_N@
83ECHO_T = @ECHO_T@
84EGREP = @EGREP@
85EXEEXT = @EXEEXT@
86GL_LIBS = @GL_LIBS@
87GREP = @GREP@
88INSTALL = @INSTALL@
89INSTALL_DATA = @INSTALL_DATA@
90INSTALL_PROGRAM = @INSTALL_PROGRAM@
91INSTALL_SCRIPT = @INSTALL_SCRIPT@
92INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
93LDFLAGS = @LDFLAGS@
94LIBOBJS = @LIBOBJS@
95LIBS = @LIBS@
96LTLIBOBJS = @LTLIBOBJS@
97MAKEINFO = @MAKEINFO@
98MKDIR_P = @MKDIR_P@
99OBJEXT = @OBJEXT@
100ODE_AGE = @ODE_AGE@
101ODE_CURRENT = @ODE_CURRENT@
102ODE_RELEASE = @ODE_RELEASE@
103ODE_REVISION = @ODE_REVISION@
104ODE_SONAME = @ODE_SONAME@
105PACKAGE = @PACKAGE@
106PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
107PACKAGE_NAME = @PACKAGE_NAME@
108PACKAGE_STRING = @PACKAGE_STRING@
109PACKAGE_TARNAME = @PACKAGE_TARNAME@
110PACKAGE_VERSION = @PACKAGE_VERSION@
111PATH_SEPARATOR = @PATH_SEPARATOR@
112RANLIB = @RANLIB@
113SET_MAKE = @SET_MAKE@
114SHARED_LDFLAGS = @SHARED_LDFLAGS@
115SHELL = @SHELL@
116STRIP = @STRIP@
117TOPDIR = @TOPDIR@
118VERSION = @VERSION@
119WINDRES = @WINDRES@
120XMKMF = @XMKMF@
121X_CFLAGS = @X_CFLAGS@
122X_EXTRA_LIBS = @X_EXTRA_LIBS@
123X_LIBS = @X_LIBS@
124X_PRE_LIBS = @X_PRE_LIBS@
125abs_builddir = @abs_builddir@
126abs_srcdir = @abs_srcdir@
127abs_top_builddir = @abs_top_builddir@
128abs_top_srcdir = @abs_top_srcdir@
129ac_ct_CC = @ac_ct_CC@
130ac_ct_CXX = @ac_ct_CXX@
131ac_ct_WINDRES = @ac_ct_WINDRES@
132am__include = @am__include@
133am__leading_dot = @am__leading_dot@
134am__quote = @am__quote@
135am__tar = @am__tar@
136am__untar = @am__untar@
137bindir = @bindir@
138build = @build@
139build_alias = @build_alias@
140build_cpu = @build_cpu@
141build_os = @build_os@
142build_vendor = @build_vendor@
143builddir = @builddir@
144datadir = @datadir@
145datarootdir = @datarootdir@
146docdir = @docdir@
147dvidir = @dvidir@
148exec_prefix = @exec_prefix@
149host = @host@
150host_alias = @host_alias@
151host_cpu = @host_cpu@
152host_os = @host_os@
153host_vendor = @host_vendor@
154htmldir = @htmldir@
155includedir = @includedir@
156infodir = @infodir@
157install_sh = @install_sh@
158libdir = @libdir@
159libexecdir = @libexecdir@
160localedir = @localedir@
161localstatedir = @localstatedir@
162mandir = @mandir@
163mkdir_p = @mkdir_p@
164oldincludedir = @oldincludedir@
165pdfdir = @pdfdir@
166prefix = @prefix@
167program_transform_name = @program_transform_name@
168psdir = @psdir@
169sbindir = @sbindir@
170sharedstatedir = @sharedstatedir@
171so_ext = @so_ext@
172srcdir = @srcdir@
173sysconfdir = @sysconfdir@
174target = @target@
175target_alias = @target_alias@
176target_cpu = @target_cpu@
177target_os = @target_os@
178target_vendor = @target_vendor@
179top_builddir = @top_builddir@
180top_srcdir = @top_srcdir@
181libglitch_includedir = $(includedir)/ode
182libglitch_include_HEADERS = collision_trimesh.h \
183 mass.h \
184 odecpp.h \
185 common.h \
186 matrix.h \
187 odecpp_collision.h \
188 compatibility.h \
189 memory.h \
190 contact.h \
191 misc.h \
192 odemath.h \
193 collision.h \
194 error.h \
195 objects.h \
196 rotation.h \
197 collision_space.h \
198 export-dif.h \
199 ode.h \
200 timer.h \
201 config.h
202
203EXTRA_DIST = config.h.in
204all: config.h
205 $(MAKE) $(AM_MAKEFLAGS) all-am
206
207.SUFFIXES:
208$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
209 @for dep in $?; do \
210 case '$(am__configure_deps)' in \
211 *$$dep*) \
212 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
213 && exit 0; \
214 exit 1;; \
215 esac; \
216 done; \
217 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/ode/Makefile'; \
218 cd $(top_srcdir) && \
219 $(AUTOMAKE) --foreign include/ode/Makefile
220.PRECIOUS: Makefile
221Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
222 @case '$?' in \
223 *config.status*) \
224 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
225 *) \
226 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
227 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
228 esac;
229
230$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
231 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
232
233$(top_srcdir)/configure: $(am__configure_deps)
234 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
235$(ACLOCAL_M4): $(am__aclocal_m4_deps)
236 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
237
238config.h: stamp-h1
239 @if test ! -f $@; then \
240 rm -f stamp-h1; \
241 $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
242 else :; fi
243
244stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
245 @rm -f stamp-h1
246 cd $(top_builddir) && $(SHELL) ./config.status include/ode/config.h
247$(srcdir)/config.h.in: $(am__configure_deps)
248 cd $(top_srcdir) && $(AUTOHEADER)
249 rm -f stamp-h1
250 touch $@
251
252distclean-hdr:
253 -rm -f config.h stamp-h1
254install-libglitch_includeHEADERS: $(libglitch_include_HEADERS)
255 @$(NORMAL_INSTALL)
256 test -z "$(libglitch_includedir)" || $(MKDIR_P) "$(DESTDIR)$(libglitch_includedir)"
257 @list='$(libglitch_include_HEADERS)'; for p in $$list; do \
258 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
259 f=$(am__strip_dir) \
260 echo " $(libglitch_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libglitch_includedir)/$$f'"; \
261 $(libglitch_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libglitch_includedir)/$$f"; \
262 done
263
264uninstall-libglitch_includeHEADERS:
265 @$(NORMAL_UNINSTALL)
266 @list='$(libglitch_include_HEADERS)'; for p in $$list; do \
267 f=$(am__strip_dir) \
268 echo " rm -f '$(DESTDIR)$(libglitch_includedir)/$$f'"; \
269 rm -f "$(DESTDIR)$(libglitch_includedir)/$$f"; \
270 done
271
272ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
273 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
274 unique=`for i in $$list; do \
275 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
276 done | \
277 $(AWK) ' { files[$$0] = 1; } \
278 END { for (i in files) print i; }'`; \
279 mkid -fID $$unique
280tags: TAGS
281
282TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
283 $(TAGS_FILES) $(LISP)
284 tags=; \
285 here=`pwd`; \
286 list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
287 unique=`for i in $$list; do \
288 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
289 done | \
290 $(AWK) ' { files[$$0] = 1; } \
291 END { for (i in files) print i; }'`; \
292 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
293 test -n "$$unique" || unique=$$empty_fix; \
294 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
295 $$tags $$unique; \
296 fi
297ctags: CTAGS
298CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
299 $(TAGS_FILES) $(LISP)
300 tags=; \
301 here=`pwd`; \
302 list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
303 unique=`for i in $$list; do \
304 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
305 done | \
306 $(AWK) ' { files[$$0] = 1; } \
307 END { for (i in files) print i; }'`; \
308 test -z "$(CTAGS_ARGS)$$tags$$unique" \
309 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
310 $$tags $$unique
311
312GTAGS:
313 here=`$(am__cd) $(top_builddir) && pwd` \
314 && cd $(top_srcdir) \
315 && gtags -i $(GTAGS_ARGS) $$here
316
317distclean-tags:
318 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
319
320distdir: $(DISTFILES)
321 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
322 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
323 list='$(DISTFILES)'; \
324 dist_files=`for file in $$list; do echo $$file; done | \
325 sed -e "s|^$$srcdirstrip/||;t" \
326 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
327 case $$dist_files in \
328 */*) $(MKDIR_P) `echo "$$dist_files" | \
329 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
330 sort -u` ;; \
331 esac; \
332 for file in $$dist_files; do \
333 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
334 if test -d $$d/$$file; then \
335 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
336 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
337 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
338 fi; \
339 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
340 else \
341 test -f $(distdir)/$$file \
342 || cp -p $$d/$$file $(distdir)/$$file \
343 || exit 1; \
344 fi; \
345 done
346check-am: all-am
347check: check-am
348all-am: Makefile $(HEADERS) config.h
349installdirs:
350 for dir in "$(DESTDIR)$(libglitch_includedir)"; do \
351 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
352 done
353install: install-am
354install-exec: install-exec-am
355install-data: install-data-am
356uninstall: uninstall-am
357
358install-am: all-am
359 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
360
361installcheck: installcheck-am
362install-strip:
363 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
364 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
365 `test -z '$(STRIP)' || \
366 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
367mostlyclean-generic:
368
369clean-generic:
370
371distclean-generic:
372 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
373
374maintainer-clean-generic:
375 @echo "This command is intended for maintainers to use"
376 @echo "it deletes files that may require special tools to rebuild."
377clean: clean-am
378
379clean-am: clean-generic mostlyclean-am
380
381distclean: distclean-am
382 -rm -f Makefile
383distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
384
385dvi: dvi-am
386
387dvi-am:
388
389html: html-am
390
391info: info-am
392
393info-am:
394
395install-data-am: install-libglitch_includeHEADERS
396
397install-dvi: install-dvi-am
398
399install-exec-am:
400
401install-html: install-html-am
402
403install-info: install-info-am
404
405install-man:
406
407install-pdf: install-pdf-am
408
409install-ps: install-ps-am
410
411installcheck-am:
412
413maintainer-clean: maintainer-clean-am
414 -rm -f Makefile
415maintainer-clean-am: distclean-am maintainer-clean-generic
416
417mostlyclean: mostlyclean-am
418
419mostlyclean-am: mostlyclean-generic
420
421pdf: pdf-am
422
423pdf-am:
424
425ps: ps-am
426
427ps-am:
428
429uninstall-am: uninstall-libglitch_includeHEADERS
430
431.MAKE: install-am install-strip
432
433.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
434 ctags distclean distclean-generic distclean-hdr distclean-tags \
435 distdir dvi dvi-am html html-am info info-am install \
436 install-am install-data install-data-am install-dvi \
437 install-dvi-am install-exec install-exec-am install-html \
438 install-html-am install-info install-info-am \
439 install-libglitch_includeHEADERS install-man install-pdf \
440 install-pdf-am install-ps install-ps-am install-strip \
441 installcheck installcheck-am installdirs maintainer-clean \
442 maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
443 pdf-am ps ps-am tags uninstall uninstall-am \
444 uninstall-libglitch_includeHEADERS
445
446# Tell versions [3.59,3.63) of GNU make to not export all variables.
447# Otherwise a system limit (for SysV at least) may be exceeded.
448.NOEXPORT:
diff --git a/libraries/ode-0.9/include/ode/README b/libraries/ode-0.9/include/ode/README
new file mode 100644
index 0000000..9d7e99a
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/README
@@ -0,0 +1,18 @@
1
2this is the public C interface to the ODE library.
3
4all these files should be includable from C, i.e. they should not use any
5C++ features. everything should be protected with
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 ...
12
13 #ifdef __cplusplus
14 }
15 #endif
16
17the only exceptions are the odecpp.h and odecpp_collisioh.h files, which define a C++ wrapper for
18the C interface. remember to keep this in sync!
diff --git a/libraries/ode-0.9/include/ode/collision.h b/libraries/ode-0.9/include/ode/collision.h
new file mode 100644
index 0000000..c40bc4a
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/collision.h
@@ -0,0 +1,1386 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_COLLISION_H_
24#define _ODE_COLLISION_H_
25
26#include <ode/common.h>
27#include <ode/collision_space.h>
28#include <ode/contact.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/**
35 * @defgroup collide Collision Detection
36 *
37 * ODE has two main components: a dynamics simulation engine and a collision
38 * detection engine. The collision engine is given information about the
39 * shape of each body. At each time step it figures out which bodies touch
40 * each other and passes the resulting contact point information to the user.
41 * The user in turn creates contact joints between bodies.
42 *
43 * Using ODE's collision detection is optional - an alternative collision
44 * detection system can be used as long as it can supply the right kinds of
45 * contact information.
46 */
47
48
49/* ************************************************************************ */
50/* general functions */
51
52/**
53 * @brief Destroy a geom, removing it from any space.
54 *
55 * Destroy a geom, removing it from any space it is in first. This one
56 * function destroys a geom of any type, but to create a geom you must call
57 * a creation function for that type.
58 *
59 * When a space is destroyed, if its cleanup mode is 1 (the default) then all
60 * the geoms in that space are automatically destroyed as well.
61 *
62 * @param geom the geom to be destroyed.
63 * @ingroup collide
64 */
65ODE_API void dGeomDestroy (dGeomID geom);
66
67
68/**
69 * @brief Set the user-defined data pointer stored in the geom.
70 *
71 * @param geom the geom to hold the data
72 * @param data the data pointer to be stored
73 * @ingroup collide
74 */
75ODE_API void dGeomSetData (dGeomID geom, void* data);
76
77
78/**
79 * @brief Get the user-defined data pointer stored in the geom.
80 *
81 * @param geom the geom containing the data
82 * @ingroup collide
83 */
84ODE_API void *dGeomGetData (dGeomID geom);
85
86
87/**
88 * @brief Set the body associated with a placeable geom.
89 *
90 * Setting a body on a geom automatically combines the position vector and
91 * rotation matrix of the body and geom, so that setting the position or
92 * orientation of one will set the value for both objects. Setting a body
93 * ID of zero gives the geom its own position and rotation, independent
94 * from any body. If the geom was previously connected to a body then its
95 * new independent position/rotation is set to the current position/rotation
96 * of the body.
97 *
98 * Calling these functions on a non-placeable geom results in a runtime
99 * error in the debug build of ODE.
100 *
101 * @param geom the geom to connect
102 * @param body the body to attach to the geom
103 * @ingroup collide
104 */
105ODE_API void dGeomSetBody (dGeomID geom, dBodyID body);
106
107
108/**
109 * @brief Get the body associated with a placeable geom.
110 * @param geom the geom to query.
111 * @sa dGeomSetBody
112 * @ingroup collide
113 */
114ODE_API dBodyID dGeomGetBody (dGeomID geom);
115
116
117/**
118 * @brief Set the position vector of a placeable geom.
119 *
120 * If the geom is attached to a body, the body's position will also be changed.
121 * Calling this function on a non-placeable geom results in a runtime error in
122 * the debug build of ODE.
123 *
124 * @param geom the geom to set.
125 * @param x the new X coordinate.
126 * @param y the new Y coordinate.
127 * @param z the new Z coordinate.
128 * @sa dBodySetPosition
129 * @ingroup collide
130 */
131ODE_API void dGeomSetPosition (dGeomID geom, dReal x, dReal y, dReal z);
132
133
134/**
135 * @brief Set the rotation matrix of a placeable geom.
136 *
137 * If the geom is attached to a body, the body's rotation will also be changed.
138 * Calling this function on a non-placeable geom results in a runtime error in
139 * the debug build of ODE.
140 *
141 * @param geom the geom to set.
142 * @param R the new rotation matrix.
143 * @sa dBodySetRotation
144 * @ingroup collide
145 */
146ODE_API void dGeomSetRotation (dGeomID geom, const dMatrix3 R);
147
148
149/**
150 * @brief Set the rotation of a placeable geom.
151 *
152 * If the geom is attached to a body, the body's rotation will also be changed.
153 *
154 * Calling this function on a non-placeable geom results in a runtime error in
155 * the debug build of ODE.
156 *
157 * @param geom the geom to set.
158 * @param Q the new rotation.
159 * @sa dBodySetQuaternion
160 * @ingroup collide
161 */
162ODE_API void dGeomSetQuaternion (dGeomID geom, const dQuaternion Q);
163
164
165/**
166 * @brief Get the position vector of a placeable geom.
167 *
168 * If the geom is attached to a body, the body's position will be returned.
169 *
170 * Calling this function on a non-placeable geom results in a runtime error in
171 * the debug build of ODE.
172 *
173 * @param geom the geom to query.
174 * @returns A pointer to the geom's position vector.
175 * @remarks The returned value is a pointer to the geom's internal
176 * data structure. It is valid until any changes are made
177 * to the geom.
178 * @sa dBodyGetPosition
179 * @ingroup collide
180 */
181ODE_API const dReal * dGeomGetPosition (dGeomID geom);
182
183
184/**
185 * @brief Copy the position of a geom into a vector.
186 * @ingroup collide
187 * @param geom the geom to query
188 * @param pos a copy of the geom position
189 * @sa dGeomGetPosition
190 */
191ODE_API void dGeomCopyPosition (dGeomID geom, dVector3 pos);
192
193
194/**
195 * @brief Get the rotation matrix of a placeable geom.
196 *
197 * If the geom is attached to a body, the body's rotation will be returned.
198 *
199 * Calling this function on a non-placeable geom results in a runtime error in
200 * the debug build of ODE.
201 *
202 * @param geom the geom to query.
203 * @returns A pointer to the geom's rotation matrix.
204 * @remarks The returned value is a pointer to the geom's internal
205 * data structure. It is valid until any changes are made
206 * to the geom.
207 * @sa dBodyGetRotation
208 * @ingroup collide
209 */
210ODE_API const dReal * dGeomGetRotation (dGeomID geom);
211
212
213/**
214 * @brief Get the rotation matrix of a placeable geom.
215 *
216 * If the geom is attached to a body, the body's rotation will be returned.
217 *
218 * Calling this function on a non-placeable geom results in a runtime error in
219 * the debug build of ODE.
220 *
221 * @param geom the geom to query.
222 * @param R a copy of the geom rotation
223 * @sa dGeomGetRotation
224 * @ingroup collide
225 */
226ODE_API void dGeomCopyRotation(dGeomID geom, dMatrix3 R);
227
228
229/**
230 * @brief Get the rotation quaternion of a placeable geom.
231 *
232 * If the geom is attached to a body, the body's quaternion will be returned.
233 *
234 * Calling this function on a non-placeable geom results in a runtime error in
235 * the debug build of ODE.
236 *
237 * @param geom the geom to query.
238 * @param result a copy of the rotation quaternion.
239 * @sa dBodyGetQuaternion
240 * @ingroup collide
241 */
242ODE_API void dGeomGetQuaternion (dGeomID geom, dQuaternion result);
243
244
245/**
246 * @brief Return the axis-aligned bounding box.
247 *
248 * Return in aabb an axis aligned bounding box that surrounds the given geom.
249 * The aabb array has elements (minx, maxx, miny, maxy, minz, maxz). If the
250 * geom is a space, a bounding box that surrounds all contained geoms is
251 * returned.
252 *
253 * This function may return a pre-computed cached bounding box, if it can
254 * determine that the geom has not moved since the last time the bounding
255 * box was computed.
256 *
257 * @param geom the geom to query
258 * @param aabb the returned bounding box
259 * @ingroup collide
260 */
261ODE_API void dGeomGetAABB (dGeomID geom, dReal aabb[6]);
262
263
264/**
265 * @brief Determing if a geom is a space.
266 * @param geom the geom to query
267 * @returns Non-zero if the geom is a space, zero otherwise.
268 * @ingroup collide
269 */
270ODE_API int dGeomIsSpace (dGeomID geom);
271
272
273/**
274 * @brief Query for the space containing a particular geom.
275 * @param geom the geom to query
276 * @returns The space that contains the geom, or NULL if the geom is
277 * not contained by a space.
278 * @ingroup collide
279 */
280ODE_API dSpaceID dGeomGetSpace (dGeomID);
281
282
283/**
284 * @brief Given a geom, this returns its class.
285 *
286 * The ODE classes are:
287 * @li dSphereClass
288 * @li dBoxClass
289 * @li dCylinderClass
290 * @li dPlaneClass
291 * @li dRayClass
292 * @li dConvexClass
293 * @li dGeomTransformClass
294 * @li dTriMeshClass
295 * @li dSimpleSpaceClass
296 * @li dHashSpaceClass
297 * @li dQuadTreeSpaceClass
298 * @li dFirstUserClass
299 * @li dLastUserClass
300 *
301 * User-defined class will return their own number.
302 *
303 * @param geom the geom to query
304 * @returns The geom class ID.
305 * @ingroup collide
306 */
307ODE_API int dGeomGetClass (dGeomID geom);
308
309
310/**
311 * @brief Set the "category" bitfield for the given geom.
312 *
313 * The category bitfield is used by spaces to govern which geoms will
314 * interact with each other. The bitfield is guaranteed to be at least
315 * 32 bits wide. The default category values for newly created geoms
316 * have all bits set.
317 *
318 * @param geom the geom to set
319 * @param bits the new bitfield value
320 * @ingroup collide
321 */
322ODE_API void dGeomSetCategoryBits (dGeomID geom, unsigned long bits);
323
324
325/**
326 * @brief Set the "collide" bitfield for the given geom.
327 *
328 * The collide bitfield is used by spaces to govern which geoms will
329 * interact with each other. The bitfield is guaranteed to be at least
330 * 32 bits wide. The default category values for newly created geoms
331 * have all bits set.
332 *
333 * @param geom the geom to set
334 * @param bits the new bitfield value
335 * @ingroup collide
336 */
337ODE_API void dGeomSetCollideBits (dGeomID geom, unsigned long bits);
338
339
340/**
341 * @brief Get the "category" bitfield for the given geom.
342 *
343 * @param geom the geom to set
344 * @param bits the new bitfield value
345 * @sa dGeomSetCategoryBits
346 * @ingroup collide
347 */
348ODE_API unsigned long dGeomGetCategoryBits (dGeomID);
349
350
351/**
352 * @brief Get the "collide" bitfield for the given geom.
353 *
354 * @param geom the geom to set
355 * @param bits the new bitfield value
356 * @sa dGeomSetCollideBits
357 * @ingroup collide
358 */
359ODE_API unsigned long dGeomGetCollideBits (dGeomID);
360
361
362/**
363 * @brief Enable a geom.
364 *
365 * Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2,
366 * although they can still be members of a space. New geoms are created in
367 * the enabled state.
368 *
369 * @param geom the geom to enable
370 * @sa dGeomDisable
371 * @sa dGeomIsEnabled
372 * @ingroup collide
373 */
374ODE_API void dGeomEnable (dGeomID geom);
375
376
377/**
378 * @brief Disable a geom.
379 *
380 * Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2,
381 * although they can still be members of a space. New geoms are created in
382 * the enabled state.
383 *
384 * @param geom the geom to disable
385 * @sa dGeomDisable
386 * @sa dGeomIsEnabled
387 * @ingroup collide
388 */
389ODE_API void dGeomDisable (dGeomID geom);
390
391
392/**
393 * @brief Check to see if a geom is enabled.
394 *
395 * Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2,
396 * although they can still be members of a space. New geoms are created in
397 * the enabled state.
398 *
399 * @param geom the geom to query
400 * @returns Non-zero if the geom is enabled, zero otherwise.
401 * @sa dGeomDisable
402 * @sa dGeomIsEnabled
403 * @ingroup collide
404 */
405ODE_API int dGeomIsEnabled (dGeomID geom);
406
407/* ************************************************************************ */
408/* geom offset from body */
409
410/**
411 * @brief Set the local offset position of a geom from its body.
412 *
413 * Sets the geom's positional offset in local coordinates.
414 * After this call, the geom will be at a new position determined from the
415 * body's position and the offset.
416 * The geom must be attached to a body.
417 * If the geom did not have an offset, it is automatically created.
418 *
419 * @param geom the geom to set.
420 * @param x the new X coordinate.
421 * @param y the new Y coordinate.
422 * @param z the new Z coordinate.
423 * @ingroup collide
424 */
425ODE_API void dGeomSetOffsetPosition (dGeomID geom, dReal x, dReal y, dReal z);
426
427
428/**
429 * @brief Set the local offset rotation matrix of a geom from its body.
430 *
431 * Sets the geom's rotational offset in local coordinates.
432 * After this call, the geom will be at a new position determined from the
433 * body's position and the offset.
434 * The geom must be attached to a body.
435 * If the geom did not have an offset, it is automatically created.
436 *
437 * @param geom the geom to set.
438 * @param R the new rotation matrix.
439 * @ingroup collide
440 */
441ODE_API void dGeomSetOffsetRotation (dGeomID geom, const dMatrix3 R);
442
443
444/**
445 * @brief Set the local offset rotation of a geom from its body.
446 *
447 * Sets the geom's rotational offset in local coordinates.
448 * After this call, the geom will be at a new position determined from the
449 * body's position and the offset.
450 * The geom must be attached to a body.
451 * If the geom did not have an offset, it is automatically created.
452 *
453 * @param geom the geom to set.
454 * @param Q the new rotation.
455 * @ingroup collide
456 */
457ODE_API void dGeomSetOffsetQuaternion (dGeomID geom, const dQuaternion Q);
458
459
460/**
461 * @brief Set the offset position of a geom from its body.
462 *
463 * Sets the geom's positional offset to move it to the new world
464 * coordinates.
465 * After this call, the geom will be at the world position passed in,
466 * and the offset will be the difference from the current body position.
467 * The geom must be attached to a body.
468 * If the geom did not have an offset, it is automatically created.
469 *
470 * @param geom the geom to set.
471 * @param x the new X coordinate.
472 * @param y the new Y coordinate.
473 * @param z the new Z coordinate.
474 * @ingroup collide
475 */
476ODE_API void dGeomSetOffsetWorldPosition (dGeomID geom, dReal x, dReal y, dReal z);
477
478
479/**
480 * @brief Set the offset rotation of a geom from its body.
481 *
482 * Sets the geom's rotational offset to orient it to the new world
483 * rotation matrix.
484 * After this call, the geom will be at the world orientation passed in,
485 * and the offset will be the difference from the current body orientation.
486 * The geom must be attached to a body.
487 * If the geom did not have an offset, it is automatically created.
488 *
489 * @param geom the geom to set.
490 * @param R the new rotation matrix.
491 * @ingroup collide
492 */
493ODE_API void dGeomSetOffsetWorldRotation (dGeomID geom, const dMatrix3 R);
494
495
496/**
497 * @brief Set the offset rotation of a geom from its body.
498 *
499 * Sets the geom's rotational offset to orient it to the new world
500 * rotation matrix.
501 * After this call, the geom will be at the world orientation passed in,
502 * and the offset will be the difference from the current body orientation.
503 * The geom must be attached to a body.
504 * If the geom did not have an offset, it is automatically created.
505 *
506 * @param geom the geom to set.
507 * @param Q the new rotation.
508 * @ingroup collide
509 */
510ODE_API void dGeomSetOffsetWorldQuaternion (dGeomID geom, const dQuaternion);
511
512
513/**
514 * @brief Clear any offset from the geom.
515 *
516 * If the geom has an offset, it is eliminated and the geom is
517 * repositioned at the body's position. If the geom has no offset,
518 * this function does nothing.
519 * This is more efficient than calling dGeomSetOffsetPosition(zero)
520 * and dGeomSetOffsetRotation(identiy), because this function actually
521 * eliminates the offset, rather than leaving it as the identity transform.
522 *
523 * @param geom the geom to have its offset destroyed.
524 * @ingroup collide
525 */
526ODE_API void dGeomClearOffset(dGeomID geom);
527
528
529/**
530 * @brief Check to see whether the geom has an offset.
531 *
532 * This function will return non-zero if the offset has been created.
533 * Note that there is a difference between a geom with no offset,
534 * and a geom with an offset that is the identity transform.
535 * In the latter case, although the observed behaviour is identical,
536 * there is a unnecessary computation involved because the geom will
537 * be applying the transform whenever it needs to recalculate its world
538 * position.
539 *
540 * @param geom the geom to query.
541 * @returns Non-zero if the geom has an offset, zero otherwise.
542 * @ingroup collide
543 */
544ODE_API int dGeomIsOffset(dGeomID geom);
545
546
547/**
548 * @brief Get the offset position vector of a geom.
549 *
550 * Returns the positional offset of the geom in local coordinates.
551 * If the geom has no offset, this function returns the zero vector.
552 *
553 * @param geom the geom to query.
554 * @returns A pointer to the geom's offset vector.
555 * @remarks The returned value is a pointer to the geom's internal
556 * data structure. It is valid until any changes are made
557 * to the geom.
558 * @ingroup collide
559 */
560ODE_API const dReal * dGeomGetOffsetPosition (dGeomID geom);
561
562
563/**
564 * @brief Copy the offset position vector of a geom.
565 *
566 * Returns the positional offset of the geom in local coordinates.
567 * If the geom has no offset, this function returns the zero vector.
568 *
569 * @param geom the geom to query.
570 * @param pos returns the offset position
571 * @ingroup collide
572 */
573ODE_API void dGeomCopyOffsetPosition (dGeomID geom, dVector3 pos);
574
575
576/**
577 * @brief Get the offset rotation matrix of a geom.
578 *
579 * Returns the rotational offset of the geom in local coordinates.
580 * If the geom has no offset, this function returns the identity
581 * matrix.
582 *
583 * @param geom the geom to query.
584 * @returns A pointer to the geom's offset rotation matrix.
585 * @remarks The returned value is a pointer to the geom's internal
586 * data structure. It is valid until any changes are made
587 * to the geom.
588 * @ingroup collide
589 */
590ODE_API const dReal * dGeomGetOffsetRotation (dGeomID geom);
591
592
593/**
594 * @brief Copy the offset rotation matrix of a geom.
595 *
596 * Returns the rotational offset of the geom in local coordinates.
597 * If the geom has no offset, this function returns the identity
598 * matrix.
599 *
600 * @param geom the geom to query.
601 * @param R returns the rotation matrix.
602 * @ingroup collide
603 */
604ODE_API void dGeomCopyOffsetRotation (dGeomID geom, dMatrix3 R);
605
606
607/**
608 * @brief Get the offset rotation quaternion of a geom.
609 *
610 * Returns the rotation offset of the geom as a quaternion.
611 * If the geom has no offset, the identity quaternion is returned.
612 *
613 * @param geom the geom to query.
614 * @param result a copy of the rotation quaternion.
615 * @ingroup collide
616 */
617ODE_API void dGeomGetOffsetQuaternion (dGeomID geom, dQuaternion result);
618
619
620/* ************************************************************************ */
621/* collision detection */
622
623/*
624 * Just generate any contacts (disables any contact refining).
625 */
626#define CONTACTS_UNIMPORTANT 0x80000000
627
628/**
629 *
630 * @brief Given two geoms o1 and o2 that potentially intersect,
631 * generate contact information for them.
632 *
633 * Internally, this just calls the correct class-specific collision
634 * functions for o1 and o2.
635 *
636 * @param o1 The first geom to test.
637 * @param o2 The second geom to test.
638 *
639 * @param flags The flags specify how contacts should be generated if
640 * the geoms touch. The lower 16 bits of flags is an integer that
641 * specifies the maximum number of contact points to generate. You must
642 * ask for at least one contact.
643 * Additionally, following bits may be set:
644 * CONTACTS_UNIMPORTANT -- just generate any contacts (skip contact refining).
645 * All other bits in flags must be set to zero. In the future the other bits
646 * may be used to select from different contact generation strategies.
647 *
648 * @param contact Points to an array of dContactGeom structures. The array
649 * must be able to hold at least the maximum number of contacts. These
650 * dContactGeom structures may be embedded within larger structures in the
651 * array -- the skip parameter is the byte offset from one dContactGeom to
652 * the next in the array. If skip is sizeof(dContactGeom) then contact
653 * points to a normal (C-style) array. It is an error for skip to be smaller
654 * than sizeof(dContactGeom).
655 *
656 * @returns If the geoms intersect, this function returns the number of contact
657 * points generated (and updates the contact array), otherwise it returns 0
658 * (and the contact array is not touched).
659 *
660 * @remarks If a space is passed as o1 or o2 then this function will collide
661 * all objects contained in o1 with all objects contained in o2, and return
662 * the resulting contact points. This method for colliding spaces with geoms
663 * (or spaces with spaces) provides no user control over the individual
664 * collisions. To get that control, use dSpaceCollide or dSpaceCollide2 instead.
665 *
666 * @remarks If o1 and o2 are the same geom then this function will do nothing
667 * and return 0. Technically speaking an object intersects with itself, but it
668 * is not useful to find contact points in this case.
669 *
670 * @remarks This function does not care if o1 and o2 are in the same space or not
671 * (or indeed if they are in any space at all).
672 *
673 * @ingroup collide
674 */
675ODE_API int dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact,
676 int skip);
677
678/**
679 * @brief Determines which pairs of geoms in a space may potentially intersect,
680 * and calls the callback function for each candidate pair.
681 *
682 * @param space The space to test.
683 *
684 * @param data Passed from dSpaceCollide directly to the callback
685 * function. Its meaning is user defined. The o1 and o2 arguments are the
686 * geoms that may be near each other.
687 *
688 * @param callback A callback function is of type @ref dNearCallback.
689 *
690 * @remarks Other spaces that are contained within the colliding space are
691 * not treated specially, i.e. they are not recursed into. The callback
692 * function may be passed these contained spaces as one or both geom
693 * arguments.
694 *
695 * @remarks dSpaceCollide() is guaranteed to pass all intersecting geom
696 * pairs to the callback function, but may also pass close but
697 * non-intersecting pairs. The number of these calls depends on the
698 * internal algorithms used by the space. Thus you should not expect
699 * that dCollide will return contacts for every pair passed to the
700 * callback.
701 *
702 * @sa dSpaceCollide2
703 * @ingroup collide
704 */
705ODE_API void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback);
706
707
708/**
709 * @brief Determines which geoms from one space may potentially intersect with
710 * geoms from another space, and calls the callback function for each candidate
711 * pair.
712 *
713 * @param space1 The first space to test.
714 *
715 * @param space2 The second space to test.
716 *
717 * @param data Passed from dSpaceCollide directly to the callback
718 * function. Its meaning is user defined. The o1 and o2 arguments are the
719 * geoms that may be near each other.
720 *
721 * @param callback A callback function is of type @ref dNearCallback.
722 *
723 * @remarks This function can also test a single non-space geom against a
724 * space. This function is useful when there is a collision hierarchy, i.e.
725 * when there are spaces that contain other spaces.
726 *
727 * @remarks Other spaces that are contained within the colliding space are
728 * not treated specially, i.e. they are not recursed into. The callback
729 * function may be passed these contained spaces as one or both geom
730 * arguments.
731 *
732 * @remarks dSpaceCollide2() is guaranteed to pass all intersecting geom
733 * pairs to the callback function, but may also pass close but
734 * non-intersecting pairs. The number of these calls depends on the
735 * internal algorithms used by the space. Thus you should not expect
736 * that dCollide will return contacts for every pair passed to the
737 * callback.
738 *
739 * @sa dSpaceCollide
740 * @ingroup collide
741 */
742ODE_API void dSpaceCollide2 (dGeomID space1, dGeomID space2, void *data, dNearCallback *callback);
743
744
745/* ************************************************************************ */
746/* standard classes */
747
748/* the maximum number of user classes that are supported */
749enum {
750 dMaxUserClasses = 4
751};
752
753/* class numbers - each geometry object needs a unique number */
754enum {
755 dSphereClass = 0,
756 dBoxClass,
757 dCapsuleClass,
758 dCylinderClass,
759 dPlaneClass,
760 dRayClass,
761 dConvexClass,
762 dGeomTransformClass,
763 dTriMeshClass,
764 dHeightfieldClass,
765
766 dFirstSpaceClass,
767 dSimpleSpaceClass = dFirstSpaceClass,
768 dHashSpaceClass,
769 dQuadTreeSpaceClass,
770 dLastSpaceClass = dQuadTreeSpaceClass,
771
772 dFirstUserClass,
773 dLastUserClass = dFirstUserClass + dMaxUserClasses - 1,
774 dGeomNumClasses
775};
776
777
778/**
779 * @defgroup collide_sphere Sphere Class
780 * @ingroup collide
781 */
782
783/**
784 * @brief Create a sphere geom of the given radius, and return its ID.
785 *
786 * @param space a space to contain the new geom. May be null.
787 * @param radius the radius of the sphere.
788 *
789 * @returns A new sphere geom.
790 *
791 * @remarks The point of reference for a sphere is its center.
792 *
793 * @sa dGeomDestroy
794 * @sa dGeomSphereSetRadius
795 * @ingroup collide_sphere
796 */
797ODE_API dGeomID dCreateSphere (dSpaceID space, dReal radius);
798
799
800/**
801 * @brief Set the radius of a sphere geom.
802 *
803 * @param sphere the sphere to set.
804 * @param radius the new radius.
805 *
806 * @sa dGeomSphereGetRadius
807 * @ingroup collide_sphere
808 */
809ODE_API void dGeomSphereSetRadius (dGeomID sphere, dReal radius);
810
811
812/**
813 * @brief Retrieves the radius of a sphere geom.
814 *
815 * @param sphere the sphere to query.
816 *
817 * @sa dGeomSphereSetRadius
818 * @ingroup collide_sphere
819 */
820ODE_API dReal dGeomSphereGetRadius (dGeomID sphere);
821
822
823/**
824 * @brief Calculate the depth of the a given point within a sphere.
825 *
826 * @param sphere the sphere to query.
827 * @param x the X coordinate of the point.
828 * @param y the Y coordinate of the point.
829 * @param z the Z coordinate of the point.
830 *
831 * @returns The depth of the point. Points inside the sphere will have a
832 * positive depth, points outside it will have a negative depth, and points
833 * on the surface will have a depth of zero.
834 *
835 * @ingroup collide_sphere
836 */
837ODE_API dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z);
838
839
840//--> Convex Functions
841ODE_API dGeomID dCreateConvex (dSpaceID space,
842 dReal *_planes,
843 unsigned int _planecount,
844 dReal *_points,
845 unsigned int _pointcount,unsigned int *_polygons);
846
847ODE_API void dGeomSetConvex (dGeomID g,
848 dReal *_planes,
849 unsigned int _count,
850 dReal *_points,
851 unsigned int _pointcount,unsigned int *_polygons);
852//<-- Convex Functions
853
854/**
855 * @defgroup collide_box Box Class
856 * @ingroup collide
857 */
858
859/**
860 * @brief Create a box geom with the provided side lengths.
861 *
862 * @param space a space to contain the new geom. May be null.
863 * @param lx the length of the box along the X axis
864 * @param ly the length of the box along the Y axis
865 * @param lz the length of the box along the Z axis
866 *
867 * @returns A new box geom.
868 *
869 * @remarks The point of reference for a box is its center.
870 *
871 * @sa dGeomDestroy
872 * @sa dGeomBoxSetLengths
873 * @ingroup collide_box
874 */
875ODE_API dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz);
876
877
878/**
879 * @brief Set the side lengths of the given box.
880 *
881 * @param box the box to set
882 * @param lx the length of the box along the X axis
883 * @param ly the length of the box along the Y axis
884 * @param lz the length of the box along the Z axis
885 *
886 * @sa dGeomBoxGetLengths
887 * @ingroup collide_box
888 */
889ODE_API void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz);
890
891
892/**
893 * @brief Get the side lengths of a box.
894 *
895 * @param box the box to query
896 * @param result the returned side lengths
897 *
898 * @sa dGeomBoxSetLengths
899 * @ingroup collide_box
900 */
901ODE_API void dGeomBoxGetLengths (dGeomID box, dVector3 result);
902
903
904/**
905 * @brief Return the depth of a point in a box.
906 *
907 * @param box the box to query
908 * @param x the X coordinate of the point to test.
909 * @param y the Y coordinate of the point to test.
910 * @param z the Z coordinate of the point to test.
911 *
912 * @returns The depth of the point. Points inside the box will have a
913 * positive depth, points outside it will have a negative depth, and points
914 * on the surface will have a depth of zero.
915 */
916ODE_API dReal dGeomBoxPointDepth (dGeomID box, dReal x, dReal y, dReal z);
917
918
919ODE_API dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d);
920ODE_API void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d);
921ODE_API void dGeomPlaneGetParams (dGeomID plane, dVector4 result);
922ODE_API dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z);
923
924ODE_API dGeomID dCreateCapsule (dSpaceID space, dReal radius, dReal length);
925ODE_API void dGeomCapsuleSetParams (dGeomID ccylinder, dReal radius, dReal length);
926ODE_API void dGeomCapsuleGetParams (dGeomID ccylinder, dReal *radius, dReal *length);
927ODE_API dReal dGeomCapsulePointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z);
928
929// For now we want to have a backwards compatible C-API, note: C++ API is not.
930#define dCreateCCylinder dCreateCapsule
931#define dGeomCCylinderSetParams dGeomCapsuleSetParams
932#define dGeomCCylinderGetParams dGeomCapsuleGetParams
933#define dGeomCCylinderPointDepth dGeomCapsulePointDepth
934#define dCCylinderClass dCapsuleClass
935
936ODE_API dGeomID dCreateCylinder (dSpaceID space, dReal radius, dReal length);
937ODE_API void dGeomCylinderSetParams (dGeomID cylinder, dReal radius, dReal length);
938ODE_API void dGeomCylinderGetParams (dGeomID cylinder, dReal *radius, dReal *length);
939
940ODE_API dGeomID dCreateRay (dSpaceID space, dReal length);
941ODE_API void dGeomRaySetLength (dGeomID ray, dReal length);
942ODE_API dReal dGeomRayGetLength (dGeomID ray);
943ODE_API void dGeomRaySet (dGeomID ray, dReal px, dReal py, dReal pz,
944 dReal dx, dReal dy, dReal dz);
945ODE_API void dGeomRayGet (dGeomID ray, dVector3 start, dVector3 dir);
946
947/*
948 * Set/get ray flags that influence ray collision detection.
949 * These flags are currently only noticed by the trimesh collider, because
950 * they can make a major differences there.
951 */
952ODE_API void dGeomRaySetParams (dGeomID g, int FirstContact, int BackfaceCull);
953ODE_API void dGeomRayGetParams (dGeomID g, int *FirstContact, int *BackfaceCull);
954ODE_API void dGeomRaySetClosestHit (dGeomID g, int closestHit);
955ODE_API int dGeomRayGetClosestHit (dGeomID g);
956
957#include "collision_trimesh.h"
958
959ODE_API dGeomID dCreateGeomTransform (dSpaceID space);
960ODE_API void dGeomTransformSetGeom (dGeomID g, dGeomID obj);
961ODE_API dGeomID dGeomTransformGetGeom (dGeomID g);
962ODE_API void dGeomTransformSetCleanup (dGeomID g, int mode);
963ODE_API int dGeomTransformGetCleanup (dGeomID g);
964ODE_API void dGeomTransformSetInfo (dGeomID g, int mode);
965ODE_API int dGeomTransformGetInfo (dGeomID g);
966
967
968/* ************************************************************************ */
969/* heightfield functions */
970
971
972// Data storage for heightfield data.
973struct dxHeightfieldData;
974typedef struct dxHeightfieldData* dHeightfieldDataID;
975
976
977/**
978 * @brief Callback prototype
979 *
980 * Used by the callback heightfield data type to sample a height for a
981 * given cell position.
982 *
983 * @param p_user_data User data specified when creating the dHeightfieldDataID
984 * @param x The index of a sample in the local x axis. It is a value
985 * in the range zero to ( nWidthSamples - 1 ).
986 * @param x The index of a sample in the local z axis. It is a value
987 * in the range zero to ( nDepthSamples - 1 ).
988 *
989 * @return The sample height which is then scaled and offset using the
990 * values specified when the heightfield data was created.
991 *
992 * @ingroup collide
993 */
994typedef dReal dHeightfieldGetHeight( void* p_user_data, int x, int z );
995
996
997
998/**
999 * @brief Creates a heightfield geom.
1000 *
1001 * Uses the information in the given dHeightfieldDataID to construct
1002 * a geom representing a heightfield in a collision space.
1003 *
1004 * @param space The space to add the geom to.
1005 * @param data The dHeightfieldDataID created by dGeomHeightfieldDataCreate and
1006 * setup by dGeomHeightfieldDataBuildCallback, dGeomHeightfieldDataBuildByte,
1007 * dGeomHeightfieldDataBuildShort or dGeomHeightfieldDataBuildFloat.
1008 * @param bPlaceable If non-zero this geom can be transformed in the world using the
1009 * usual functions such as dGeomSetPosition and dGeomSetRotation. If the geom is
1010 * not set as placeable, then it uses a fixed orientation where the global y axis
1011 * represents the dynamic 'height' of the heightfield.
1012 *
1013 * @return A geom id to reference this geom in other calls.
1014 *
1015 * @ingroup collide
1016 */
1017ODE_API dGeomID dCreateHeightfield( dSpaceID space,
1018 dHeightfieldDataID data, int bPlaceable );
1019
1020
1021/**
1022 * @brief Creates a new empty dHeightfieldDataID.
1023 *
1024 * Allocates a new dHeightfieldDataID and returns it. You must call
1025 * dGeomHeightfieldDataDestroy to destroy it after the geom has been removed.
1026 * The dHeightfieldDataID value is used when specifying a data format type.
1027 *
1028 * @return A dHeightfieldDataID for use with dGeomHeightfieldDataBuildCallback,
1029 * dGeomHeightfieldDataBuildByte, dGeomHeightfieldDataBuildShort or
1030 * dGeomHeightfieldDataBuildFloat.
1031 * @ingroup collide
1032 */
1033ODE_API dHeightfieldDataID dGeomHeightfieldDataCreate();
1034
1035
1036/**
1037 * @brief Destroys a dHeightfieldDataID.
1038 *
1039 * Deallocates a given dHeightfieldDataID and all managed resources.
1040 *
1041 * @param d A dHeightfieldDataID created by dGeomHeightfieldDataCreate
1042 * @ingroup collide
1043 */
1044ODE_API void dGeomHeightfieldDataDestroy( dHeightfieldDataID d );
1045
1046
1047
1048/**
1049 * @brief Configures a dHeightfieldDataID to use a callback to
1050 * retrieve height data.
1051 *
1052 * Before a dHeightfieldDataID can be used by a geom it must be
1053 * configured to specify the format of the height data.
1054 * This call specifies that the heightfield data is computed by
1055 * the user and it should use the given callback when determining
1056 * the height of a given element of it's shape.
1057 *
1058 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1059 *
1060 * @param width Specifies the total 'width' of the heightfield along
1061 * the geom's local x axis.
1062 * @param depth Specifies the total 'depth' of the heightfield along
1063 * the geom's local z axis.
1064 *
1065 * @param widthSamples Specifies the number of vertices to sample
1066 * along the width of the heightfield. Each vertex has a corresponding
1067 * height value which forms the overall shape.
1068 * Naturally this value must be at least two or more.
1069 * @param depthSamples Specifies the number of vertices to sample
1070 * along the depth of the heightfield.
1071 *
1072 * @param scale A uniform scale applied to all raw height data.
1073 * @param offset An offset applied to the scaled height data.
1074 *
1075 * @param thickness A value subtracted from the lowest height
1076 * value which in effect adds an additional cuboid to the base of the
1077 * heightfield. This is used to prevent geoms from looping under the
1078 * desired terrain and not registering as a collision. Note that the
1079 * thickness is not affected by the scale or offset parameters.
1080 *
1081 * @param bWrap If non-zero the heightfield will infinitely tile in both
1082 * directions along the local x and z axes. If zero the heightfield is
1083 * bounded from zero to width in the local x axis, and zero to depth in
1084 * the local z axis.
1085 *
1086 * @ingroup collide
1087 */
1088ODE_API void dGeomHeightfieldDataBuildCallback( dHeightfieldDataID d,
1089 void* pUserData, dHeightfieldGetHeight* pCallback,
1090 dReal width, dReal depth, int widthSamples, int depthSamples,
1091 dReal scale, dReal offset, dReal thickness, int bWrap );
1092
1093/**
1094 * @brief Configures a dHeightfieldDataID to use height data in byte format.
1095 *
1096 * Before a dHeightfieldDataID can be used by a geom it must be
1097 * configured to specify the format of the height data.
1098 * This call specifies that the heightfield data is stored as a rectangular
1099 * array of bytes (8 bit unsigned) representing the height at each sample point.
1100 *
1101 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1102 *
1103 * @param pHeightData A pointer to the height data.
1104 * @param bCopyHeightData When non-zero the height data is copied to an
1105 * internal store. When zero the height data is accessed by reference and
1106 * so must persist throughout the lifetime of the heightfield.
1107 *
1108 * @param width Specifies the total 'width' of the heightfield along
1109 * the geom's local x axis.
1110 * @param depth Specifies the total 'depth' of the heightfield along
1111 * the geom's local z axis.
1112 *
1113 * @param widthSamples Specifies the number of vertices to sample
1114 * along the width of the heightfield. Each vertex has a corresponding
1115 * height value which forms the overall shape.
1116 * Naturally this value must be at least two or more.
1117 * @param depthSamples Specifies the number of vertices to sample
1118 * along the depth of the heightfield.
1119 *
1120 * @param scale A uniform scale applied to all raw height data.
1121 * @param offset An offset applied to the scaled height data.
1122 *
1123 * @param thickness A value subtracted from the lowest height
1124 * value which in effect adds an additional cuboid to the base of the
1125 * heightfield. This is used to prevent geoms from looping under the
1126 * desired terrain and not registering as a collision. Note that the
1127 * thickness is not affected by the scale or offset parameters.
1128 *
1129 * @param bWrap If non-zero the heightfield will infinitely tile in both
1130 * directions along the local x and z axes. If zero the heightfield is
1131 * bounded from zero to width in the local x axis, and zero to depth in
1132 * the local z axis.
1133 *
1134 * @ingroup collide
1135 */
1136ODE_API void dGeomHeightfieldDataBuildByte( dHeightfieldDataID d,
1137 const unsigned char* pHeightData, int bCopyHeightData,
1138 dReal width, dReal depth, int widthSamples, int depthSamples,
1139 dReal scale, dReal offset, dReal thickness, int bWrap );
1140
1141/**
1142 * @brief Configures a dHeightfieldDataID to use height data in short format.
1143 *
1144 * Before a dHeightfieldDataID can be used by a geom it must be
1145 * configured to specify the format of the height data.
1146 * This call specifies that the heightfield data is stored as a rectangular
1147 * array of shorts (16 bit signed) representing the height at each sample point.
1148 *
1149 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1150 *
1151 * @param pHeightData A pointer to the height data.
1152 * @param bCopyHeightData When non-zero the height data is copied to an
1153 * internal store. When zero the height data is accessed by reference and
1154 * so must persist throughout the lifetime of the heightfield.
1155 *
1156 * @param width Specifies the total 'width' of the heightfield along
1157 * the geom's local x axis.
1158 * @param depth Specifies the total 'depth' of the heightfield along
1159 * the geom's local z axis.
1160 *
1161 * @param widthSamples Specifies the number of vertices to sample
1162 * along the width of the heightfield. Each vertex has a corresponding
1163 * height value which forms the overall shape.
1164 * Naturally this value must be at least two or more.
1165 * @param depthSamples Specifies the number of vertices to sample
1166 * along the depth of the heightfield.
1167 *
1168 * @param scale A uniform scale applied to all raw height data.
1169 * @param offset An offset applied to the scaled height data.
1170 *
1171 * @param thickness A value subtracted from the lowest height
1172 * value which in effect adds an additional cuboid to the base of the
1173 * heightfield. This is used to prevent geoms from looping under the
1174 * desired terrain and not registering as a collision. Note that the
1175 * thickness is not affected by the scale or offset parameters.
1176 *
1177 * @param bWrap If non-zero the heightfield will infinitely tile in both
1178 * directions along the local x and z axes. If zero the heightfield is
1179 * bounded from zero to width in the local x axis, and zero to depth in
1180 * the local z axis.
1181 *
1182 * @ingroup collide
1183 */
1184ODE_API void dGeomHeightfieldDataBuildShort( dHeightfieldDataID d,
1185 const short* pHeightData, int bCopyHeightData,
1186 dReal width, dReal depth, int widthSamples, int depthSamples,
1187 dReal scale, dReal offset, dReal thickness, int bWrap );
1188
1189/**
1190 * @brief Configures a dHeightfieldDataID to use height data in
1191 * single precision floating point format.
1192 *
1193 * Before a dHeightfieldDataID can be used by a geom it must be
1194 * configured to specify the format of the height data.
1195 * This call specifies that the heightfield data is stored as a rectangular
1196 * array of single precision floats representing the height at each
1197 * sample point.
1198 *
1199 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1200 *
1201 * @param pHeightData A pointer to the height data.
1202 * @param bCopyHeightData When non-zero the height data is copied to an
1203 * internal store. When zero the height data is accessed by reference and
1204 * so must persist throughout the lifetime of the heightfield.
1205 *
1206 * @param width Specifies the total 'width' of the heightfield along
1207 * the geom's local x axis.
1208 * @param depth Specifies the total 'depth' of the heightfield along
1209 * the geom's local z axis.
1210 *
1211 * @param widthSamples Specifies the number of vertices to sample
1212 * along the width of the heightfield. Each vertex has a corresponding
1213 * height value which forms the overall shape.
1214 * Naturally this value must be at least two or more.
1215 * @param depthSamples Specifies the number of vertices to sample
1216 * along the depth of the heightfield.
1217 *
1218 * @param scale A uniform scale applied to all raw height data.
1219 * @param offset An offset applied to the scaled height data.
1220 *
1221 * @param thickness A value subtracted from the lowest height
1222 * value which in effect adds an additional cuboid to the base of the
1223 * heightfield. This is used to prevent geoms from looping under the
1224 * desired terrain and not registering as a collision. Note that the
1225 * thickness is not affected by the scale or offset parameters.
1226 *
1227 * @param bWrap If non-zero the heightfield will infinitely tile in both
1228 * directions along the local x and z axes. If zero the heightfield is
1229 * bounded from zero to width in the local x axis, and zero to depth in
1230 * the local z axis.
1231 *
1232 * @ingroup collide
1233 */
1234ODE_API void dGeomHeightfieldDataBuildSingle( dHeightfieldDataID d,
1235 const float* pHeightData, int bCopyHeightData,
1236 dReal width, dReal depth, int widthSamples, int depthSamples,
1237 dReal scale, dReal offset, dReal thickness, int bWrap );
1238
1239/**
1240 * @brief Configures a dHeightfieldDataID to use height data in
1241 * double precision floating point format.
1242 *
1243 * Before a dHeightfieldDataID can be used by a geom it must be
1244 * configured to specify the format of the height data.
1245 * This call specifies that the heightfield data is stored as a rectangular
1246 * array of double precision floats representing the height at each
1247 * sample point.
1248 *
1249 * @param d A new dHeightfieldDataID created by dGeomHeightfieldDataCreate
1250 *
1251 * @param pHeightData A pointer to the height data.
1252 * @param bCopyHeightData When non-zero the height data is copied to an
1253 * internal store. When zero the height data is accessed by reference and
1254 * so must persist throughout the lifetime of the heightfield.
1255 *
1256 * @param width Specifies the total 'width' of the heightfield along
1257 * the geom's local x axis.
1258 * @param depth Specifies the total 'depth' of the heightfield along
1259 * the geom's local z axis.
1260 *
1261 * @param widthSamples Specifies the number of vertices to sample
1262 * along the width of the heightfield. Each vertex has a corresponding
1263 * height value which forms the overall shape.
1264 * Naturally this value must be at least two or more.
1265 * @param depthSamples Specifies the number of vertices to sample
1266 * along the depth of the heightfield.
1267 *
1268 * @param scale A uniform scale applied to all raw height data.
1269 * @param offset An offset applied to the scaled height data.
1270 *
1271 * @param thickness A value subtracted from the lowest height
1272 * value which in effect adds an additional cuboid to the base of the
1273 * heightfield. This is used to prevent geoms from looping under the
1274 * desired terrain and not registering as a collision. Note that the
1275 * thickness is not affected by the scale or offset parameters.
1276 *
1277 * @param bWrap If non-zero the heightfield will infinitely tile in both
1278 * directions along the local x and z axes. If zero the heightfield is
1279 * bounded from zero to width in the local x axis, and zero to depth in
1280 * the local z axis.
1281 *
1282 * @ingroup collide
1283 */
1284ODE_API void dGeomHeightfieldDataBuildDouble( dHeightfieldDataID d,
1285 const double* pHeightData, int bCopyHeightData,
1286 dReal width, dReal depth, int widthSamples, int depthSamples,
1287 dReal scale, dReal offset, dReal thickness, int bWrap );
1288
1289/**
1290 * @brief Manually set the minimum and maximum height bounds.
1291 *
1292 * This call allows you to set explicit min / max values after initial
1293 * creation typically for callback heightfields which default to +/- infinity,
1294 * or those whose data has changed. This must be set prior to binding with a
1295 * geom, as the the AABB is not recomputed after it's first generation.
1296 *
1297 * @remarks The minimum and maximum values are used to compute the AABB
1298 * for the heightfield which is used for early rejection of collisions.
1299 * A close fit will yield a more efficient collision check.
1300 *
1301 * @param d A dHeightfieldDataID created by dGeomHeightfieldDataCreate
1302 * @param min_height The new minimum height value. Scale, offset and thickness is then applied.
1303 * @param max_height The new maximum height value. Scale and offset is then applied.
1304 * @ingroup collide
1305 */
1306ODE_API void dGeomHeightfieldDataSetBounds( dHeightfieldDataID d,
1307 dReal minHeight, dReal maxHeight );
1308
1309
1310/**
1311 * @brief Assigns a dHeightfieldDataID to a heightfield geom.
1312 *
1313 * Associates the given dHeightfieldDataID with a heightfield geom.
1314 * This is done without affecting the GEOM_PLACEABLE flag.
1315 *
1316 * @param g A geom created by dCreateHeightfield
1317 * @param d A dHeightfieldDataID created by dGeomHeightfieldDataCreate
1318 * @ingroup collide
1319 */
1320ODE_API void dGeomHeightfieldSetHeightfieldData( dGeomID g, dHeightfieldDataID d );
1321
1322
1323/**
1324 * @brief Gets the dHeightfieldDataID bound to a heightfield geom.
1325 *
1326 * Returns the dHeightfieldDataID associated with a heightfield geom.
1327 *
1328 * @param g A geom created by dCreateHeightfield
1329 * @return The dHeightfieldDataID which may be NULL if none was assigned.
1330 * @ingroup collide
1331 */
1332ODE_API dHeightfieldDataID dGeomHeightfieldGetHeightfieldData( dGeomID g );
1333
1334
1335
1336/* ************************************************************************ */
1337/* utility functions */
1338
1339ODE_API void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a2,
1340 const dVector3 b1, const dVector3 b2,
1341 dVector3 cp1, dVector3 cp2);
1342
1343ODE_API int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1,
1344 const dVector3 side1, const dVector3 _p2,
1345 const dMatrix3 R2, const dVector3 side2);
1346
1347// The meaning of flags parameter is the same as in dCollide()
1348ODE_API int dBoxBox (const dVector3 p1, const dMatrix3 R1,
1349 const dVector3 side1, const dVector3 p2,
1350 const dMatrix3 R2, const dVector3 side2,
1351 dVector3 normal, dReal *depth, int *return_code,
1352 int flags, dContactGeom *contact, int skip);
1353
1354ODE_API void dInfiniteAABB (dGeomID geom, dReal aabb[6]);
1355ODE_API void dInitODE(void);
1356ODE_API void dCloseODE(void);
1357
1358/* ************************************************************************ */
1359/* custom classes */
1360
1361typedef void dGetAABBFn (dGeomID, dReal aabb[6]);
1362typedef int dColliderFn (dGeomID o1, dGeomID o2,
1363 int flags, dContactGeom *contact, int skip);
1364typedef dColliderFn * dGetColliderFnFn (int num);
1365typedef void dGeomDtorFn (dGeomID o);
1366typedef int dAABBTestFn (dGeomID o1, dGeomID o2, dReal aabb[6]);
1367
1368typedef struct dGeomClass {
1369 int bytes;
1370 dGetColliderFnFn *collider;
1371 dGetAABBFn *aabb;
1372 dAABBTestFn *aabb_test;
1373 dGeomDtorFn *dtor;
1374} dGeomClass;
1375
1376ODE_API int dCreateGeomClass (const dGeomClass *classptr);
1377ODE_API void * dGeomGetClassData (dGeomID);
1378ODE_API dGeomID dCreateGeom (int classnum);
1379
1380/* ************************************************************************ */
1381
1382#ifdef __cplusplus
1383}
1384#endif
1385
1386#endif
diff --git a/libraries/ode-0.9/include/ode/collision_space.h b/libraries/ode-0.9/include/ode/collision_space.h
new file mode 100644
index 0000000..fb1f83f
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/collision_space.h
@@ -0,0 +1,76 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_COLLISION_SPACE_H_
24#define _ODE_COLLISION_SPACE_H_
25
26#include <ode/common.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32struct dContactGeom;
33
34/**
35 * @brief User callback for geom-geom collision testing.
36 *
37 * @param data The user data object, as passed to dSpaceCollide.
38 * @param o1 The first geom being tested.
39 * @param o2 The second geom being test.
40 *
41 * @remarks The callback function can call dCollide on o1 and o2 to generate
42 * contact points between each pair. Then these contact points may be added
43 * to the simulation as contact joints. The user's callback function can of
44 * course chose not to call dCollide for any pair, e.g. if the user decides
45 * that those pairs should not interact.
46 *
47 * @ingroup collide
48 */
49typedef void dNearCallback (void *data, dGeomID o1, dGeomID o2);
50
51
52ODE_API dSpaceID dSimpleSpaceCreate (dSpaceID space);
53ODE_API dSpaceID dHashSpaceCreate (dSpaceID space);
54ODE_API dSpaceID dQuadTreeSpaceCreate (dSpaceID space, dVector3 Center, dVector3 Extents, int Depth);
55
56ODE_API void dSpaceDestroy (dSpaceID);
57
58ODE_API void dHashSpaceSetLevels (dSpaceID space, int minlevel, int maxlevel);
59ODE_API void dHashSpaceGetLevels (dSpaceID space, int *minlevel, int *maxlevel);
60
61ODE_API void dSpaceSetCleanup (dSpaceID space, int mode);
62ODE_API int dSpaceGetCleanup (dSpaceID space);
63
64ODE_API void dSpaceAdd (dSpaceID, dGeomID);
65ODE_API void dSpaceRemove (dSpaceID, dGeomID);
66ODE_API int dSpaceQuery (dSpaceID, dGeomID);
67ODE_API void dSpaceClean (dSpaceID);
68ODE_API int dSpaceGetNumGeoms (dSpaceID);
69ODE_API dGeomID dSpaceGetGeom (dSpaceID, int i);
70
71
72#ifdef __cplusplus
73}
74#endif
75
76#endif
diff --git a/libraries/ode-0.9/include/ode/collision_trimesh.h b/libraries/ode-0.9/include/ode/collision_trimesh.h
new file mode 100755
index 0000000..ad85a6e
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/collision_trimesh.h
@@ -0,0 +1,205 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23/*
24 * TriMesh code by Erwin de Vries.
25 *
26 * Trimesh data.
27 * This is where the actual vertexdata (pointers), and BV tree is stored.
28 * Vertices should be single precision!
29 * This should be more sophisticated, so that the user can easyly implement
30 * another collision library, but this is a lot of work, and also costs some
31 * performance because some data has to be copied.
32 */
33
34#ifndef _ODE_COLLISION_TRIMESH_H_
35#define _ODE_COLLISION_TRIMESH_H_
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/*
42 * Data storage for triangle meshes.
43 */
44struct dxTriMeshData;
45typedef struct dxTriMeshData* dTriMeshDataID;
46
47/*
48 * These dont make much sense now, but they will later when we add more
49 * features.
50 */
51ODE_API dTriMeshDataID dGeomTriMeshDataCreate(void);
52ODE_API void dGeomTriMeshDataDestroy(dTriMeshDataID g);
53
54
55
56enum { TRIMESH_FACE_NORMALS };
57ODE_API void dGeomTriMeshDataSet(dTriMeshDataID g, int data_id, void* in_data);
58ODE_API void* dGeomTriMeshDataGet(dTriMeshDataID g, int data_id);
59
60
61
62/**
63 * We need to set the last transform after each time step for
64 * accurate collision response. These functions get and set that transform.
65 * It is stored per geom instance, rather than per dTriMeshDataID.
66 */
67ODE_API void dGeomTriMeshSetLastTransform( dGeomID g, dMatrix4 last_trans );
68ODE_API dReal* dGeomTriMeshGetLastTransform( dGeomID g );
69
70/*
71 * Build TriMesh data with single precision used in vertex data .
72 */
73ODE_API void dGeomTriMeshDataBuildSingle(dTriMeshDataID g,
74 const void* Vertices, int VertexStride, int VertexCount,
75 const void* Indices, int IndexCount, int TriStride);
76/* same again with a normals array (used as trimesh-trimesh optimization) */
77ODE_API void dGeomTriMeshDataBuildSingle1(dTriMeshDataID g,
78 const void* Vertices, int VertexStride, int VertexCount,
79 const void* Indices, int IndexCount, int TriStride,
80 const void* Normals);
81/*
82* Build TriMesh data with double pricision used in vertex data .
83*/
84ODE_API void dGeomTriMeshDataBuildDouble(dTriMeshDataID g,
85 const void* Vertices, int VertexStride, int VertexCount,
86 const void* Indices, int IndexCount, int TriStride);
87/* same again with a normals array (used as trimesh-trimesh optimization) */
88ODE_API void dGeomTriMeshDataBuildDouble1(dTriMeshDataID g,
89 const void* Vertices, int VertexStride, int VertexCount,
90 const void* Indices, int IndexCount, int TriStride,
91 const void* Normals);
92
93/*
94 * Simple build. Single/double precision based on dSINGLE/dDOUBLE!
95 */
96ODE_API void dGeomTriMeshDataBuildSimple(dTriMeshDataID g,
97 const dReal* Vertices, int VertexCount,
98 const int* Indices, int IndexCount);
99/* same again with a normals array (used as trimesh-trimesh optimization) */
100ODE_API void dGeomTriMeshDataBuildSimple1(dTriMeshDataID g,
101 const dReal* Vertices, int VertexCount,
102 const int* Indices, int IndexCount,
103 const int* Normals);
104
105/* Preprocess the trimesh data to remove mark unnecessary edges and vertices */
106ODE_API void dGeomTriMeshDataPreprocess(dTriMeshDataID g);
107/* Get and set the internal preprocessed trimesh data buffer, for loading and saving */
108ODE_API void dGeomTriMeshDataGetBuffer(dTriMeshDataID g, unsigned char** buf, int* bufLen);
109ODE_API void dGeomTriMeshDataSetBuffer(dTriMeshDataID g, unsigned char* buf);
110
111
112/*
113 * Per triangle callback. Allows the user to say if he wants a collision with
114 * a particular triangle.
115 */
116typedef int dTriCallback(dGeomID TriMesh, dGeomID RefObject, int TriangleIndex);
117ODE_API void dGeomTriMeshSetCallback(dGeomID g, dTriCallback* Callback);
118ODE_API dTriCallback* dGeomTriMeshGetCallback(dGeomID g);
119
120/*
121 * Per object callback. Allows the user to get the list of triangles in 1
122 * shot. Maybe we should remove this one.
123 */
124typedef void dTriArrayCallback(dGeomID TriMesh, dGeomID RefObject, const int* TriIndices, int TriCount);
125ODE_API void dGeomTriMeshSetArrayCallback(dGeomID g, dTriArrayCallback* ArrayCallback);
126ODE_API dTriArrayCallback* dGeomTriMeshGetArrayCallback(dGeomID g);
127
128/*
129 * Ray callback.
130 * Allows the user to say if a ray collides with a triangle on barycentric
131 * coords. The user can for example sample a texture with alpha transparency
132 * to determine if a collision should occur.
133 */
134typedef int dTriRayCallback(dGeomID TriMesh, dGeomID Ray, int TriangleIndex, dReal u, dReal v);
135ODE_API void dGeomTriMeshSetRayCallback(dGeomID g, dTriRayCallback* Callback);
136ODE_API dTriRayCallback* dGeomTriMeshGetRayCallback(dGeomID g);
137
138/*
139 * Trimesh class
140 * Construction. Callbacks are optional.
141 */
142ODE_API dGeomID dCreateTriMesh(dSpaceID space, dTriMeshDataID Data, dTriCallback* Callback, dTriArrayCallback* ArrayCallback, dTriRayCallback* RayCallback);
143
144ODE_API void dGeomTriMeshSetData(dGeomID g, dTriMeshDataID Data);
145ODE_API dTriMeshDataID dGeomTriMeshGetData(dGeomID g);
146
147
148// enable/disable/check temporal coherence
149ODE_API void dGeomTriMeshEnableTC(dGeomID g, int geomClass, int enable);
150ODE_API int dGeomTriMeshIsTCEnabled(dGeomID g, int geomClass);
151
152/*
153 * Clears the internal temporal coherence caches. When a geom has its
154 * collision checked with a trimesh once, data is stored inside the trimesh.
155 * With large worlds with lots of seperate objects this list could get huge.
156 * We should be able to do this automagically.
157 */
158ODE_API void dGeomTriMeshClearTCCache(dGeomID g);
159
160
161/*
162 * returns the TriMeshDataID
163 */
164ODE_API dTriMeshDataID dGeomTriMeshGetTriMeshDataID(dGeomID g);
165
166/*
167 * Gets a triangle.
168 */
169ODE_API void dGeomTriMeshGetTriangle(dGeomID g, int Index, dVector3* v0, dVector3* v1, dVector3* v2);
170
171/*
172 * Gets the point on the requested triangle and the given barycentric
173 * coordinates.
174 */
175ODE_API void dGeomTriMeshGetPoint(dGeomID g, int Index, dReal u, dReal v, dVector3 Out);
176
177/*
178
179This is how the strided data works:
180
181struct StridedVertex{
182 dVector3 Vertex;
183 // Userdata
184};
185int VertexStride = sizeof(StridedVertex);
186
187struct StridedTri{
188 int Indices[3];
189 // Userdata
190};
191int TriStride = sizeof(StridedTri);
192
193*/
194
195
196ODE_API int dGeomTriMeshGetTriangleCount (dGeomID g);
197
198ODE_API void dGeomTriMeshDataUpdate(dTriMeshDataID g);
199
200#ifdef __cplusplus
201}
202#endif
203
204#endif /* _ODE_COLLISION_TRIMESH_H_ */
205
diff --git a/libraries/ode-0.9/include/ode/common.h b/libraries/ode-0.9/include/ode/common.h
new file mode 100644
index 0000000..7f0a12d
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/common.h
@@ -0,0 +1,388 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_COMMON_H_
24#define _ODE_COMMON_H_
25#include <ode/config.h>
26#include <ode/error.h>
27#include <math.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33
34/* configuration stuff */
35
36/* the efficient alignment. most platforms align data structures to some
37 * number of bytes, but this is not always the most efficient alignment.
38 * for example, many x86 compilers align to 4 bytes, but on a pentium it
39 * is important to align doubles to 8 byte boundaries (for speed), and
40 * the 4 floats in a SIMD register to 16 byte boundaries. many other
41 * platforms have similar behavior. setting a larger alignment can waste
42 * a (very) small amount of memory. NOTE: this number must be a power of
43 * two. this is set to 16 by default.
44 */
45#define EFFICIENT_ALIGNMENT 16
46
47
48/* constants */
49
50/* pi and 1/sqrt(2) are defined here if necessary because they don't get
51 * defined in <math.h> on some platforms (like MS-Windows)
52 */
53
54#ifndef M_PI
55#define M_PI REAL(3.1415926535897932384626433832795029)
56#endif
57#ifndef M_SQRT1_2
58#define M_SQRT1_2 REAL(0.7071067811865475244008443621048490)
59#endif
60
61
62/* debugging:
63 * IASSERT is an internal assertion, i.e. a consistency check. if it fails
64 * we want to know where.
65 * UASSERT is a user assertion, i.e. if it fails a nice error message
66 * should be printed for the user.
67 * AASSERT is an arguments assertion, i.e. if it fails "bad argument(s)"
68 * is printed.
69 * DEBUGMSG just prints out a message
70 */
71
72#ifndef dNODEBUG
73#ifdef __GNUC__
74#define dIASSERT(a) if (!(a)) dDebug (d_ERR_IASSERT, \
75 "assertion \"" #a "\" failed in %s() [%s]",__FUNCTION__,__FILE__);
76#define dUASSERT(a,msg) if (!(a)) dDebug (d_ERR_UASSERT, \
77 msg " in %s()", __FUNCTION__);
78#define dDEBUGMSG(msg) dMessage (d_ERR_UASSERT, \
79msg " in %s() File %s Line %d", __FUNCTION__, __FILE__,__LINE__);
80#else
81#define dIASSERT(a) if (!(a)) dDebug (d_ERR_IASSERT, \
82 "assertion \"" #a "\" failed in %s:%d",__FILE__,__LINE__);
83#define dUASSERT(a,msg) if (!(a)) dDebug (d_ERR_UASSERT, \
84 msg " (%s:%d)", __FILE__,__LINE__);
85#define dDEBUGMSG(msg) dMessage (d_ERR_UASSERT, \
86 msg " (%s:%d)", __FILE__,__LINE__);
87#endif
88#else
89#define dIASSERT(a) ;
90#define dUASSERT(a,msg) ;
91#define dDEBUGMSG(msg) ;
92#endif
93#define dAASSERT(a) dUASSERT(a,"Bad argument(s)")
94
95// Macro used to suppress unused variable warning
96#define dVARIABLEUSED(a) ((void)a)
97
98/* floating point data type, vector, matrix and quaternion types */
99
100#if defined(dSINGLE)
101typedef float dReal;
102#ifdef dDOUBLE
103#error You can only #define dSINGLE or dDOUBLE, not both.
104#endif // dDOUBLE
105#elif defined(dDOUBLE)
106typedef double dReal;
107#else
108#error You must #define dSINGLE or dDOUBLE
109#endif
110
111// Detect if we've got both trimesh engines enabled.
112#if dTRIMESH_ENABLED
113#if dTRIMESH_OPCODE && dTRIMESH_GIMPACT
114#error You can only #define dTRIMESH_OPCODE or dTRIMESH_GIMPACT, not both.
115#endif
116#endif // dTRIMESH_ENABLED
117
118/* round an integer up to a multiple of 4, except that 0 and 1 are unmodified
119 * (used to compute matrix leading dimensions)
120 */
121#define dPAD(a) (((a) > 1) ? ((((a)-1)|3)+1) : (a))
122
123/* these types are mainly just used in headers */
124typedef dReal dVector3[4];
125typedef dReal dVector4[4];
126typedef dReal dMatrix3[4*3];
127typedef dReal dMatrix4[4*4];
128typedef dReal dMatrix6[8*6];
129typedef dReal dQuaternion[4];
130
131
132/* precision dependent scalar math functions */
133
134#if defined(dSINGLE)
135
136#define REAL(x) (x ## f) /* form a constant */
137#define dRecip(x) ((1.0f/(x))) /* reciprocal */
138#define dSqrt(x) (sqrtf(x)) /* square root */
139#define dRecipSqrt(x) ((1.0f/sqrtf(x))) /* reciprocal square root */
140#define dSin(x) (sinf(x)) /* sine */
141#define dCos(x) (cosf(x)) /* cosine */
142#define dFabs(x) (fabsf(x)) /* absolute value */
143#define dAtan2(y,x) (atan2f(y,x)) /* arc tangent with 2 args */
144#define dFMod(a,b) (fmodf(a,b)) /* modulo */
145#define dFloor(x) floorf(x) /* floor */
146
147#ifdef HAVE___ISNANF
148#define dIsNan(x) (__isnanf(x))
149#elif defined(HAVE__ISNANF)
150#define dIsNan(x) (_isnanf(x))
151#elif defined(HAVE_ISNANF)
152#define dIsNan(x) (isnanf(x))
153#else
154 /*
155 fall back to _isnan which is the VC way,
156 this may seem redundant since we already checked
157 for _isnan before, but if isnan is detected by
158 configure but is not found during compilation
159 we should always make sure we check for __isnanf,
160 _isnanf and isnanf in that order before falling
161 back to a default
162 */
163#define dIsNan(x) (_isnan(x))
164#endif
165
166#define dCopySign(a,b) ((dReal)copysignf(a,b))
167
168#elif defined(dDOUBLE)
169
170#define REAL(x) (x)
171#define dRecip(x) (1.0/(x))
172#define dSqrt(x) sqrt(x)
173#define dRecipSqrt(x) (1.0/sqrt(x))
174#define dSin(x) sin(x)
175#define dCos(x) cos(x)
176#define dFabs(x) fabs(x)
177#define dAtan2(y,x) atan2((y),(x))
178#define dFMod(a,b) (fmod((a),(b)))
179#define dFloor(x) floor(x)
180
181#ifdef HAVE___ISNAN
182#define dIsNan(x) (__isnan(x))
183#elif defined(HAVE__ISNAN)
184#define dIsNan(x) (_isnan(x))
185#elif defined(HAVE_ISNAN)
186#define dIsNan(x) (isnan(x))
187#else
188#define dIsNan(x) (_isnan(x))
189#endif
190
191#define dCopySign(a,b) (copysign((a),(b)))
192
193#else
194#error You must #define dSINGLE or dDOUBLE
195#endif
196
197
198/* utility */
199
200
201/* round something up to be a multiple of the EFFICIENT_ALIGNMENT */
202
203#define dEFFICIENT_SIZE(x) ((((x)-1)|(EFFICIENT_ALIGNMENT-1))+1)
204
205
206/* alloca aligned to the EFFICIENT_ALIGNMENT. note that this can waste
207 * up to 15 bytes per allocation, depending on what alloca() returns.
208 */
209
210#define dALLOCA16(n) \
211 ((char*)dEFFICIENT_SIZE(((size_t)(alloca((n)+(EFFICIENT_ALIGNMENT-1))))))
212
213
214// Use the error-checking memory allocation system. Because this system uses heap
215// (malloc) instead of stack (alloca), it is slower. However, it allows you to
216// simulate larger scenes, as well as handle out-of-memory errors in a somewhat
217// graceful manner
218
219// #define dUSE_MALLOC_FOR_ALLOCA
220
221#ifdef dUSE_MALLOC_FOR_ALLOCA
222enum {
223 d_MEMORY_OK = 0, /* no memory errors */
224 d_MEMORY_OUT_OF_MEMORY /* malloc failed due to out of memory error */
225};
226
227#endif
228
229
230
231/* internal object types (all prefixed with `dx') */
232
233struct dxWorld; /* dynamics world */
234struct dxSpace; /* collision space */
235struct dxBody; /* rigid body (dynamics object) */
236struct dxGeom; /* geometry (collision object) */
237struct dxJoint;
238struct dxJointNode;
239struct dxJointGroup;
240
241typedef struct dxWorld *dWorldID;
242typedef struct dxSpace *dSpaceID;
243typedef struct dxBody *dBodyID;
244typedef struct dxGeom *dGeomID;
245typedef struct dxJoint *dJointID;
246typedef struct dxJointGroup *dJointGroupID;
247
248
249/* error numbers */
250
251enum {
252 d_ERR_UNKNOWN = 0, /* unknown error */
253 d_ERR_IASSERT, /* internal assertion failed */
254 d_ERR_UASSERT, /* user assertion failed */
255 d_ERR_LCP /* user assertion failed */
256};
257
258
259/* joint type numbers */
260
261enum {
262 dJointTypeNone = 0, /* or "unknown" */
263 dJointTypeBall,
264 dJointTypeHinge,
265 dJointTypeSlider,
266 dJointTypeContact,
267 dJointTypeUniversal,
268 dJointTypeHinge2,
269 dJointTypeFixed,
270 dJointTypeNull,
271 dJointTypeAMotor,
272 dJointTypeLMotor,
273 dJointTypePlane2D,
274 dJointTypePR
275};
276
277
278/* an alternative way of setting joint parameters, using joint parameter
279 * structures and member constants. we don't actually do this yet.
280 */
281
282/*
283typedef struct dLimot {
284 int mode;
285 dReal lostop, histop;
286 dReal vel, fmax;
287 dReal fudge_factor;
288 dReal bounce, soft;
289 dReal suspension_erp, suspension_cfm;
290} dLimot;
291
292enum {
293 dLimotLoStop = 0x0001,
294 dLimotHiStop = 0x0002,
295 dLimotVel = 0x0004,
296 dLimotFMax = 0x0008,
297 dLimotFudgeFactor = 0x0010,
298 dLimotBounce = 0x0020,
299 dLimotSoft = 0x0040
300};
301*/
302
303
304/* standard joint parameter names. why are these here? - because we don't want
305 * to include all the joint function definitions in joint.cpp. hmmmm.
306 * MSVC complains if we call D_ALL_PARAM_NAMES_X with a blank second argument,
307 * which is why we have the D_ALL_PARAM_NAMES macro as well. please copy and
308 * paste between these two.
309 */
310
311#define D_ALL_PARAM_NAMES(start) \
312 /* parameters for limits and motors */ \
313 dParamLoStop = start, \
314 dParamHiStop, \
315 dParamVel, \
316 dParamFMax, \
317 dParamFudgeFactor, \
318 dParamBounce, \
319 dParamCFM, \
320 dParamStopERP, \
321 dParamStopCFM, \
322 /* parameters for suspension */ \
323 dParamSuspensionERP, \
324 dParamSuspensionCFM, \
325 dParamERP, \
326
327#define D_ALL_PARAM_NAMES_X(start,x) \
328 /* parameters for limits and motors */ \
329 dParamLoStop ## x = start, \
330 dParamHiStop ## x, \
331 dParamVel ## x, \
332 dParamFMax ## x, \
333 dParamFudgeFactor ## x, \
334 dParamBounce ## x, \
335 dParamCFM ## x, \
336 dParamStopERP ## x, \
337 dParamStopCFM ## x, \
338 /* parameters for suspension */ \
339 dParamSuspensionERP ## x, \
340 dParamSuspensionCFM ## x, \
341 dParamERP ## x,
342
343enum {
344 D_ALL_PARAM_NAMES(0)
345 D_ALL_PARAM_NAMES_X(0x100,2)
346 D_ALL_PARAM_NAMES_X(0x200,3)
347
348 /* add a multiple of this constant to the basic parameter numbers to get
349 * the parameters for the second, third etc axes.
350 */
351 dParamGroup=0x100
352};
353
354
355/* angular motor mode numbers */
356
357enum{
358 dAMotorUser = 0,
359 dAMotorEuler = 1
360};
361
362
363/* joint force feedback information */
364
365typedef struct dJointFeedback {
366 dVector3 f1; /* force applied to body 1 */
367 dVector3 t1; /* torque applied to body 1 */
368 dVector3 f2; /* force applied to body 2 */
369 dVector3 t2; /* torque applied to body 2 */
370} dJointFeedback;
371
372
373/* private functions that must be implemented by the collision library:
374 * (1) indicate that a geom has moved, (2) get the next geom in a body list.
375 * these functions are called whenever the position of geoms connected to a
376 * body have changed, e.g. with dBodySetPosition(), dBodySetRotation(), or
377 * when the ODE step function updates the body state.
378 */
379
380void dGeomMoved (dGeomID);
381dGeomID dGeomGetBodyNext (dGeomID);
382
383
384#ifdef __cplusplus
385}
386#endif
387
388#endif
diff --git a/libraries/ode-0.9/include/ode/compatibility.h b/libraries/ode-0.9/include/ode/compatibility.h
new file mode 100644
index 0000000..b370986
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/compatibility.h
@@ -0,0 +1,40 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_COMPATIBILITY_H_
24#define _ODE_COMPATIBILITY_H_
25
26/*
27 * ODE's backward compatibility system ensures that as ODE's API
28 * evolves, user code will not break.
29 */
30
31/*
32 * These new rotation function names are more consistent with the
33 * rest of the API.
34 */
35#define dQtoR(q,R) dRfromQ((R),(q))
36#define dRtoQ(R,q) dQfromR((q),(R))
37#define dWtoDQ(w,q,dq) dDQfromW((dq),(w),(q))
38
39
40#endif
diff --git a/libraries/ode-0.9/include/ode/config.h b/libraries/ode-0.9/include/ode/config.h
new file mode 100644
index 0000000..7d64006
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/config.h
@@ -0,0 +1,176 @@
1/* This file was autogenerated by Premake */
2#ifndef _ODE_CONFIG_H_
3#define _ODE_CONFIG_H_
4
5
6/******************************************************************
7 * CONFIGURATON SETTINGS - you can change these, and then rebuild
8 * ODE to modify the behavior of the library.
9 *
10 * dSINGLE/dDOUBLE - force ODE to use single-precision (float)
11 * or double-precision (double) for numbers.
12 * Only one should be defined.
13 *
14 * dTRIMESH_ENABLED - enable/disable trimesh support
15 * dTRIMESH_OPCODE - use the OPCODE trimesh engine
16 * dTRIMESH_GIMPACT - use the GIMPACT trimesh engine
17 * Only one trimesh engine should be enabled.
18 *
19 * dUSE_MALLOC_FOR_ALLOCA (experimental)-
20 * Use malloc() instead of alloca(). Slower,
21 * but allows for larger systems and more
22 * graceful out-of-memory handling.
23 *
24 * dTRIMESH_OPCODE_USE_NEW_TRIMESH_TRIMESH_COLLIDER (experimental)-
25 * Use an alternative trimesh-trimesh collider
26 * which should yield better results.
27 *
28 ******************************************************************/
29
30#define dSINGLE
31/* #define dDOUBLE */
32
33#define dTRIMESH_ENABLED 1
34#define dTRIMESH_OPCODE 1
35
36#define dTRIMESH_OPCODE_USE_NEW_TRIMESH_TRIMESH_COLLIDER 0
37
38/* #define dUSE_MALLOC_FOR_ALLOCA */
39
40
41/******************************************************************
42 * SYSTEM SETTINGS - you shouldn't need to change these. If you
43 * run into an issue with these settings, please report it to
44 * the ODE bug tracker at:
45 * http://sf.net/tracker/?group_id=24884&atid=382799
46 ******************************************************************/
47
48/* Try to identify the platform */
49#if defined(_XENON)
50 #define ODE_PLATFORM_XBOX360
51#elif defined(SN_TARGET_PSP_HW)
52 #define ODE_PLATFORM_PSP
53#elif defined(SN_TARGET_PS3)
54 #define ODE_PLATFORM_PS3
55#elif defined(_MSC_VER) || defined(__CYGWIN32__) || defined(__MINGW32__)
56 #define ODE_PLATFORM_WINDOWS
57#elif defined(__linux__)
58 #define ODE_PLATFORM_LINUX
59#elif defined(__APPLE__) && defined(__MACH__)
60 #define ODE_PLATFORM_OSX
61#else
62 #error "Need some help identifying the platform!"
63#endif
64
65/* Additional platform defines used in the code */
66#if defined(ODE_PLATFORM_WINDOWS) && !defined(WIN32)
67 #define WIN32
68#endif
69
70#if defined(__CYGWIN32__) || defined(__MINGW32__)
71 #define CYGWIN
72#endif
73
74#if defined(ODE_PLATFORM_OSX)
75 #define macintosh
76#endif
77
78
79/* Define a DLL export symbol for those platforms that need it */
80#if defined(ODE_PLATFORM_WINDOWS)
81 #if defined(ODE_DLL)
82 #define ODE_API __declspec(dllexport)
83 #elif !defined(ODE_LIB)
84 #define ODE_DLL_API __declspec(dllimport)
85 #endif
86#endif
87
88#if !defined(ODE_API)
89 #define ODE_API
90#endif
91
92
93/* Pull in the standard headers */
94#include <stdio.h>
95#include <stdlib.h>
96#include <stdarg.h>
97#include <math.h>
98#include <string.h>
99#include <float.h>
100
101#if !defined(ODE_PLATFORM_PS3)
102 #include <malloc.h>
103#endif
104
105#if !defined(ODE_PLATFORM_WINDOWS)
106 #include <alloca.h>
107#endif
108
109
110/* Visual C does not define these functions */
111#if defined(_MSC_VER)
112 #define copysignf _copysign
113 #define copysign _copysign
114#endif
115
116
117/* Define a value for infinity */
118#if defined(HUGE_VALF)
119 #define ODE_INFINITY4 HUGE_VALF
120 #define ODE_INFINITY8 HUGE_VAL
121#elif defined(FLT_MAX)
122 #define ODE_INFINITY4 FLT_MAX
123 #define ODE_INFINITY8 DBL_MAX
124#else
125 static union { unsigned char __c[4]; float __f; } __ode_huge_valf = {{0,0,0x80,0x7f}};
126 static union { unsigned char __c[8]; double __d; } __ode_huge_val = {{0,0,0,0,0,0,0xf0,0x7f}};
127 #define ODE_INFINITY4 (__ode_huge_valf.__f)
128 #define ODE_INFINITY8 (__ode_huge_val.__d)
129#endif
130
131#ifdef dSINGLE
132 #define dInfinity ODE_INFINITY4
133 #define dEpsilon FLT_EPSILON
134#else
135 #define dInfinity ODE_INFINITY8
136 #define dEpsilon DBL_EPSILON
137#endif
138
139
140/* Well-defined common data types...need to define for 64 bit systems */
141#if defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__)
142 #define X86_64_SYSTEM 1
143 typedef int int32;
144 typedef unsigned int uint32;
145 typedef short int16;
146 typedef unsigned short uint16;
147 typedef char int8;
148 typedef unsigned char uint8;
149#else
150 typedef int int32;
151 typedef unsigned int uint32;
152 typedef short int16;
153 typedef unsigned short uint16;
154 typedef char int8;
155 typedef unsigned char uint8;
156#endif
157
158/* An integer type that can be safely cast to a pointer. This definition
159 * should be safe even on 64-bit systems */
160typedef size_t intP;
161
162
163/* The efficient alignment. most platforms align data structures to some
164 * number of bytes, but this is not always the most efficient alignment.
165 * for example, many x86 compilers align to 4 bytes, but on a pentium it is
166 * important to align doubles to 8 byte boundaries (for speed), and the 4
167 * floats in a SIMD register to 16 byte boundaries. many other platforms have
168 * similar behavior. setting a larger alignment can waste a (very) small
169 * amount of memory. NOTE: this number must be a power of two. */
170#define EFFICIENT_ALIGNMENT 16
171
172
173/* Define this if your system supports anonymous memory maps (linux does) */
174#define MMAP_ANONYMOUS
175
176#endif
diff --git a/libraries/ode-0.9/include/ode/config.h.in b/libraries/ode-0.9/include/ode/config.h.in
new file mode 100644
index 0000000..1b05c7d
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/config.h.in
@@ -0,0 +1,377 @@
1/* include/ode/config.h.in. Generated from configure.in by autoheader. */
2
3
4#ifndef ODE_CONFIG_H
5#define ODE_CONFIG_H
6
7
8/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
9 systems. This function is required for `alloca.c' support on those systems.
10 */
11#undef CRAY_STACKSEG_END
12
13/* Define to 1 if using `alloca.c'. */
14#undef C_ALLOCA
15
16/* Define to 1 if you have `alloca', as a function or macro. */
17#undef HAVE_ALLOCA
18
19/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
20 */
21#undef HAVE_ALLOCA_H
22
23/* Use the Apple OpenGL framework. */
24#undef HAVE_APPLE_OPENGL_FRAMEWORK
25
26/* Define to 1 if you have the `atan2f' function. */
27#undef HAVE_ATAN2F
28
29/* Define to 1 if you have the `copysign' function. */
30#undef HAVE_COPYSIGN
31
32/* Define to 1 if you have the `copysignf' function. */
33#undef HAVE_COPYSIGNF
34
35/* Define to 1 if you have the `cosf' function. */
36#undef HAVE_COSF
37
38/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
39#undef HAVE_DOPRNT
40
41/* Define to 1 if you have the `fabsf' function. */
42#undef HAVE_FABSF
43
44/* Define to 1 if you have the <float.h> header file. */
45#undef HAVE_FLOAT_H
46
47/* Define to 1 if you have the `floor' function. */
48#undef HAVE_FLOOR
49
50/* Define to 1 if you have the `fmodf' function. */
51#undef HAVE_FMODF
52
53/* Define to 1 if you have the `gettimeofday' function. */
54#undef HAVE_GETTIMEOFDAY
55
56/* Define to 1 if you have the <GL/glext.h> header file. */
57#undef HAVE_GL_GLEXT_H
58
59/* Define to 1 if you have the <GL/glu.h> header file. */
60#undef HAVE_GL_GLU_H
61
62/* Define to 1 if you have the <GL/gl.h> header file. */
63#undef HAVE_GL_GL_H
64
65/* Define to 1 if you have the <ieeefp.h> header file. */
66#undef HAVE_IEEEFP_H
67
68/* Define to 1 if you have the <inttypes.h> header file. */
69#undef HAVE_INTTYPES_H
70
71/* Define to 1 if you have the `isnan' function. */
72#undef HAVE_ISNAN
73
74/* Define to 1 if you have the `isnanf' function. */
75#undef HAVE_ISNANF
76
77/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
78 to 0 otherwise. */
79#undef HAVE_MALLOC
80
81/* Define to 1 if you have the <malloc.h> header file. */
82#undef HAVE_MALLOC_H
83
84/* Define to 1 if you have the <math.h> header file. */
85#undef HAVE_MATH_H
86
87/* Define to 1 if you have the `memmove' function. */
88#undef HAVE_MEMMOVE
89
90/* Define to 1 if you have the <memory.h> header file. */
91#undef HAVE_MEMORY_H
92
93/* Define to 1 if you have the `memset' function. */
94#undef HAVE_MEMSET
95
96/* Define to 1 if libc includes obstacks. */
97#undef HAVE_OBSTACK
98
99/* Define to 1 if your system has a GNU libc compatible `realloc' function,
100 and to 0 otherwise. */
101#undef HAVE_REALLOC
102
103/* Define to 1 if you have the `select' function. */
104#undef HAVE_SELECT
105
106/* Define to 1 if you have the `sinf' function. */
107#undef HAVE_SINF
108
109/* Define to 1 if you have the `snprintf' function. */
110#undef HAVE_SNPRINTF
111
112/* Define to 1 if you have the `sqrt' function. */
113#undef HAVE_SQRT
114
115/* Define to 1 if you have the `sqrtf' function. */
116#undef HAVE_SQRTF
117
118/* Use SSE Optimizations */
119#undef HAVE_SSE
120
121/* Define to 1 if you have the <stdarg.h> header file. */
122#undef HAVE_STDARG_H
123
124/* Define to 1 if stdbool.h conforms to C99. */
125#undef HAVE_STDBOOL_H
126
127/* Define to 1 if you have the <stdint.h> header file. */
128#undef HAVE_STDINT_H
129
130/* Define to 1 if you have the <stdio.h> header file. */
131#undef HAVE_STDIO_H
132
133/* Define to 1 if you have the <stdlib.h> header file. */
134#undef HAVE_STDLIB_H
135
136/* Define to 1 if you have the <strings.h> header file. */
137#undef HAVE_STRINGS_H
138
139/* Define to 1 if you have the <string.h> header file. */
140#undef HAVE_STRING_H
141
142/* Define to 1 if you have the <sys/select.h> header file. */
143#undef HAVE_SYS_SELECT_H
144
145/* Define to 1 if you have the <sys/socket.h> header file. */
146#undef HAVE_SYS_SOCKET_H
147
148/* Define to 1 if you have the <sys/stat.h> header file. */
149#undef HAVE_SYS_STAT_H
150
151/* Define to 1 if you have the <sys/time.h> header file. */
152#undef HAVE_SYS_TIME_H
153
154/* Define to 1 if you have the <sys/types.h> header file. */
155#undef HAVE_SYS_TYPES_H
156
157/* Define to 1 if you have the <time.h> header file. */
158#undef HAVE_TIME_H
159
160/* Define to 1 if you have the <unistd.h> header file. */
161#undef HAVE_UNISTD_H
162
163/* Define to 1 if you have the <values.h> header file. */
164#undef HAVE_VALUES_H
165
166/* Define to 1 if you have the `vprintf' function. */
167#undef HAVE_VPRINTF
168
169/* Define to 1 if you have the `vsnprintf' function. */
170#undef HAVE_VSNPRINTF
171
172/* Define to 1 if the system has the type `_Bool'. */
173#undef HAVE__BOOL
174
175/* Define to 1 if you have the `_isnan' function. */
176#undef HAVE__ISNAN
177
178/* Define to 1 if you have the `_isnanf' function. */
179#undef HAVE__ISNANF
180
181/* Define to 1 if you have the `__isnan' function. */
182#undef HAVE___ISNAN
183
184/* Define to 1 if you have the `__isnanf' function. */
185#undef HAVE___ISNANF
186
187/* Name of package */
188#undef PACKAGE
189
190/* Define to the address where bug reports for this package should be sent. */
191#undef PACKAGE_BUGREPORT
192
193/* Define to the full name of this package. */
194#undef PACKAGE_NAME
195
196/* Define to the full name and version of this package. */
197#undef PACKAGE_STRING
198
199/* Define to the one symbol short name of this package. */
200#undef PACKAGE_TARNAME
201
202/* Define to the version of this package. */
203#undef PACKAGE_VERSION
204
205/* is this a pentium on a gcc-based platform? */
206#undef PENTIUM
207
208/* Define to the type of arg 1 for `select'. */
209#undef SELECT_TYPE_ARG1
210
211/* Define to the type of args 2, 3 and 4 for `select'. */
212#undef SELECT_TYPE_ARG234
213
214/* Define to the type of arg 5 for `select'. */
215#undef SELECT_TYPE_ARG5
216
217/* The size of `char', as computed by sizeof. */
218#undef SIZEOF_CHAR
219
220/* The size of `int', as computed by sizeof. */
221#undef SIZEOF_INT
222
223/* The size of `long int', as computed by sizeof. */
224#undef SIZEOF_LONG_INT
225
226/* The size of `short', as computed by sizeof. */
227#undef SIZEOF_SHORT
228
229/* The size of `void*', as computed by sizeof. */
230#undef SIZEOF_VOIDP
231
232/* The extension for shared libraries. */
233#undef SO_EXT
234
235/* If using the C implementation of alloca, define if you know the
236 direction of stack growth for your system; otherwise it will be
237 automatically deduced at runtime.
238 STACK_DIRECTION > 0 => grows toward higher addresses
239 STACK_DIRECTION < 0 => grows toward lower addresses
240 STACK_DIRECTION = 0 => direction of growth unknown */
241#undef STACK_DIRECTION
242
243/* Define to 1 if you have the ANSI C header files. */
244#undef STDC_HEADERS
245
246/* Version number of package */
247#undef VERSION
248
249/* Define to 1 if your processor stores words with the most significant byte
250 first (like Motorola and SPARC, unlike Intel and VAX). */
251#undef WORDS_BIGENDIAN
252
253/* is this a X86_64 system on a gcc-based platform? */
254#undef X86_64_SYSTEM
255
256/* Define to 1 if the X Window System is missing or not being used. */
257#undef X_DISPLAY_MISSING
258
259/* Define to empty if `const' does not conform to ANSI C. */
260#undef const
261
262/* Use double precision */
263#undef dDOUBLE
264
265/* dEpsilon Constant */
266#undef dEpsilon
267
268/* Use gyroscopic terms */
269#undef dGYROSCOPIC
270
271/* dInfinity Constant */
272#undef dInfinity
273
274/* Disable debug output */
275#undef dNODEBUG
276
277/* Use single precision */
278#undef dSINGLE
279
280/* Define to `__inline__' or `__inline' if that's what the C compiler
281 calls it, or to nothing if 'inline' is not supported under any name. */
282#ifndef __cplusplus
283#undef inline
284#endif
285
286/* Define to rpl_malloc if the replacement function should be used. */
287#undef malloc
288
289/* Define to rpl_realloc if the replacement function should be used. */
290#undef realloc
291
292/* Define to `unsigned int' if <sys/types.h> does not define. */
293#undef size_t
294
295/* Define to empty if the keyword `volatile' does not work. Warning: valid
296 code using `volatile' can become incorrect without. Disable with care. */
297#undef volatile
298
299
300
301#ifdef HAVE_ALLOCA_H
302#include <alloca.h>
303#endif
304#if defined(HAVE_IEEEFP_H) && !defined(__CYGWIN__)
305// This header creates conflicts with math.h in Cygwin.
306#include <ieeefp.h>
307#endif
308#ifdef HAVE_STDIO_H
309#include <stdio.h>
310#endif
311#ifdef HAVE_STDLIB_H
312#include <stdlib.h>
313#endif
314#ifdef HAVE_MATH_H
315#include <math.h>
316#endif
317#ifdef HAVE_STRING_H
318#include <string.h>
319#endif
320#ifdef HAVE_STDARG_H
321#include <stdarg.h>
322#endif
323#ifdef HAVE_MALLOC_H
324#include <malloc.h>
325#endif
326#ifdef HAVE_VALUES_H
327#include <values.h>
328#endif
329#ifdef HAVE_FLOAT_H
330#include <float.h>
331#endif
332#if SIZEOF_CHAR == 1
333typedef char int8;
334typedef unsigned char uint8;
335#else
336#error "expecting sizeof(char) == 1"
337#endif
338#if SIZEOF_SHORT == 2
339typedef short int16;
340typedef unsigned short uint16;
341#else
342#error "can not find 2 byte integer type"
343#endif
344/* integer types (we assume int >= 32 bits) */
345#if SIZEOF_INT == 4
346typedef short int32;
347typedef unsigned short uint32;
348#else
349#error "can not find 4 byte integer type"
350#endif
351/* an integer type that we can safely cast a pointer to and
352 * from without loss of bits.
353 */
354#if SIZEOF_SHORT == SIZEOF_VOIDP
355typedef unsigned short intP;
356#elif SIZEOF_INT == SIZEOF_VOIDP
357typedef unsigned int intP;
358#elif SIZEOF_LONG_INT == SIZEOF_VOIDP
359typedef unsigned long int intP;
360#endif
361
362/*
363Handle Windows DLL odities
364Its easier to export all symbols using the -shared flag
365for MinGW than differentiating with declspec,
366so only do it for MSVC
367*/
368#if defined(ODE_DLL) && defined(WIN32) && defined(_MSC_VER)
369#define ODE_API __declspec( dllexport )
370#elif !defined(ODE_DLL) && defined(WIN32) && defined(MSC_VER)
371#define ODE_API __declspec( dllimport )
372#else
373#define ODE_API
374#endif
375
376#endif /* #define ODE_CONFIG_H */
377
diff --git a/libraries/ode-0.9/include/ode/contact.h b/libraries/ode-0.9/include/ode/contact.h
new file mode 100644
index 0000000..fc634e7
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/contact.h
@@ -0,0 +1,103 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_CONTACT_H_
24#define _ODE_CONTACT_H_
25
26#include <ode/common.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32
33enum {
34 dContactMu2 = 0x001,
35 dContactFDir1 = 0x002,
36 dContactBounce = 0x004,
37 dContactSoftERP = 0x008,
38 dContactSoftCFM = 0x010,
39 dContactMotion1 = 0x020,
40 dContactMotion2 = 0x040,
41 dContactSlip1 = 0x080,
42 dContactSlip2 = 0x100,
43
44 dContactApprox0 = 0x0000,
45 dContactApprox1_1 = 0x1000,
46 dContactApprox1_2 = 0x2000,
47 dContactApprox1 = 0x3000
48};
49
50
51typedef struct dSurfaceParameters {
52 /* must always be defined */
53 int mode;
54 dReal mu;
55
56 /* only defined if the corresponding flag is set in mode */
57 dReal mu2;
58 dReal bounce;
59 dReal bounce_vel;
60 dReal soft_erp;
61 dReal soft_cfm;
62 dReal motion1,motion2;
63 dReal slip1,slip2;
64} dSurfaceParameters;
65
66
67/**
68 * @brief Describe the contact point between two geoms.
69 *
70 * If two bodies touch, or if a body touches a static feature in its
71 * environment, the contact is represented by one or more "contact
72 * points", described by dContactGeom.
73 *
74 * The convention is that if body 1 is moved along the normal vector by
75 * a distance depth (or equivalently if body 2 is moved the same distance
76 * in the opposite direction) then the contact depth will be reduced to
77 * zero. This means that the normal vector points "in" to body 1.
78 *
79 * @ingroup collide
80 */
81typedef struct dContactGeom {
82 dVector3 pos; ///< contact position
83 dVector3 normal; ///< normal vector
84 dReal depth; ///< penetration depth
85 dGeomID g1,g2; ///< the colliding geoms
86 int side1,side2; ///< (to be documented)
87} dContactGeom;
88
89
90/* contact info used by contact joint */
91
92typedef struct dContact {
93 dSurfaceParameters surface;
94 dContactGeom geom;
95 dVector3 fdir1;
96} dContact;
97
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif
diff --git a/libraries/ode-0.9/include/ode/error.h b/libraries/ode-0.9/include/ode/error.h
new file mode 100644
index 0000000..bdeec37
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/error.h
@@ -0,0 +1,63 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23/* this comes from the `reuse' library. copy any changes back to the source */
24
25#ifndef _ODE_ERROR_H_
26#define _ODE_ERROR_H_
27
28#include <ode/config.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* all user defined error functions have this type. error and debug functions
35 * should not return.
36 */
37typedef void dMessageFunction (int errnum, const char *msg, va_list ap);
38
39/* set a new error, debug or warning handler. if fn is 0, the default handlers
40 * are used.
41 */
42ODE_API void dSetErrorHandler (dMessageFunction *fn);
43ODE_API void dSetDebugHandler (dMessageFunction *fn);
44ODE_API void dSetMessageHandler (dMessageFunction *fn);
45
46/* return the current error, debug or warning handler. if the return value is
47 * 0, the default handlers are in place.
48 */
49ODE_API dMessageFunction *dGetErrorHandler(void);
50ODE_API dMessageFunction *dGetDebugHandler(void);
51ODE_API dMessageFunction *dGetMessageHandler(void);
52
53/* generate a fatal error, debug trap or a message. */
54ODE_API void dError (int num, const char *msg, ...);
55ODE_API void dDebug (int num, const char *msg, ...);
56ODE_API void dMessage (int num, const char *msg, ...);
57
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif
diff --git a/libraries/ode-0.9/include/ode/export-dif.h b/libraries/ode-0.9/include/ode/export-dif.h
new file mode 100644
index 0000000..ca479ad
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/export-dif.h
@@ -0,0 +1,32 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_EXPORT_DIF_
24#define _ODE_EXPORT_DIF_
25
26#include <ode/common.h>
27
28
29ODE_API void dWorldExportDIF (dWorldID w, FILE *file, const char *world_name);
30
31
32#endif
diff --git a/libraries/ode-0.9/include/ode/mass.h b/libraries/ode-0.9/include/ode/mass.h
new file mode 100644
index 0000000..19740fc
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/mass.h
@@ -0,0 +1,125 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_MASS_H_
24#define _ODE_MASS_H_
25
26#include <ode/common.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32struct dMass;
33typedef struct dMass dMass;
34
35/**
36 * Check if a mass structure has valid value.
37 * The function check if the mass and innertia matrix are positive definits
38 *
39 * @param m A mass structure to check
40 *
41 * @return 1 if both codition are met
42 */
43ODE_API int dMassCheck(const dMass *m);
44
45ODE_API void dMassSetZero (dMass *);
46
47ODE_API void dMassSetParameters (dMass *, dReal themass,
48 dReal cgx, dReal cgy, dReal cgz,
49 dReal I11, dReal I22, dReal I33,
50 dReal I12, dReal I13, dReal I23);
51
52ODE_API void dMassSetSphere (dMass *, dReal density, dReal radius);
53ODE_API void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius);
54
55ODE_API void dMassSetCapsule (dMass *, dReal density, int direction,
56 dReal radius, dReal length);
57ODE_API void dMassSetCapsuleTotal (dMass *, dReal total_mass, int direction,
58 dReal radius, dReal length);
59
60ODE_API void dMassSetCylinder (dMass *, dReal density, int direction,
61 dReal radius, dReal length);
62ODE_API void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction,
63 dReal radius, dReal length);
64
65ODE_API void dMassSetBox (dMass *, dReal density,
66 dReal lx, dReal ly, dReal lz);
67ODE_API void dMassSetBoxTotal (dMass *, dReal total_mass,
68 dReal lx, dReal ly, dReal lz);
69
70ODE_API void dMassSetTrimesh (dMass *, dReal density, dGeomID g);
71
72ODE_API void dMassSetTrimeshTotal (dMass *m, dReal total_mass, dGeomID g);
73
74ODE_API void dMassAdjust (dMass *, dReal newmass);
75
76ODE_API void dMassTranslate (dMass *, dReal x, dReal y, dReal z);
77
78ODE_API void dMassRotate (dMass *, const dMatrix3 R);
79
80ODE_API void dMassAdd (dMass *a, const dMass *b);
81
82// Backwards compatible API
83#define dMassSetCappedCylinder dMassSetCapsule
84#define dMassSetCappedCylinderTotal dMassSetCapsuleTotal
85
86
87struct dMass {
88 dReal mass;
89 dVector4 c;
90 dMatrix3 I;
91
92#ifdef __cplusplus
93 dMass()
94 { dMassSetZero (this); }
95 void setZero()
96 { dMassSetZero (this); }
97 void setParameters (dReal themass, dReal cgx, dReal cgy, dReal cgz,
98 dReal I11, dReal I22, dReal I33,
99 dReal I12, dReal I13, dReal I23)
100 { dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); }
101 void setSphere (dReal density, dReal radius)
102 { dMassSetSphere (this,density,radius); }
103 void setCapsule (dReal density, int direction, dReal a, dReal b)
104 { dMassSetCappedCylinder (this,density,direction,a,b); }
105 void setCappedCylinder (dReal density, int direction, dReal a, dReal b)
106 { setCapsule(density, direction, a, b); }
107 void setBox (dReal density, dReal lx, dReal ly, dReal lz)
108 { dMassSetBox (this,density,lx,ly,lz); }
109 void adjust (dReal newmass)
110 { dMassAdjust (this,newmass); }
111 void translate (dReal x, dReal y, dReal z)
112 { dMassTranslate (this,x,y,z); }
113 void rotate (const dMatrix3 R)
114 { dMassRotate (this,R); }
115 void add (const dMass *b)
116 { dMassAdd (this,b); }
117#endif
118};
119
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif
diff --git a/libraries/ode-0.9/include/ode/matrix.h b/libraries/ode-0.9/include/ode/matrix.h
new file mode 100644
index 0000000..eeb004d
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/matrix.h
@@ -0,0 +1,194 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23/* optimized and unoptimized vector and matrix functions */
24
25#ifndef _ODE_MATRIX_H_
26#define _ODE_MATRIX_H_
27
28#include <ode/common.h>
29
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35
36/* set a vector/matrix of size n to all zeros, or to a specific value. */
37
38ODE_API void dSetZero (dReal *a, int n);
39ODE_API void dSetValue (dReal *a, int n, dReal value);
40
41
42/* get the dot product of two n*1 vectors. if n <= 0 then
43 * zero will be returned (in which case a and b need not be valid).
44 */
45
46ODE_API dReal dDot (const dReal *a, const dReal *b, int n);
47
48
49/* get the dot products of (a0,b), (a1,b), etc and return them in outsum.
50 * all vectors are n*1. if n <= 0 then zeroes will be returned (in which case
51 * the input vectors need not be valid). this function is somewhat faster
52 * than calling dDot() for all of the combinations separately.
53 */
54
55/* NOT INCLUDED in the library for now.
56void dMultidot2 (const dReal *a0, const dReal *a1,
57 const dReal *b, dReal *outsum, int n);
58*/
59
60
61/* matrix multiplication. all matrices are stored in standard row format.
62 * the digit refers to the argument that is transposed:
63 * 0: A = B * C (sizes: A:p*r B:p*q C:q*r)
64 * 1: A = B' * C (sizes: A:p*r B:q*p C:q*r)
65 * 2: A = B * C' (sizes: A:p*r B:p*q C:r*q)
66 * case 1,2 are equivalent to saying that the operation is A=B*C but
67 * B or C are stored in standard column format.
68 */
69
70ODE_API void dMultiply0 (dReal *A, const dReal *B, const dReal *C, int p,int q,int r);
71ODE_API void dMultiply1 (dReal *A, const dReal *B, const dReal *C, int p,int q,int r);
72ODE_API void dMultiply2 (dReal *A, const dReal *B, const dReal *C, int p,int q,int r);
73
74
75/* do an in-place cholesky decomposition on the lower triangle of the n*n
76 * symmetric matrix A (which is stored by rows). the resulting lower triangle
77 * will be such that L*L'=A. return 1 on success and 0 on failure (on failure
78 * the matrix is not positive definite).
79 */
80
81ODE_API int dFactorCholesky (dReal *A, int n);
82
83
84/* solve for x: L*L'*x = b, and put the result back into x.
85 * L is size n*n, b is size n*1. only the lower triangle of L is considered.
86 */
87
88ODE_API void dSolveCholesky (const dReal *L, dReal *b, int n);
89
90
91/* compute the inverse of the n*n positive definite matrix A and put it in
92 * Ainv. this is not especially fast. this returns 1 on success (A was
93 * positive definite) or 0 on failure (not PD).
94 */
95
96ODE_API int dInvertPDMatrix (const dReal *A, dReal *Ainv, int n);
97
98
99/* check whether an n*n matrix A is positive definite, return 1/0 (yes/no).
100 * positive definite means that x'*A*x > 0 for any x. this performs a
101 * cholesky decomposition of A. if the decomposition fails then the matrix
102 * is not positive definite. A is stored by rows. A is not altered.
103 */
104
105ODE_API int dIsPositiveDefinite (const dReal *A, int n);
106
107
108/* factorize a matrix A into L*D*L', where L is lower triangular with ones on
109 * the diagonal, and D is diagonal.
110 * A is an n*n matrix stored by rows, with a leading dimension of n rounded
111 * up to 4. L is written into the strict lower triangle of A (the ones are not
112 * written) and the reciprocal of the diagonal elements of D are written into
113 * d.
114 */
115ODE_API void dFactorLDLT (dReal *A, dReal *d, int n, int nskip);
116
117
118/* solve L*x=b, where L is n*n lower triangular with ones on the diagonal,
119 * and x,b are n*1. b is overwritten with x.
120 * the leading dimension of L is `nskip'.
121 */
122ODE_API void dSolveL1 (const dReal *L, dReal *b, int n, int nskip);
123
124
125/* solve L'*x=b, where L is n*n lower triangular with ones on the diagonal,
126 * and x,b are n*1. b is overwritten with x.
127 * the leading dimension of L is `nskip'.
128 */
129ODE_API void dSolveL1T (const dReal *L, dReal *b, int n, int nskip);
130
131
132/* in matlab syntax: a(1:n) = a(1:n) .* d(1:n) */
133
134ODE_API void dVectorScale (dReal *a, const dReal *d, int n);
135
136
137/* given `L', a n*n lower triangular matrix with ones on the diagonal,
138 * and `d', a n*1 vector of the reciprocal diagonal elements of an n*n matrix
139 * D, solve L*D*L'*x=b where x,b are n*1. x overwrites b.
140 * the leading dimension of L is `nskip'.
141 */
142
143ODE_API void dSolveLDLT (const dReal *L, const dReal *d, dReal *b, int n, int nskip);
144
145
146/* given an L*D*L' factorization of an n*n matrix A, return the updated
147 * factorization L2*D2*L2' of A plus the following "top left" matrix:
148 *
149 * [ b a' ] <-- b is a[0]
150 * [ a 0 ] <-- a is a[1..n-1]
151 *
152 * - L has size n*n, its leading dimension is nskip. L is lower triangular
153 * with ones on the diagonal. only the lower triangle of L is referenced.
154 * - d has size n. d contains the reciprocal diagonal elements of D.
155 * - a has size n.
156 * the result is written into L, except that the left column of L and d[0]
157 * are not actually modified. see ldltaddTL.m for further comments.
158 */
159ODE_API void dLDLTAddTL (dReal *L, dReal *d, const dReal *a, int n, int nskip);
160
161
162/* given an L*D*L' factorization of a permuted matrix A, produce a new
163 * factorization for row and column `r' removed.
164 * - A has size n1*n1, its leading dimension in nskip. A is symmetric and
165 * positive definite. only the lower triangle of A is referenced.
166 * A itself may actually be an array of row pointers.
167 * - L has size n2*n2, its leading dimension in nskip. L is lower triangular
168 * with ones on the diagonal. only the lower triangle of L is referenced.
169 * - d has size n2. d contains the reciprocal diagonal elements of D.
170 * - p is a permutation vector. it contains n2 indexes into A. each index
171 * must be in the range 0..n1-1.
172 * - r is the row/column of L to remove.
173 * the new L will be written within the old L, i.e. will have the same leading
174 * dimension. the last row and column of L, and the last element of d, are
175 * undefined on exit.
176 *
177 * a fast O(n^2) algorithm is used. see ldltremove.m for further comments.
178 */
179ODE_API void dLDLTRemove (dReal **A, const int *p, dReal *L, dReal *d,
180 int n1, int n2, int r, int nskip);
181
182
183/* given an n*n matrix A (with leading dimension nskip), remove the r'th row
184 * and column by moving elements. the new matrix will have the same leading
185 * dimension. the last row and column of A are untouched on exit.
186 */
187ODE_API void dRemoveRowCol (dReal *A, int n, int nskip, int r);
188
189
190#ifdef __cplusplus
191}
192#endif
193
194#endif
diff --git a/libraries/ode-0.9/include/ode/memory.h b/libraries/ode-0.9/include/ode/memory.h
new file mode 100644
index 0000000..c1af051
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/memory.h
@@ -0,0 +1,59 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23/* this comes from the `reuse' library. copy any changes back to the source */
24
25#ifndef _ODE_MEMORY_H_
26#define _ODE_MEMORY_H_
27
28#include "ode/config.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* function types to allocate and free memory */
35typedef void * dAllocFunction (size_t size);
36typedef void * dReallocFunction (void *ptr, size_t oldsize, size_t newsize);
37typedef void dFreeFunction (void *ptr, size_t size);
38
39/* set new memory management functions. if fn is 0, the default handlers are
40 * used. */
41ODE_API void dSetAllocHandler (dAllocFunction *fn);
42ODE_API void dSetReallocHandler (dReallocFunction *fn);
43ODE_API void dSetFreeHandler (dFreeFunction *fn);
44
45/* get current memory management functions */
46ODE_API dAllocFunction *dGetAllocHandler (void);
47ODE_API dReallocFunction *dGetReallocHandler (void);
48ODE_API dFreeFunction *dGetFreeHandler (void);
49
50/* allocate and free memory. */
51ODE_API void * dAlloc (size_t size);
52ODE_API void * dRealloc (void *ptr, size_t oldsize, size_t newsize);
53ODE_API void dFree (void *ptr, size_t size);
54
55#ifdef __cplusplus
56}
57#endif
58
59#endif
diff --git a/libraries/ode-0.9/include/ode/misc.h b/libraries/ode-0.9/include/ode/misc.h
new file mode 100644
index 0000000..0c55fc5
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/misc.h
@@ -0,0 +1,85 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23/* miscellaneous math functions. these are mostly useful for testing */
24
25#ifndef _ODE_MISC_H_
26#define _ODE_MISC_H_
27
28#include <ode/common.h>
29
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35
36/* return 1 if the random number generator is working. */
37ODE_API int dTestRand(void);
38
39/* return next 32 bit random number. this uses a not-very-random linear
40 * congruential method.
41 */
42ODE_API unsigned long dRand(void);
43
44/* get and set the current random number seed. */
45ODE_API unsigned long dRandGetSeed(void);
46ODE_API void dRandSetSeed (unsigned long s);
47
48/* return a random integer between 0..n-1. the distribution will get worse
49 * as n approaches 2^32.
50 */
51ODE_API int dRandInt (int n);
52
53/* return a random real number between 0..1 */
54ODE_API dReal dRandReal(void);
55
56/* print out a matrix */
57#ifdef __cplusplus
58ODE_API void dPrintMatrix (const dReal *A, int n, int m, char *fmt = "%10.4f ",
59 FILE *f=stdout);
60#else
61ODE_API void dPrintMatrix (const dReal *A, int n, int m, char *fmt, FILE *f);
62#endif
63
64/* make a random vector with entries between +/- range. A has n elements. */
65ODE_API void dMakeRandomVector (dReal *A, int n, dReal range);
66
67/* make a random matrix with entries between +/- range. A has size n*m. */
68ODE_API void dMakeRandomMatrix (dReal *A, int n, int m, dReal range);
69
70/* clear the upper triangle of a square matrix */
71ODE_API void dClearUpperTriangle (dReal *A, int n);
72
73/* return the maximum element difference between the two n*m matrices */
74ODE_API dReal dMaxDifference (const dReal *A, const dReal *B, int n, int m);
75
76/* return the maximum element difference between the lower triangle of two
77 * n*n matrices */
78ODE_API dReal dMaxDifferenceLowerTriangle (const dReal *A, const dReal *B, int n);
79
80
81#ifdef __cplusplus
82}
83#endif
84
85#endif
diff --git a/libraries/ode-0.9/include/ode/objects.h b/libraries/ode-0.9/include/ode/objects.h
new file mode 100644
index 0000000..3e24036
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/objects.h
@@ -0,0 +1,1966 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_OBJECTS_H_
24#define _ODE_OBJECTS_H_
25
26#include <ode/common.h>
27#include <ode/mass.h>
28#include <ode/contact.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/**
35 * @defgroup world World
36 *
37 * The world object is a container for rigid bodies and joints. Objects in
38 * different worlds can not interact, for example rigid bodies from two
39 * different worlds can not collide.
40 *
41 * All the objects in a world exist at the same point in time, thus one
42 * reason to use separate worlds is to simulate systems at different rates.
43 * Most applications will only need one world.
44 */
45
46
47/**
48 * @brief Create a new, empty world and return its ID number.
49 * @return an identifier
50 * @ingroup world
51 */
52ODE_API dWorldID dWorldCreate(void);
53
54
55/**
56 * @brief Destroy a world and everything in it.
57 *
58 * This includes all bodies, and all joints that are not part of a joint
59 * group. Joints that are part of a joint group will be deactivated, and
60 * can be destroyed by calling, for example, dJointGroupEmpty().
61 * @ingroup world
62 * @param world the identifier for the world the be destroyed.
63 */
64ODE_API void dWorldDestroy (dWorldID world);
65
66
67/**
68 * @brief Set the world's global gravity vector.
69 *
70 * The units are m/s^2, so Earth's gravity vector would be (0,0,-9.81),
71 * assuming that +z is up. The default is no gravity, i.e. (0,0,0).
72 *
73 * @ingroup world
74 */
75ODE_API void dWorldSetGravity (dWorldID, dReal x, dReal y, dReal z);
76
77
78/**
79 * @brief Get the gravity vector for a given world.
80 * @ingroup world
81 */
82ODE_API void dWorldGetGravity (dWorldID, dVector3 gravity);
83
84
85/**
86 * @brief Set the global ERP value, that controls how much error
87 * correction is performed in each time step.
88 * @ingroup world
89 * @param dWorldID the identifier of the world.
90 * @param erp Typical values are in the range 0.1--0.8. The default is 0.2.
91 */
92ODE_API void dWorldSetERP (dWorldID, dReal erp);
93
94/**
95 * @brief Get the error reduction parameter.
96 * @ingroup world
97 * @return ERP value
98 */
99ODE_API dReal dWorldGetERP (dWorldID);
100
101
102/**
103 * @brief Set the global CFM (constraint force mixing) value.
104 * @ingroup world
105 * @param cfm Typical values are in the range @m{10^{-9}} -- 1.
106 * The default is 10^-5 if single precision is being used, or 10^-10
107 * if double precision is being used.
108 */
109ODE_API void dWorldSetCFM (dWorldID, dReal cfm);
110
111/**
112 * @brief Get the constraint force mixing value.
113 * @ingroup world
114 * @return CFM value
115 */
116ODE_API dReal dWorldGetCFM (dWorldID);
117
118
119/**
120 * @brief Step the world.
121 *
122 * This uses a "big matrix" method that takes time on the order of m^3
123 * and memory on the order of m^2, where m is the total number of constraint
124 * rows. For large systems this will use a lot of memory and can be very slow,
125 * but this is currently the most accurate method.
126 * @ingroup world
127 * @param stepsize The number of seconds that the simulation has to advance.
128 */
129ODE_API void dWorldStep (dWorldID, dReal stepsize);
130
131
132/**
133 * @brief Converts an impulse to a force.
134 * @ingroup world
135 * @remarks
136 * If you want to apply a linear or angular impulse to a rigid body,
137 * instead of a force or a torque, then you can use this function to convert
138 * the desired impulse into a force/torque vector before calling the
139 * BodyAdd... function.
140 * The current algorithm simply scales the impulse by 1/stepsize,
141 * where stepsize is the step size for the next step that will be taken.
142 * This function is given a dWorldID because, in the future, the force
143 * computation may depend on integrator parameters that are set as
144 * properties of the world.
145 */
146ODE_API void dWorldImpulseToForce
147(
148 dWorldID, dReal stepsize,
149 dReal ix, dReal iy, dReal iz, dVector3 force
150);
151
152
153/**
154 * @brief Step the world.
155 * @ingroup world
156 * @remarks
157 * This uses an iterative method that takes time on the order of m*N
158 * and memory on the order of m, where m is the total number of constraint
159 * rows N is the number of iterations.
160 * For large systems this is a lot faster than dWorldStep(),
161 * but it is less accurate.
162 * @remarks
163 * QuickStep is great for stacks of objects especially when the
164 * auto-disable feature is used as well.
165 * However, it has poor accuracy for near-singular systems.
166 * Near-singular systems can occur when using high-friction contacts, motors,
167 * or certain articulated structures. For example, a robot with multiple legs
168 * sitting on the ground may be near-singular.
169 * @remarks
170 * There are ways to help overcome QuickStep's inaccuracy problems:
171 * \li Increase CFM.
172 * \li Reduce the number of contacts in your system (e.g. use the minimum
173 * number of contacts for the feet of a robot or creature).
174 * \li Don't use excessive friction in the contacts.
175 * \li Use contact slip if appropriate
176 * \li Avoid kinematic loops (however, kinematic loops are inevitable in
177 * legged creatures).
178 * \li Don't use excessive motor strength.
179 * \liUse force-based motors instead of velocity-based motors.
180 *
181 * Increasing the number of QuickStep iterations may help a little bit, but
182 * it is not going to help much if your system is really near singular.
183 */
184ODE_API void dWorldQuickStep (dWorldID w, dReal stepsize);
185
186
187/**
188 * @brief Set the number of iterations that the QuickStep method performs per
189 * step.
190 * @ingroup world
191 * @remarks
192 * More iterations will give a more accurate solution, but will take
193 * longer to compute.
194 * @param num The default is 20 iterations.
195 */
196ODE_API void dWorldSetQuickStepNumIterations (dWorldID, int num);
197
198
199/**
200 * @brief Get the number of iterations that the QuickStep method performs per
201 * step.
202 * @ingroup world
203 * @return nr of iterations
204 */
205ODE_API int dWorldGetQuickStepNumIterations (dWorldID);
206
207/**
208 * @brief Set the SOR over-relaxation parameter
209 * @ingroup world
210 * @param over_relaxation value to use by SOR
211 */
212ODE_API void dWorldSetQuickStepW (dWorldID, dReal over_relaxation);
213
214/**
215 * @brief Get the SOR over-relaxation parameter
216 * @ingroup world
217 * @returns the over-relaxation setting
218 */
219ODE_API dReal dWorldGetQuickStepW (dWorldID);
220
221/* World contact parameter functions */
222
223/**
224 * @brief Set the maximum correcting velocity that contacts are allowed
225 * to generate.
226 * @ingroup world
227 * @param vel The default value is infinity (i.e. no limit).
228 * @remarks
229 * Reducing this value can help prevent "popping" of deeply embedded objects.
230 */
231ODE_API void dWorldSetContactMaxCorrectingVel (dWorldID, dReal vel);
232
233/**
234 * @brief Get the maximum correcting velocity that contacts are allowed
235 * to generated.
236 * @ingroup world
237 */
238ODE_API dReal dWorldGetContactMaxCorrectingVel (dWorldID);
239
240/**
241 * @brief Set the depth of the surface layer around all geometry objects.
242 * @ingroup world
243 * @remarks
244 * Contacts are allowed to sink into the surface layer up to the given
245 * depth before coming to rest.
246 * @param depth The default value is zero.
247 * @remarks
248 * Increasing this to some small value (e.g. 0.001) can help prevent
249 * jittering problems due to contacts being repeatedly made and broken.
250 */
251ODE_API void dWorldSetContactSurfaceLayer (dWorldID, dReal depth);
252
253/**
254 * @brief Get the depth of the surface layer around all geometry objects.
255 * @ingroup world
256 * @returns the depth
257 */
258ODE_API dReal dWorldGetContactSurfaceLayer (dWorldID);
259
260/* StepFast1 functions */
261
262/**
263 * @brief Step the world using the StepFast1 algorithm.
264 * @param stepsize the nr of seconds to advance the simulation.
265 * @param maxiterations The number of iterations to perform.
266 * @ingroup world
267 */
268ODE_API void dWorldStepFast1(dWorldID, dReal stepsize, int maxiterations);
269
270
271/**
272 * @defgroup disable Automatic Enabling and Disabling
273 *
274 * Every body can be enabled or disabled. Enabled bodies participate in the
275 * simulation, while disabled bodies are turned off and do not get updated
276 * during a simulation step. New bodies are always created in the enabled state.
277 *
278 * A disabled body that is connected through a joint to an enabled body will be
279 * automatically re-enabled at the next simulation step.
280 *
281 * Disabled bodies do not consume CPU time, therefore to speed up the simulation
282 * bodies should be disabled when they come to rest. This can be done automatically
283 * with the auto-disable feature.
284 *
285 * If a body has its auto-disable flag turned on, it will automatically disable
286 * itself when
287 * @li It has been idle for a given number of simulation steps.
288 * @li It has also been idle for a given amount of simulation time.
289 *
290 * A body is considered to be idle when the magnitudes of both its
291 * linear average velocity and angular average velocity are below given thresholds.
292 * The sample size for the average defaults to one and can be disabled by setting
293 * to zero with
294 *
295 * Thus, every body has six auto-disable parameters: an enabled flag, a idle step
296 * count, an idle time, linear/angular average velocity thresholds, and the
297 * average samples count.
298 *
299 * Newly created bodies get these parameters from world.
300 */
301
302/**
303 * @brief Set the AutoEnableDepth parameter used by the StepFast1 algorithm.
304 * @ingroup disable
305 */
306ODE_API void dWorldSetAutoEnableDepthSF1(dWorldID, int autoEnableDepth);
307
308/**
309 * @brief Get the AutoEnableDepth parameter used by the StepFast1 algorithm.
310 * @ingroup disable
311 */
312ODE_API int dWorldGetAutoEnableDepthSF1(dWorldID);
313
314/**
315 * @brief Get auto disable linear threshold for newly created bodies.
316 * @ingroup disable
317 * @return the threshold
318 */
319ODE_API dReal dWorldGetAutoDisableLinearThreshold (dWorldID);
320
321/**
322 * @brief Set auto disable linear threshold for newly created bodies.
323 * @param linear_threshold default is 0.01
324 * @ingroup disable
325 */
326ODE_API void dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold);
327
328/**
329 * @brief Get auto disable angular threshold for newly created bodies.
330 * @ingroup disable
331 * @return the threshold
332 */
333ODE_API dReal dWorldGetAutoDisableAngularThreshold (dWorldID);
334
335/**
336 * @brief Set auto disable angular threshold for newly created bodies.
337 * @param linear_threshold default is 0.01
338 * @ingroup disable
339 */
340ODE_API void dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold);
341
342/**
343 * @brief Get auto disable linear average threshold for newly created bodies.
344 * @ingroup disable
345 * @return the threshold
346 */
347ODE_API dReal dWorldGetAutoDisableLinearAverageThreshold (dWorldID);
348
349/**
350 * @brief Set auto disable linear average threshold for newly created bodies.
351 * @param linear_average_threshold default is 0.01
352 * @ingroup disable
353 */
354ODE_API void dWorldSetAutoDisableLinearAverageThreshold (dWorldID, dReal linear_average_threshold);
355
356/**
357 * @brief Get auto disable angular average threshold for newly created bodies.
358 * @ingroup disable
359 * @return the threshold
360 */
361ODE_API dReal dWorldGetAutoDisableAngularAverageThreshold (dWorldID);
362
363/**
364 * @brief Set auto disable angular average threshold for newly created bodies.
365 * @param linear_average_threshold default is 0.01
366 * @ingroup disable
367 */
368ODE_API void dWorldSetAutoDisableAngularAverageThreshold (dWorldID, dReal angular_average_threshold);
369
370/**
371 * @brief Get auto disable sample count for newly created bodies.
372 * @ingroup disable
373 * @return number of samples used
374 */
375ODE_API int dWorldGetAutoDisableAverageSamplesCount (dWorldID);
376
377/**
378 * @brief Set auto disable average sample count for newly created bodies.
379 * @ingroup disable
380 * @param average_samples_count Default is 1, meaning only instantaneous velocity is used.
381 * Set to zero to disable sampling and thus prevent any body from auto-disabling.
382 */
383ODE_API void dWorldSetAutoDisableAverageSamplesCount (dWorldID, unsigned int average_samples_count );
384
385/**
386 * @brief Get auto disable steps for newly created bodies.
387 * @ingroup disable
388 * @return nr of steps
389 */
390ODE_API int dWorldGetAutoDisableSteps (dWorldID);
391
392/**
393 * @brief Set auto disable steps for newly created bodies.
394 * @ingroup disable
395 * @param steps default is 10
396 */
397ODE_API void dWorldSetAutoDisableSteps (dWorldID, int steps);
398
399/**
400 * @brief Get auto disable time for newly created bodies.
401 * @ingroup disable
402 * @return nr of seconds
403 */
404ODE_API dReal dWorldGetAutoDisableTime (dWorldID);
405
406/**
407 * @brief Set auto disable time for newly created bodies.
408 * @ingroup disable
409 * @param time default is 0 seconds
410 */
411ODE_API void dWorldSetAutoDisableTime (dWorldID, dReal time);
412
413/**
414 * @brief Get auto disable flag for newly created bodies.
415 * @ingroup disable
416 * @return 0 or 1
417 */
418ODE_API int dWorldGetAutoDisableFlag (dWorldID);
419
420/**
421 * @brief Set auto disable flag for newly created bodies.
422 * @ingroup disable
423 * @param do_auto_disable default is false.
424 */
425ODE_API void dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable);
426
427
428
429/**
430 * @defgroup bodies Rigid Bodies
431 *
432 * A rigid body has various properties from the point of view of the
433 * simulation. Some properties change over time:
434 *
435 * @li Position vector (x,y,z) of the body's point of reference.
436 * Currently the point of reference must correspond to the body's center of mass.
437 * @li Linear velocity of the point of reference, a vector (vx,vy,vz).
438 * @li Orientation of a body, represented by a quaternion (qs,qx,qy,qz) or
439 * a 3x3 rotation matrix.
440 * @li Angular velocity vector (wx,wy,wz) which describes how the orientation
441 * changes over time.
442 *
443 * Other body properties are usually constant over time:
444 *
445 * @li Mass of the body.
446 * @li Position of the center of mass with respect to the point of reference.
447 * In the current implementation the center of mass and the point of
448 * reference must coincide.
449 * @li Inertia matrix. This is a 3x3 matrix that describes how the body's mass
450 * is distributed around the center of mass. Conceptually each body has an
451 * x-y-z coordinate frame embedded in it that moves and rotates with the body.
452 *
453 * The origin of this coordinate frame is the body's point of reference. Some values
454 * in ODE (vectors, matrices etc) are relative to the body coordinate frame, and others
455 * are relative to the global coordinate frame.
456 *
457 * Note that the shape of a rigid body is not a dynamical property (except insofar as
458 * it influences the various mass properties). It is only collision detection that cares
459 * about the detailed shape of the body.
460 */
461
462
463/**
464 * @brief Get auto disable linear average threshold.
465 * @ingroup bodies
466 * @return the threshold
467 */
468ODE_API dReal dBodyGetAutoDisableLinearThreshold (dBodyID);
469
470/**
471 * @brief Set auto disable linear average threshold.
472 * @ingroup bodies
473 * @return the threshold
474 */
475ODE_API void dBodySetAutoDisableLinearThreshold (dBodyID, dReal linear_average_threshold);
476
477/**
478 * @brief Get auto disable angular average threshold.
479 * @ingroup bodies
480 * @return the threshold
481 */
482ODE_API dReal dBodyGetAutoDisableAngularThreshold (dBodyID);
483
484/**
485 * @brief Set auto disable angular average threshold.
486 * @ingroup bodies
487 * @return the threshold
488 */
489ODE_API void dBodySetAutoDisableAngularThreshold (dBodyID, dReal angular_average_threshold);
490
491/**
492 * @brief Get auto disable average size (samples count).
493 * @ingroup bodies
494 * @return the nr of steps/size.
495 */
496ODE_API int dBodyGetAutoDisableAverageSamplesCount (dBodyID);
497
498/**
499 * @brief Set auto disable average buffer size (average steps).
500 * @ingroup bodies
501 * @param average_samples_count the nr of samples to review.
502 */
503ODE_API void dBodySetAutoDisableAverageSamplesCount (dBodyID, unsigned int average_samples_count);
504
505
506/**
507 * @brief Get auto steps a body must be thought of as idle to disable
508 * @ingroup bodies
509 * @return the nr of steps
510 */
511ODE_API int dBodyGetAutoDisableSteps (dBodyID);
512
513/**
514 * @brief Set auto disable steps.
515 * @ingroup bodies
516 * @param steps the nr of steps.
517 */
518ODE_API void dBodySetAutoDisableSteps (dBodyID, int steps);
519
520/**
521 * @brief Get auto disable time.
522 * @ingroup bodies
523 * @return nr of seconds
524 */
525ODE_API dReal dBodyGetAutoDisableTime (dBodyID);
526
527/**
528 * @brief Set auto disable time.
529 * @ingroup bodies
530 * @param time nr of seconds.
531 */
532ODE_API void dBodySetAutoDisableTime (dBodyID, dReal time);
533
534/**
535 * @brief Get auto disable flag.
536 * @ingroup bodies
537 * @return 0 or 1
538 */
539ODE_API int dBodyGetAutoDisableFlag (dBodyID);
540
541/**
542 * @brief Set auto disable flag.
543 * @ingroup bodies
544 * @param do_auto_disable 0 or 1
545 */
546ODE_API void dBodySetAutoDisableFlag (dBodyID, int do_auto_disable);
547
548/**
549 * @brief Set auto disable defaults.
550 * @remarks
551 * Set the values for the body to those set as default for the world.
552 * @ingroup bodies
553 */
554ODE_API void dBodySetAutoDisableDefaults (dBodyID);
555
556
557/**
558 * @brief Retrives the world attached to te given body.
559 * @remarks
560 *
561 * @ingroup bodies
562 */
563ODE_API dWorldID dBodyGetWorld (dBodyID);
564
565/**
566 * @brief Create a body in given world.
567 * @remarks
568 * Default mass parameters are at position (0,0,0).
569 * @ingroup bodies
570 */
571ODE_API dBodyID dBodyCreate (dWorldID);
572
573/**
574 * @brief Destroy a body.
575 * @remarks
576 * All joints that are attached to this body will be put into limbo:
577 * i.e. unattached and not affecting the simulation, but they will NOT be
578 * deleted.
579 * @ingroup bodies
580 */
581ODE_API void dBodyDestroy (dBodyID);
582
583/**
584 * @brief Set the body's user-data pointer.
585 * @ingroup bodies
586 * @param data arbitraty pointer
587 */
588ODE_API void dBodySetData (dBodyID, void *data);
589
590/**
591 * @brief Get the body's user-data pointer.
592 * @ingroup bodies
593 * @return a pointer to the user's data.
594 */
595ODE_API void *dBodyGetData (dBodyID);
596
597/**
598 * @brief Set position of a body.
599 * @remarks
600 * After setting, the outcome of the simulation is undefined
601 * if the new configuration is inconsistent with the joints/constraints
602 * that are present.
603 * @ingroup bodies
604 */
605ODE_API void dBodySetPosition (dBodyID, dReal x, dReal y, dReal z);
606
607/**
608 * @brief Set the orientation of a body.
609 * @ingroup bodies
610 * @remarks
611 * After setting, the outcome of the simulation is undefined
612 * if the new configuration is inconsistent with the joints/constraints
613 * that are present.
614 */
615ODE_API void dBodySetRotation (dBodyID, const dMatrix3 R);
616
617/**
618 * @brief Set the orientation of a body.
619 * @ingroup bodies
620 * @remarks
621 * After setting, the outcome of the simulation is undefined
622 * if the new configuration is inconsistent with the joints/constraints
623 * that are present.
624 */
625ODE_API void dBodySetQuaternion (dBodyID, const dQuaternion q);
626
627/**
628 * @brief Set the linear velocity of a body.
629 * @ingroup bodies
630 */
631ODE_API void dBodySetLinearVel (dBodyID, dReal x, dReal y, dReal z);
632
633/**
634 * @brief Set the angular velocity of a body.
635 * @ingroup bodies
636 */
637ODE_API void dBodySetAngularVel (dBodyID, dReal x, dReal y, dReal z);
638
639/**
640 * @brief Get the position of a body.
641 * @ingroup bodies
642 * @remarks
643 * When getting, the returned values are pointers to internal data structures,
644 * so the vectors are valid until any changes are made to the rigid body
645 * system structure.
646 * @sa dBodyCopyPosition
647 */
648ODE_API const dReal * dBodyGetPosition (dBodyID);
649
650
651/**
652 * @brief Copy the position of a body into a vector.
653 * @ingroup bodies
654 * @param body the body to query
655 * @param pos a copy of the body position
656 * @sa dBodyGetPosition
657 */
658ODE_API void dBodyCopyPosition (dBodyID body, dVector3 pos);
659
660
661/**
662 * @brief Get the rotation of a body.
663 * @ingroup bodies
664 * @return pointer to a 4x3 rotation matrix.
665 */
666ODE_API const dReal * dBodyGetRotation (dBodyID);
667
668
669/**
670 * @brief Copy the rotation of a body.
671 * @ingroup bodies
672 * @param body the body to query
673 * @param R a copy of the rotation matrix
674 * @sa dBodyGetRotation
675 */
676ODE_API void dBodyCopyRotation (dBodyID, dMatrix3 R);
677
678
679/**
680 * @brief Get the rotation of a body.
681 * @ingroup bodies
682 * @return pointer to 4 scalars that represent the quaternion.
683 */
684ODE_API const dReal * dBodyGetQuaternion (dBodyID);
685
686
687/**
688 * @brief Copy the orientation of a body into a quaternion.
689 * @ingroup bodies
690 * @param body the body to query
691 * @param quat a copy of the orientation quaternion
692 * @sa dBodyGetQuaternion
693 */
694ODE_API void dBodyCopyQuaternion(dBodyID body, dQuaternion quat);
695
696
697/**
698 * @brief Get the linear velocity of a body.
699 * @ingroup bodies
700 */
701ODE_API const dReal * dBodyGetLinearVel (dBodyID);
702
703/**
704 * @brief Get the angular velocity of a body.
705 * @ingroup bodies
706 */
707ODE_API const dReal * dBodyGetAngularVel (dBodyID);
708
709/**
710 * @brief Set the mass of a body.
711 * @ingroup bodies
712 */
713ODE_API void dBodySetMass (dBodyID, const dMass *mass);
714
715/**
716 * @brief Get the mass of a body.
717 * @ingroup bodies
718 */
719ODE_API void dBodyGetMass (dBodyID, dMass *mass);
720
721/**
722 * @brief Add force at centre of mass of body in absolute coordinates.
723 * @ingroup bodies
724 */
725ODE_API void dBodyAddForce (dBodyID, dReal fx, dReal fy, dReal fz);
726
727/**
728 * @brief Add torque at centre of mass of body in absolute coordinates.
729 * @ingroup bodies
730 */
731ODE_API void dBodyAddTorque (dBodyID, dReal fx, dReal fy, dReal fz);
732
733/**
734 * @brief Add force at centre of mass of body in coordinates relative to body.
735 * @ingroup bodies
736 */
737ODE_API void dBodyAddRelForce (dBodyID, dReal fx, dReal fy, dReal fz);
738
739/**
740 * @brief Add torque at centre of mass of body in coordinates relative to body.
741 * @ingroup bodies
742 */
743ODE_API void dBodyAddRelTorque (dBodyID, dReal fx, dReal fy, dReal fz);
744
745/**
746 * @brief Add force at specified point in body in global coordinates.
747 * @ingroup bodies
748 */
749ODE_API void dBodyAddForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
750 dReal px, dReal py, dReal pz);
751/**
752 * @brief Add force at specified point in body in local coordinates.
753 * @ingroup bodies
754 */
755ODE_API void dBodyAddForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
756 dReal px, dReal py, dReal pz);
757/**
758 * @brief Add force at specified point in body in global coordinates.
759 * @ingroup bodies
760 */
761ODE_API void dBodyAddRelForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
762 dReal px, dReal py, dReal pz);
763/**
764 * @brief Add force at specified point in body in local coordinates.
765 * @ingroup bodies
766 */
767ODE_API void dBodyAddRelForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
768 dReal px, dReal py, dReal pz);
769
770/**
771 * @brief Return the current accumulated force vector.
772 * @return points to an array of 3 reals.
773 * @remarks
774 * The returned values are pointers to internal data structures, so
775 * the vectors are only valid until any changes are made to the rigid
776 * body system.
777 * @ingroup bodies
778 */
779ODE_API const dReal * dBodyGetForce (dBodyID);
780
781/**
782 * @brief Return the current accumulated torque vector.
783 * @return points to an array of 3 reals.
784 * @remarks
785 * The returned values are pointers to internal data structures, so
786 * the vectors are only valid until any changes are made to the rigid
787 * body system.
788 * @ingroup bodies
789 */
790ODE_API const dReal * dBodyGetTorque (dBodyID);
791
792/**
793 * @brief Set the body force accumulation vector.
794 * @remarks
795 * This is mostly useful to zero the force and torque for deactivated bodies
796 * before they are reactivated, in the case where the force-adding functions
797 * were called on them while they were deactivated.
798 * @ingroup bodies
799 */
800ODE_API void dBodySetForce (dBodyID b, dReal x, dReal y, dReal z);
801
802/**
803 * @brief Set the body torque accumulation vector.
804 * @remarks
805 * This is mostly useful to zero the force and torque for deactivated bodies
806 * before they are reactivated, in the case where the force-adding functions
807 * were called on them while they were deactivated.
808 * @ingroup bodies
809 */
810ODE_API void dBodySetTorque (dBodyID b, dReal x, dReal y, dReal z);
811
812/**
813 * @brief Get world position of a relative point on body.
814 * @ingroup bodies
815 * @param result will contain the result.
816 */
817ODE_API void dBodyGetRelPointPos
818(
819 dBodyID, dReal px, dReal py, dReal pz,
820 dVector3 result
821);
822
823/**
824 * @brief Get velocity vector in global coords of a relative point on body.
825 * @ingroup bodies
826 * @param result will contain the result.
827 */
828ODE_API void dBodyGetRelPointVel
829(
830 dBodyID, dReal px, dReal py, dReal pz,
831 dVector3 result
832);
833
834/**
835 * @brief Get velocity vector in global coords of a globally
836 * specified point on a body.
837 * @ingroup bodies
838 * @param result will contain the result.
839 */
840ODE_API void dBodyGetPointVel
841(
842 dBodyID, dReal px, dReal py, dReal pz,
843 dVector3 result
844);
845
846/**
847 * @brief takes a point in global coordinates and returns
848 * the point's position in body-relative coordinates.
849 * @remarks
850 * This is the inverse of dBodyGetRelPointPos()
851 * @ingroup bodies
852 * @param result will contain the result.
853 */
854ODE_API void dBodyGetPosRelPoint
855(
856 dBodyID, dReal px, dReal py, dReal pz,
857 dVector3 result
858);
859
860/**
861 * @brief Convert from local to world coordinates.
862 * @ingroup bodies
863 * @param result will contain the result.
864 */
865ODE_API void dBodyVectorToWorld
866(
867 dBodyID, dReal px, dReal py, dReal pz,
868 dVector3 result
869);
870
871/**
872 * @brief Convert from world to local coordinates.
873 * @ingroup bodies
874 * @param result will contain the result.
875 */
876ODE_API void dBodyVectorFromWorld
877(
878 dBodyID, dReal px, dReal py, dReal pz,
879 dVector3 result
880);
881
882/**
883 * @brief controls the way a body's orientation is updated at each timestep.
884 * @ingroup bodies
885 * @param mode can be 0 or 1:
886 * \li 0: An ``infinitesimal'' orientation update is used.
887 * This is fast to compute, but it can occasionally cause inaccuracies
888 * for bodies that are rotating at high speed, especially when those
889 * bodies are joined to other bodies.
890 * This is the default for every new body that is created.
891 * \li 1: A ``finite'' orientation update is used.
892 * This is more costly to compute, but will be more accurate for high
893 * speed rotations.
894 * @remarks
895 * Note however that high speed rotations can result in many types of
896 * error in a simulation, and the finite mode will only fix one of those
897 * sources of error.
898 */
899ODE_API void dBodySetFiniteRotationMode (dBodyID, int mode);
900
901/**
902 * @brief sets the finite rotation axis for a body.
903 * @ingroup bodies
904 * @remarks
905 * This is axis only has meaning when the finite rotation mode is set
906 * If this axis is zero (0,0,0), full finite rotations are performed on
907 * the body.
908 * If this axis is nonzero, the body is rotated by performing a partial finite
909 * rotation along the axis direction followed by an infinitesimal rotation
910 * along an orthogonal direction.
911 * @remarks
912 * This can be useful to alleviate certain sources of error caused by quickly
913 * spinning bodies. For example, if a car wheel is rotating at high speed
914 * you can call this function with the wheel's hinge axis as the argument to
915 * try and improve its behavior.
916 */
917ODE_API void dBodySetFiniteRotationAxis (dBodyID, dReal x, dReal y, dReal z);
918
919/**
920 * @brief Get the way a body's orientation is updated each timestep.
921 * @ingroup bodies
922 * @return the mode 0 (infitesimal) or 1 (finite).
923 */
924ODE_API int dBodyGetFiniteRotationMode (dBodyID);
925
926/**
927 * @brief Get the finite rotation axis.
928 * @param result will contain the axis.
929 * @ingroup bodies
930 */
931ODE_API void dBodyGetFiniteRotationAxis (dBodyID, dVector3 result);
932
933/**
934 * @brief Get the number of joints that are attached to this body.
935 * @ingroup bodies
936 * @return nr of joints
937 */
938ODE_API int dBodyGetNumJoints (dBodyID b);
939
940/**
941 * @brief Return a joint attached to this body, given by index.
942 * @ingroup bodies
943 * @param index valid range is 0 to n-1 where n is the value returned by
944 * dBodyGetNumJoints().
945 */
946ODE_API dJointID dBodyGetJoint (dBodyID, int index);
947
948/**
949 * @brief Manually enable a body.
950 * @param dBodyID identification of body.
951 * @ingroup bodies
952 */
953ODE_API void dBodyEnable (dBodyID);
954
955/**
956 * @brief Manually disable a body.
957 * @ingroup bodies
958 * @remarks
959 * A disabled body that is connected through a joint to an enabled body will
960 * be automatically re-enabled at the next simulation step.
961 */
962ODE_API void dBodyDisable (dBodyID);
963
964/**
965 * @brief Check wether a body is enabled.
966 * @ingroup bodies
967 * @return 1 if a body is currently enabled or 0 if it is disabled.
968 */
969ODE_API int dBodyIsEnabled (dBodyID);
970
971/**
972 * @brief Set whether the body is influenced by the world's gravity or not.
973 * @ingroup bodies
974 * @param mode when nonzero gravity affects this body.
975 * @remarks
976 * Newly created bodies are always influenced by the world's gravity.
977 */
978ODE_API void dBodySetGravityMode (dBodyID b, int mode);
979
980/**
981 * @brief Get whether the body is influenced by the world's gravity or not.
982 * @ingroup bodies
983 * @return nonzero means gravity affects this body.
984 */
985ODE_API int dBodyGetGravityMode (dBodyID b);
986
987
988
989/**
990 * @defgroup joints Joints
991 *
992 * In real life a joint is something like a hinge, that is used to connect two
993 * objects.
994 * In ODE a joint is very similar: It is a relationship that is enforced between
995 * two bodies so that they can only have certain positions and orientations
996 * relative to each other.
997 * This relationship is called a constraint -- the words joint and
998 * constraint are often used interchangeably.
999 *
1000 * A joint has a set of parameters that can be set. These include:
1001 *
1002 *
1003 * \li dParamLoStop Low stop angle or position. Setting this to
1004 * -dInfinity (the default value) turns off the low stop.
1005 * For rotational joints, this stop must be greater than -pi to be
1006 * effective.
1007 * \li dParamHiStop High stop angle or position. Setting this to
1008 * dInfinity (the default value) turns off the high stop.
1009 * For rotational joints, this stop must be less than pi to be
1010 * effective.
1011 * If the high stop is less than the low stop then both stops will
1012 * be ineffective.
1013 * \li dParamVel Desired motor velocity (this will be an angular or
1014 * linear velocity).
1015 * \li dParamFMax The maximum force or torque that the motor will use to
1016 * achieve the desired velocity.
1017 * This must always be greater than or equal to zero.
1018 * Setting this to zero (the default value) turns off the motor.
1019 * \li dParamFudgeFactor The current joint stop/motor implementation has
1020 * a small problem:
1021 * when the joint is at one stop and the motor is set to move it away
1022 * from the stop, too much force may be applied for one time step,
1023 * causing a ``jumping'' motion.
1024 * This fudge factor is used to scale this excess force.
1025 * It should have a value between zero and one (the default value).
1026 * If the jumping motion is too visible in a joint, the value can be
1027 * reduced.
1028 * Making this value too small can prevent the motor from being able to
1029 * move the joint away from a stop.
1030 * \li dParamBounce The bouncyness of the stops.
1031 * This is a restitution parameter in the range 0..1.
1032 * 0 means the stops are not bouncy at all, 1 means maximum bouncyness.
1033 * \li dParamCFM The constraint force mixing (CFM) value used when not
1034 * at a stop.
1035 * \li dParamStopERP The error reduction parameter (ERP) used by the
1036 * stops.
1037 * \li dParamStopCFM The constraint force mixing (CFM) value used by the
1038 * stops. Together with the ERP value this can be used to get spongy or
1039 * soft stops.
1040 * Note that this is intended for unpowered joints, it does not really
1041 * work as expected when a powered joint reaches its limit.
1042 * \li dParamSuspensionERP Suspension error reduction parameter (ERP).
1043 * Currently this is only implemented on the hinge-2 joint.
1044 * \li dParamSuspensionCFM Suspension constraint force mixing (CFM) value.
1045 * Currently this is only implemented on the hinge-2 joint.
1046 *
1047 * If a particular parameter is not implemented by a given joint, setting it
1048 * will have no effect.
1049 * These parameter names can be optionally followed by a digit (2 or 3)
1050 * to indicate the second or third set of parameters, e.g. for the second axis
1051 * in a hinge-2 joint, or the third axis in an AMotor joint.
1052 */
1053
1054
1055/**
1056 * @brief Create a new joint of the ball type.
1057 * @ingroup joints
1058 * @remarks
1059 * The joint is initially in "limbo" (i.e. it has no effect on the simulation)
1060 * because it does not connect to any bodies.
1061 * @param dJointGroupID set to 0 to allocate the joint normally.
1062 * If it is nonzero the joint is allocated in the given joint group.
1063 */
1064ODE_API dJointID dJointCreateBall (dWorldID, dJointGroupID);
1065
1066/**
1067 * @brief Create a new joint of the hinge type.
1068 * @ingroup joints
1069 * @param dJointGroupID set to 0 to allocate the joint normally.
1070 * If it is nonzero the joint is allocated in the given joint group.
1071 */
1072ODE_API dJointID dJointCreateHinge (dWorldID, dJointGroupID);
1073
1074/**
1075 * @brief Create a new joint of the slider type.
1076 * @ingroup joints
1077 * @param dJointGroupID set to 0 to allocate the joint normally.
1078 * If it is nonzero the joint is allocated in the given joint group.
1079 */
1080ODE_API dJointID dJointCreateSlider (dWorldID, dJointGroupID);
1081
1082/**
1083 * @brief Create a new joint of the contact type.
1084 * @ingroup joints
1085 * @param dJointGroupID set to 0 to allocate the joint normally.
1086 * If it is nonzero the joint is allocated in the given joint group.
1087 */
1088ODE_API dJointID dJointCreateContact (dWorldID, dJointGroupID, const dContact *);
1089
1090/**
1091 * @brief Create a new joint of the hinge2 type.
1092 * @ingroup joints
1093 * @param dJointGroupID set to 0 to allocate the joint normally.
1094 * If it is nonzero the joint is allocated in the given joint group.
1095 */
1096ODE_API dJointID dJointCreateHinge2 (dWorldID, dJointGroupID);
1097
1098/**
1099 * @brief Create a new joint of the universal type.
1100 * @ingroup joints
1101 * @param dJointGroupID set to 0 to allocate the joint normally.
1102 * If it is nonzero the joint is allocated in the given joint group.
1103 */
1104ODE_API dJointID dJointCreateUniversal (dWorldID, dJointGroupID);
1105
1106/**
1107 * @brief Create a new joint of the PR (Prismatic and Rotoide) type.
1108 * @ingroup joints
1109 * @param dJointGroupID set to 0 to allocate the joint normally.
1110 * If it is nonzero the joint is allocated in the given joint group.
1111 */
1112ODE_API dJointID dJointCreatePR (dWorldID, dJointGroupID);
1113
1114/**
1115 * @brief Create a new joint of the fixed type.
1116 * @ingroup joints
1117 * @param dJointGroupID set to 0 to allocate the joint normally.
1118 * If it is nonzero the joint is allocated in the given joint group.
1119 */
1120ODE_API dJointID dJointCreateFixed (dWorldID, dJointGroupID);
1121
1122ODE_API dJointID dJointCreateNull (dWorldID, dJointGroupID);
1123
1124/**
1125 * @brief Create a new joint of the A-motor type.
1126 * @ingroup joints
1127 * @param dJointGroupID set to 0 to allocate the joint normally.
1128 * If it is nonzero the joint is allocated in the given joint group.
1129 */
1130ODE_API dJointID dJointCreateAMotor (dWorldID, dJointGroupID);
1131
1132/**
1133 * @brief Create a new joint of the L-motor type.
1134 * @ingroup joints
1135 * @param dJointGroupID set to 0 to allocate the joint normally.
1136 * If it is nonzero the joint is allocated in the given joint group.
1137 */
1138ODE_API dJointID dJointCreateLMotor (dWorldID, dJointGroupID);
1139
1140/**
1141 * @brief Create a new joint of the plane-2d type.
1142 * @ingroup joints
1143 * @param dJointGroupID set to 0 to allocate the joint normally.
1144 * If it is nonzero the joint is allocated in the given joint group.
1145 */
1146ODE_API dJointID dJointCreatePlane2D (dWorldID, dJointGroupID);
1147
1148/**
1149 * @brief Destroy a joint.
1150 * @ingroup joints
1151 *
1152 * disconnects it from its attached bodies and removing it from the world.
1153 * However, if the joint is a member of a group then this function has no
1154 * effect - to destroy that joint the group must be emptied or destroyed.
1155 */
1156ODE_API void dJointDestroy (dJointID);
1157
1158
1159/**
1160 * @brief Create a joint group
1161 * @ingroup joints
1162 * @param max_size deprecated. Set to 0.
1163 */
1164ODE_API dJointGroupID dJointGroupCreate (int max_size);
1165
1166/**
1167 * @brief Destroy a joint group.
1168 * @ingroup joints
1169 *
1170 * All joints in the joint group will be destroyed.
1171 */
1172ODE_API void dJointGroupDestroy (dJointGroupID);
1173
1174/**
1175 * @brief Empty a joint group.
1176 * @ingroup joints
1177 *
1178 * All joints in the joint group will be destroyed,
1179 * but the joint group itself will not be destroyed.
1180 */
1181ODE_API void dJointGroupEmpty (dJointGroupID);
1182
1183/**
1184 * @brief Attach the joint to some new bodies.
1185 * @ingroup joints
1186 *
1187 * If the joint is already attached, it will be detached from the old bodies
1188 * first.
1189 * To attach this joint to only one body, set body1 or body2 to zero - a zero
1190 * body refers to the static environment.
1191 * Setting both bodies to zero puts the joint into "limbo", i.e. it will
1192 * have no effect on the simulation.
1193 * @remarks
1194 * Some joints, like hinge-2 need to be attached to two bodies to work.
1195 */
1196ODE_API void dJointAttach (dJointID, dBodyID body1, dBodyID body2);
1197
1198/**
1199 * @brief Set the user-data pointer
1200 * @ingroup joints
1201 */
1202ODE_API void dJointSetData (dJointID, void *data);
1203
1204/**
1205 * @brief Get the user-data pointer
1206 * @ingroup joints
1207 */
1208ODE_API void *dJointGetData (dJointID);
1209
1210/**
1211 * @brief Get the type of the joint
1212 * @ingroup joints
1213 * @return the type, being one of these:
1214 * \li JointTypeBall
1215 * \li JointTypeHinge
1216 * \li JointTypeSlider
1217 * \li JointTypeContact
1218 * \li JointTypeUniversal
1219 * \li JointTypeHinge2
1220 * \li JointTypeFixed
1221 * \li JointTypeAMotor
1222 * \li JointTypeLMotor
1223 */
1224ODE_API int dJointGetType (dJointID);
1225
1226/**
1227 * @brief Return the bodies that this joint connects.
1228 * @ingroup joints
1229 * @param index return the first (0) or second (1) body.
1230 * @remarks
1231 * If one of these returned body IDs is zero, the joint connects the other body
1232 * to the static environment.
1233 * If both body IDs are zero, the joint is in ``limbo'' and has no effect on
1234 * the simulation.
1235 */
1236ODE_API dBodyID dJointGetBody (dJointID, int index);
1237
1238/**
1239 * @brief Sets the datastructure that is to receive the feedback.
1240 *
1241 * The feedback can be used by the user, so that it is known how
1242 * much force an individual joint exerts.
1243 * @ingroup joints
1244 */
1245ODE_API void dJointSetFeedback (dJointID, dJointFeedback *);
1246
1247/**
1248 * @brief Gets the datastructure that is to receive the feedback.
1249 * @ingroup joints
1250 */
1251ODE_API dJointFeedback *dJointGetFeedback (dJointID);
1252
1253/**
1254 * @brief Set the joint anchor point.
1255 * @ingroup joints
1256 *
1257 * The joint will try to keep this point on each body
1258 * together. The input is specified in world coordinates.
1259 */
1260ODE_API void dJointSetBallAnchor (dJointID, dReal x, dReal y, dReal z);
1261
1262/**
1263 * @brief Set the joint anchor point.
1264 * @ingroup joints
1265 */
1266ODE_API void dJointSetBallAnchor2 (dJointID, dReal x, dReal y, dReal z);
1267
1268/**
1269 * @brief Param setting for Ball joints
1270 * @ingroup joints
1271 */
1272ODE_API void dJointSetBallParam (dJointID, int parameter, dReal value);
1273
1274/**
1275 * @brief Set hinge anchor parameter.
1276 * @ingroup joints
1277 */
1278ODE_API void dJointSetHingeAnchor (dJointID, dReal x, dReal y, dReal z);
1279
1280ODE_API void dJointSetHingeAnchorDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
1281
1282/**
1283 * @brief Set hinge axis.
1284 * @ingroup joints
1285 */
1286ODE_API void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z);
1287
1288/**
1289 * @brief set joint parameter
1290 * @ingroup joints
1291 */
1292ODE_API void dJointSetHingeParam (dJointID, int parameter, dReal value);
1293
1294/**
1295 * @brief Applies the torque about the hinge axis.
1296 *
1297 * That is, it applies a torque with specified magnitude in the direction
1298 * of the hinge axis, to body 1, and with the same magnitude but in opposite
1299 * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
1300 * @ingroup joints
1301 */
1302ODE_API void dJointAddHingeTorque(dJointID joint, dReal torque);
1303
1304/**
1305 * @brief set the joint axis
1306 * @ingroup joints
1307 */
1308ODE_API void dJointSetSliderAxis (dJointID, dReal x, dReal y, dReal z);
1309
1310/**
1311 * @ingroup joints
1312 */
1313ODE_API void dJointSetSliderAxisDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
1314
1315/**
1316 * @brief set joint parameter
1317 * @ingroup joints
1318 */
1319ODE_API void dJointSetSliderParam (dJointID, int parameter, dReal value);
1320
1321/**
1322 * @brief Applies the given force in the slider's direction.
1323 *
1324 * That is, it applies a force with specified magnitude, in the direction of
1325 * slider's axis, to body1, and with the same magnitude but opposite
1326 * direction to body2. This function is just a wrapper for dBodyAddForce().
1327 * @ingroup joints
1328 */
1329ODE_API void dJointAddSliderForce(dJointID joint, dReal force);
1330
1331/**
1332 * @brief set anchor
1333 * @ingroup joints
1334 */
1335ODE_API void dJointSetHinge2Anchor (dJointID, dReal x, dReal y, dReal z);
1336
1337/**
1338 * @brief set axis
1339 * @ingroup joints
1340 */
1341ODE_API void dJointSetHinge2Axis1 (dJointID, dReal x, dReal y, dReal z);
1342
1343/**
1344 * @brief set axis
1345 * @ingroup joints
1346 */
1347ODE_API void dJointSetHinge2Axis2 (dJointID, dReal x, dReal y, dReal z);
1348
1349/**
1350 * @brief set joint parameter
1351 * @ingroup joints
1352 */
1353ODE_API void dJointSetHinge2Param (dJointID, int parameter, dReal value);
1354
1355/**
1356 * @brief Applies torque1 about the hinge2's axis 1, torque2 about the
1357 * hinge2's axis 2.
1358 * @remarks This function is just a wrapper for dBodyAddTorque().
1359 * @ingroup joints
1360 */
1361ODE_API void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2);
1362
1363/**
1364 * @brief set anchor
1365 * @ingroup joints
1366 */
1367ODE_API void dJointSetUniversalAnchor (dJointID, dReal x, dReal y, dReal z);
1368
1369/**
1370 * @brief set axis
1371 * @ingroup joints
1372 */
1373ODE_API void dJointSetUniversalAxis1 (dJointID, dReal x, dReal y, dReal z);
1374
1375/**
1376 * @brief set axis
1377 * @ingroup joints
1378 */
1379ODE_API void dJointSetUniversalAxis2 (dJointID, dReal x, dReal y, dReal z);
1380
1381/**
1382 * @brief set joint parameter
1383 * @ingroup joints
1384 */
1385ODE_API void dJointSetUniversalParam (dJointID, int parameter, dReal value);
1386
1387/**
1388 * @brief Applies torque1 about the universal's axis 1, torque2 about the
1389 * universal's axis 2.
1390 * @remarks This function is just a wrapper for dBodyAddTorque().
1391 * @ingroup joints
1392 */
1393ODE_API void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2);
1394
1395
1396/**
1397 * @brief set anchor
1398 * @ingroup joints
1399 */
1400ODE_API void dJointSetPRAnchor (dJointID, dReal x, dReal y, dReal z);
1401
1402/**
1403 * @brief set the axis for the prismatic articulation
1404 * @ingroup joints
1405 */
1406ODE_API void dJointSetPRAxis1 (dJointID, dReal x, dReal y, dReal z);
1407
1408/**
1409 * @brief set the axis for the rotoide articulation
1410 * @ingroup joints
1411 */
1412ODE_API void dJointSetPRAxis2 (dJointID, dReal x, dReal y, dReal z);
1413
1414/**
1415 * @brief set joint parameter
1416 * @ingroup joints
1417 *
1418 * @note parameterX where X equal 2 refer to parameter for the rotoide articulation
1419 */
1420ODE_API void dJointSetPRParam (dJointID, int parameter, dReal value);
1421
1422/**
1423 * @brief Applies the torque about the rotoide axis of the PR joint
1424 *
1425 * That is, it applies a torque with specified magnitude in the direction
1426 * of the rotoide axis, to body 1, and with the same magnitude but in opposite
1427 * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
1428 * @ingroup joints
1429 */
1430ODE_API void dJointAddPRTorque (dJointID j, dReal torque);
1431
1432
1433/**
1434 * @brief Call this on the fixed joint after it has been attached to
1435 * remember the current desired relative offset and desired relative
1436 * rotation between the bodies.
1437 * @ingroup joints
1438 */
1439ODE_API void dJointSetFixed (dJointID);
1440
1441/*
1442 * @brief Sets joint parameter
1443 *
1444 * @ingroup joints
1445 */
1446ODE_API void dJointSetFixedParam (dJointID, int parameter, dReal value);
1447
1448/**
1449 * @brief set the nr of axes
1450 * @param num 0..3
1451 * @ingroup joints
1452 */
1453ODE_API void dJointSetAMotorNumAxes (dJointID, int num);
1454
1455/**
1456 * @brief set axis
1457 * @ingroup joints
1458 */
1459ODE_API void dJointSetAMotorAxis (dJointID, int anum, int rel,
1460 dReal x, dReal y, dReal z);
1461
1462/**
1463 * @brief Tell the AMotor what the current angle is along axis anum.
1464 *
1465 * This function should only be called in dAMotorUser mode, because in this
1466 * mode the AMotor has no other way of knowing the joint angles.
1467 * The angle information is needed if stops have been set along the axis,
1468 * but it is not needed for axis motors.
1469 * @ingroup joints
1470 */
1471ODE_API void dJointSetAMotorAngle (dJointID, int anum, dReal angle);
1472
1473/**
1474 * @brief set joint parameter
1475 * @ingroup joints
1476 */
1477ODE_API void dJointSetAMotorParam (dJointID, int parameter, dReal value);
1478
1479/**
1480 * @brief set mode
1481 * @ingroup joints
1482 */
1483ODE_API void dJointSetAMotorMode (dJointID, int mode);
1484
1485/**
1486 * @brief Applies torque0 about the AMotor's axis 0, torque1 about the
1487 * AMotor's axis 1, and torque2 about the AMotor's axis 2.
1488 * @remarks
1489 * If the motor has fewer than three axes, the higher torques are ignored.
1490 * This function is just a wrapper for dBodyAddTorque().
1491 * @ingroup joints
1492 */
1493ODE_API void dJointAddAMotorTorques (dJointID, dReal torque1, dReal torque2, dReal torque3);
1494
1495/**
1496 * @brief Set the number of axes that will be controlled by the LMotor.
1497 * @param num can range from 0 (which effectively deactivates the joint) to 3.
1498 * @ingroup joints
1499 */
1500ODE_API void dJointSetLMotorNumAxes (dJointID, int num);
1501
1502/**
1503 * @brief Set the AMotor axes.
1504 * @param anum selects the axis to change (0,1 or 2).
1505 * @param rel Each axis can have one of three ``relative orientation'' modes
1506 * \li 0: The axis is anchored to the global frame.
1507 * \li 1: The axis is anchored to the first body.
1508 * \li 2: The axis is anchored to the second body.
1509 * @remarks The axis vector is always specified in global coordinates
1510 * regardless of the setting of rel.
1511 * @ingroup joints
1512 */
1513ODE_API void dJointSetLMotorAxis (dJointID, int anum, int rel, dReal x, dReal y, dReal z);
1514
1515/**
1516 * @brief set joint parameter
1517 * @ingroup joints
1518 */
1519ODE_API void dJointSetLMotorParam (dJointID, int parameter, dReal value);
1520
1521/**
1522 * @ingroup joints
1523 */
1524ODE_API void dJointSetPlane2DXParam (dJointID, int parameter, dReal value);
1525
1526/**
1527 * @ingroup joints
1528 */
1529
1530ODE_API void dJointSetPlane2DYParam (dJointID, int parameter, dReal value);
1531
1532/**
1533 * @ingroup joints
1534 */
1535ODE_API void dJointSetPlane2DAngleParam (dJointID, int parameter, dReal value);
1536
1537/**
1538 * @brief Get the joint anchor point, in world coordinates.
1539 *
1540 * This returns the point on body 1. If the joint is perfectly satisfied,
1541 * this will be the same as the point on body 2.
1542 */
1543ODE_API void dJointGetBallAnchor (dJointID, dVector3 result);
1544
1545/**
1546 * @brief Get the joint anchor point, in world coordinates.
1547 *
1548 * This returns the point on body 2. You can think of a ball and socket
1549 * joint as trying to keep the result of dJointGetBallAnchor() and
1550 * dJointGetBallAnchor2() the same. If the joint is perfectly satisfied,
1551 * this function will return the same value as dJointGetBallAnchor() to
1552 * within roundoff errors. dJointGetBallAnchor2() can be used, along with
1553 * dJointGetBallAnchor(), to see how far the joint has come apart.
1554 */
1555ODE_API void dJointGetBallAnchor2 (dJointID, dVector3 result);
1556
1557/**
1558 * @brief get joint parameter
1559 * @ingroup joints
1560 */
1561ODE_API dReal dJointGetBallParam (dJointID, int parameter);
1562
1563/**
1564 * @brief Get the hinge anchor point, in world coordinates.
1565 *
1566 * This returns the point on body 1. If the joint is perfectly satisfied,
1567 * this will be the same as the point on body 2.
1568 * @ingroup joints
1569 */
1570ODE_API void dJointGetHingeAnchor (dJointID, dVector3 result);
1571
1572/**
1573 * @brief Get the joint anchor point, in world coordinates.
1574 * @return The point on body 2. If the joint is perfectly satisfied,
1575 * this will return the same value as dJointGetHingeAnchor().
1576 * If not, this value will be slightly different.
1577 * This can be used, for example, to see how far the joint has come apart.
1578 * @ingroup joints
1579 */
1580ODE_API void dJointGetHingeAnchor2 (dJointID, dVector3 result);
1581
1582/**
1583 * @brief get axis
1584 * @ingroup joints
1585 */
1586ODE_API void dJointGetHingeAxis (dJointID, dVector3 result);
1587
1588/**
1589 * @brief get joint parameter
1590 * @ingroup joints
1591 */
1592ODE_API dReal dJointGetHingeParam (dJointID, int parameter);
1593
1594/**
1595 * @brief Get the hinge angle.
1596 *
1597 * The angle is measured between the two bodies, or between the body and
1598 * the static environment.
1599 * The angle will be between -pi..pi.
1600 * When the hinge anchor or axis is set, the current position of the attached
1601 * bodies is examined and that position will be the zero angle.
1602 * @ingroup joints
1603 */
1604ODE_API dReal dJointGetHingeAngle (dJointID);
1605
1606/**
1607 * @brief Get the hinge angle time derivative.
1608 * @ingroup joints
1609 */
1610ODE_API dReal dJointGetHingeAngleRate (dJointID);
1611
1612/**
1613 * @brief Get the slider linear position (i.e. the slider's extension)
1614 *
1615 * When the axis is set, the current position of the attached bodies is
1616 * examined and that position will be the zero position.
1617 * @ingroup joints
1618 */
1619ODE_API dReal dJointGetSliderPosition (dJointID);
1620
1621/**
1622 * @brief Get the slider linear position's time derivative.
1623 * @ingroup joints
1624 */
1625ODE_API dReal dJointGetSliderPositionRate (dJointID);
1626
1627/**
1628 * @brief Get the slider axis
1629 * @ingroup joints
1630 */
1631ODE_API void dJointGetSliderAxis (dJointID, dVector3 result);
1632
1633/**
1634 * @brief get joint parameter
1635 * @ingroup joints
1636 */
1637ODE_API dReal dJointGetSliderParam (dJointID, int parameter);
1638
1639/**
1640 * @brief Get the joint anchor point, in world coordinates.
1641 * @return the point on body 1. If the joint is perfectly satisfied,
1642 * this will be the same as the point on body 2.
1643 * @ingroup joints
1644 */
1645ODE_API void dJointGetHinge2Anchor (dJointID, dVector3 result);
1646
1647/**
1648 * @brief Get the joint anchor point, in world coordinates.
1649 * This returns the point on body 2. If the joint is perfectly satisfied,
1650 * this will return the same value as dJointGetHinge2Anchor.
1651 * If not, this value will be slightly different.
1652 * This can be used, for example, to see how far the joint has come apart.
1653 * @ingroup joints
1654 */
1655ODE_API void dJointGetHinge2Anchor2 (dJointID, dVector3 result);
1656
1657/**
1658 * @brief Get joint axis
1659 * @ingroup joints
1660 */
1661ODE_API void dJointGetHinge2Axis1 (dJointID, dVector3 result);
1662
1663/**
1664 * @brief Get joint axis
1665 * @ingroup joints
1666 */
1667ODE_API void dJointGetHinge2Axis2 (dJointID, dVector3 result);
1668
1669/**
1670 * @brief get joint parameter
1671 * @ingroup joints
1672 */
1673ODE_API dReal dJointGetHinge2Param (dJointID, int parameter);
1674
1675/**
1676 * @brief Get angle
1677 * @ingroup joints
1678 */
1679ODE_API dReal dJointGetHinge2Angle1 (dJointID);
1680
1681/**
1682 * @brief Get time derivative of angle
1683 * @ingroup joints
1684 */
1685ODE_API dReal dJointGetHinge2Angle1Rate (dJointID);
1686
1687/**
1688 * @brief Get time derivative of angle
1689 * @ingroup joints
1690 */
1691ODE_API dReal dJointGetHinge2Angle2Rate (dJointID);
1692
1693/**
1694 * @brief Get the joint anchor point, in world coordinates.
1695 * @return the point on body 1. If the joint is perfectly satisfied,
1696 * this will be the same as the point on body 2.
1697 * @ingroup joints
1698 */
1699ODE_API void dJointGetUniversalAnchor (dJointID, dVector3 result);
1700
1701/**
1702 * @brief Get the joint anchor point, in world coordinates.
1703 * @return This returns the point on body 2.
1704 * @remarks
1705 * You can think of the ball and socket part of a universal joint as
1706 * trying to keep the result of dJointGetBallAnchor() and
1707 * dJointGetBallAnchor2() the same. If the joint is
1708 * perfectly satisfied, this function will return the same value
1709 * as dJointGetUniversalAnchor() to within roundoff errors.
1710 * dJointGetUniversalAnchor2() can be used, along with
1711 * dJointGetUniversalAnchor(), to see how far the joint has come apart.
1712 * @ingroup joints
1713 */
1714ODE_API void dJointGetUniversalAnchor2 (dJointID, dVector3 result);
1715
1716/**
1717 * @brief Get axis
1718 * @ingroup joints
1719 */
1720ODE_API void dJointGetUniversalAxis1 (dJointID, dVector3 result);
1721
1722/**
1723 * @brief Get axis
1724 * @ingroup joints
1725 */
1726ODE_API void dJointGetUniversalAxis2 (dJointID, dVector3 result);
1727
1728
1729/**
1730 * @brief get joint parameter
1731 * @ingroup joints
1732 */
1733ODE_API dReal dJointGetUniversalParam (dJointID, int parameter);
1734
1735/**
1736 * @brief Get both angles at the same time.
1737 * @ingroup joints
1738 *
1739 * @param joint The universal joint for which we want to calculate the angles
1740 * @param angle1 The angle between the body1 and the axis 1
1741 * @param angle2 The angle between the body2 and the axis 2
1742 *
1743 * @note This function combine getUniversalAngle1 and getUniversalAngle2 together
1744 * and try to avoid redundant calculation
1745 */
1746ODE_API void dJointGetUniversalAngles (dJointID, dReal *angle1, dReal *angle2);
1747
1748/**
1749 * @brief Get angle
1750 * @ingroup joints
1751 */
1752ODE_API dReal dJointGetUniversalAngle1 (dJointID);
1753
1754/**
1755 * @brief Get angle
1756 * @ingroup joints
1757 */
1758ODE_API dReal dJointGetUniversalAngle2 (dJointID);
1759
1760/**
1761 * @brief Get time derivative of angle
1762 * @ingroup joints
1763 */
1764ODE_API dReal dJointGetUniversalAngle1Rate (dJointID);
1765
1766/**
1767 * @brief Get time derivative of angle
1768 * @ingroup joints
1769 */
1770ODE_API dReal dJointGetUniversalAngle2Rate (dJointID);
1771
1772
1773
1774/**
1775 * @brief Get the joint anchor point, in world coordinates.
1776 * @return the point on body 1. If the joint is perfectly satisfied,
1777 * this will be the same as the point on body 2.
1778 * @ingroup joints
1779 */
1780ODE_API void dJointGetPRAnchor (dJointID, dVector3 result);
1781
1782/**
1783 * @brief Get the PR linear position (i.e. the prismatic's extension)
1784 *
1785 * When the axis is set, the current position of the attached bodies is
1786 * examined and that position will be the zero position.
1787 *
1788 * The position is the "oriented" length between the
1789 * position = (Prismatic axis) dot_product [(body1 + offset) - (body2 + anchor2)]
1790 *
1791 * @ingroup joints
1792 */
1793ODE_API dReal dJointGetPRPosition (dJointID);
1794
1795/**
1796 * @brief Get the PR linear position's time derivative
1797 *
1798 * @ingroup joints
1799 */
1800ODE_API dReal dJointGetPRPositionRate (dJointID);
1801
1802
1803/**
1804 * @brief Get the prismatic axis
1805 * @ingroup joints
1806 */
1807ODE_API void dJointGetPRAxis1 (dJointID, dVector3 result);
1808
1809/**
1810 * @brief Get the Rotoide axis
1811 * @ingroup joints
1812 */
1813ODE_API void dJointGetPRAxis2 (dJointID, dVector3 result);
1814
1815/**
1816 * @brief get joint parameter
1817 * @ingroup joints
1818 */
1819ODE_API dReal dJointGetPRParam (dJointID, int parameter);
1820
1821
1822
1823/**
1824 * @brief Get the number of angular axes that will be controlled by the
1825 * AMotor.
1826 * @param num can range from 0 (which effectively deactivates the
1827 * joint) to 3.
1828 * This is automatically set to 3 in dAMotorEuler mode.
1829 * @ingroup joints
1830 */
1831ODE_API int dJointGetAMotorNumAxes (dJointID);
1832
1833/**
1834 * @brief Get the AMotor axes.
1835 * @param anum selects the axis to change (0,1 or 2).
1836 * @param rel Each axis can have one of three ``relative orientation'' modes.
1837 * \li 0: The axis is anchored to the global frame.
1838 * \li 1: The axis is anchored to the first body.
1839 * \li 2: The axis is anchored to the second body.
1840 * @ingroup joints
1841 */
1842ODE_API void dJointGetAMotorAxis (dJointID, int anum, dVector3 result);
1843
1844/**
1845 * @brief Get axis
1846 * @remarks
1847 * The axis vector is always specified in global coordinates regardless
1848 * of the setting of rel.
1849 * There are two GetAMotorAxis functions, one to return the axis and one to
1850 * return the relative mode.
1851 *
1852 * For dAMotorEuler mode:
1853 * \li Only axes 0 and 2 need to be set. Axis 1 will be determined
1854 automatically at each time step.
1855 * \li Axes 0 and 2 must be perpendicular to each other.
1856 * \li Axis 0 must be anchored to the first body, axis 2 must be anchored
1857 to the second body.
1858 * @ingroup joints
1859 */
1860ODE_API int dJointGetAMotorAxisRel (dJointID, int anum);
1861
1862/**
1863 * @brief Get the current angle for axis.
1864 * @remarks
1865 * In dAMotorUser mode this is simply the value that was set with
1866 * dJointSetAMotorAngle().
1867 * In dAMotorEuler mode this is the corresponding euler angle.
1868 * @ingroup joints
1869 */
1870ODE_API dReal dJointGetAMotorAngle (dJointID, int anum);
1871
1872/**
1873 * @brief Get the current angle rate for axis anum.
1874 * @remarks
1875 * In dAMotorUser mode this is always zero, as not enough information is
1876 * available.
1877 * In dAMotorEuler mode this is the corresponding euler angle rate.
1878 * @ingroup joints
1879 */
1880ODE_API dReal dJointGetAMotorAngleRate (dJointID, int anum);
1881
1882/**
1883 * @brief get joint parameter
1884 * @ingroup joints
1885 */
1886ODE_API dReal dJointGetAMotorParam (dJointID, int parameter);
1887
1888/**
1889 * @brief Get the angular motor mode.
1890 * @param mode must be one of the following constants:
1891 * \li dAMotorUser The AMotor axes and joint angle settings are entirely
1892 * controlled by the user. This is the default mode.
1893 * \li dAMotorEuler Euler angles are automatically computed.
1894 * The axis a1 is also automatically computed.
1895 * The AMotor axes must be set correctly when in this mode,
1896 * as described below.
1897 * When this mode is initially set the current relative orientations
1898 * of the bodies will correspond to all euler angles at zero.
1899 * @ingroup joints
1900 */
1901ODE_API int dJointGetAMotorMode (dJointID);
1902
1903/**
1904 * @brief Get nr of axes.
1905 * @ingroup joints
1906 */
1907ODE_API int dJointGetLMotorNumAxes (dJointID);
1908
1909/**
1910 * @brief Get axis.
1911 * @ingroup joints
1912 */
1913ODE_API void dJointGetLMotorAxis (dJointID, int anum, dVector3 result);
1914
1915/**
1916 * @brief get joint parameter
1917 * @ingroup joints
1918 */
1919ODE_API dReal dJointGetLMotorParam (dJointID, int parameter);
1920
1921/**
1922 * @brief get joint parameter
1923 * @ingroup joints
1924 */
1925ODE_API dReal dJointGetFixedParam (dJointID, int parameter);
1926
1927
1928/**
1929 * @ingroup joints
1930 */
1931ODE_API dJointID dConnectingJoint (dBodyID, dBodyID);
1932
1933/**
1934 * @ingroup joints
1935 */
1936ODE_API int dConnectingJointList (dBodyID, dBodyID, dJointID*);
1937
1938/**
1939 * @brief Utility function
1940 * @return 1 if the two bodies are connected together by
1941 * a joint, otherwise return 0.
1942 * @ingroup joints
1943 */
1944ODE_API int dAreConnected (dBodyID, dBodyID);
1945
1946/**
1947 * @brief Utility function
1948 * @return 1 if the two bodies are connected together by
1949 * a joint that does not have type @arg{joint_type}, otherwise return 0.
1950 * @param body1 A body to check.
1951 * @param body2 A body to check.
1952 * @param joint_type is a dJointTypeXXX constant.
1953 * This is useful for deciding whether to add contact joints between two bodies:
1954 * if they are already connected by non-contact joints then it may not be
1955 * appropriate to add contacts, however it is okay to add more contact between-
1956 * bodies that already have contacts.
1957 * @ingroup joints
1958 */
1959ODE_API int dAreConnectedExcluding (dBodyID body1, dBodyID body2, int joint_type);
1960
1961
1962#ifdef __cplusplus
1963}
1964#endif
1965
1966#endif
diff --git a/libraries/ode-0.9/include/ode/ode.h b/libraries/ode-0.9/include/ode/ode.h
new file mode 100644
index 0000000..00cd500
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/ode.h
@@ -0,0 +1,47 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_ODE_H_
24#define _ODE_ODE_H_
25
26/* include *everything* here */
27
28#include <ode/config.h>
29#include <ode/compatibility.h>
30#include <ode/common.h>
31#include <ode/contact.h>
32#include <ode/error.h>
33#include <ode/memory.h>
34#include <ode/odemath.h>
35#include <ode/matrix.h>
36#include <ode/timer.h>
37#include <ode/rotation.h>
38#include <ode/mass.h>
39#include <ode/misc.h>
40#include <ode/objects.h>
41#include <ode/odecpp.h>
42#include <ode/collision_space.h>
43#include <ode/collision.h>
44#include <ode/odecpp_collision.h>
45#include <ode/export-dif.h>
46
47#endif
diff --git a/libraries/ode-0.9/include/ode/odecpp.h b/libraries/ode-0.9/include/ode/odecpp.h
new file mode 100644
index 0000000..62161fd
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/odecpp.h
@@ -0,0 +1,712 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23/* C++ interface for non-collision stuff */
24
25
26#ifndef _ODE_ODECPP_H_
27#define _ODE_ODECPP_H_
28#ifdef __cplusplus
29
30#include <ode/error.h>
31
32
33class dWorld {
34 dWorldID _id;
35
36 // intentionally undefined, don't use these
37 dWorld (const dWorld &);
38 void operator= (const dWorld &);
39
40public:
41 dWorld()
42 { _id = dWorldCreate(); }
43 ~dWorld()
44 { dWorldDestroy (_id); }
45
46 dWorldID id() const
47 { return _id; }
48 operator dWorldID() const
49 { return _id; }
50
51 void setGravity (dReal x, dReal y, dReal z)
52 { dWorldSetGravity (_id,x,y,z); }
53 void getGravity (dVector3 g) const
54 { dWorldGetGravity (_id,g); }
55
56 void setERP (dReal erp)
57 { dWorldSetERP(_id, erp); }
58 dReal getERP() const
59 { return dWorldGetERP(_id); }
60
61 void setCFM (dReal cfm)
62 { dWorldSetCFM(_id, cfm); }
63 dReal getCFM() const
64 { return dWorldGetCFM(_id); }
65
66 void step (dReal stepsize)
67 { dWorldStep (_id,stepsize); }
68
69 void stepFast1 (dReal stepsize, int maxiterations)
70 { dWorldStepFast1 (_id,stepsize,maxiterations); }
71 void setAutoEnableDepthSF1(dWorldID, int depth)
72 { dWorldSetAutoEnableDepthSF1 (_id, depth); }
73 int getAutoEnableDepthSF1(dWorldID)
74 { return dWorldGetAutoEnableDepthSF1 (_id); }
75
76 void setAutoDisableLinearThreshold (dReal threshold)
77 { dWorldSetAutoDisableLinearThreshold (_id,threshold); }
78 dReal getAutoDisableLinearThreshold()
79 { return dWorldGetAutoDisableLinearThreshold (_id); }
80 void setAutoDisableAngularThreshold (dReal threshold)
81 { dWorldSetAutoDisableAngularThreshold (_id,threshold); }
82 dReal getAutoDisableAngularThreshold()
83 { return dWorldGetAutoDisableAngularThreshold (_id); }
84 void setAutoDisableSteps (int steps)
85 { dWorldSetAutoDisableSteps (_id,steps); }
86 int getAutoDisableSteps()
87 { return dWorldGetAutoDisableSteps (_id); }
88 void setAutoDisableTime (dReal time)
89 { dWorldSetAutoDisableTime (_id,time); }
90 dReal getAutoDisableTime()
91 { return dWorldGetAutoDisableTime (_id); }
92 void setAutoDisableFlag (int do_auto_disable)
93 { dWorldSetAutoDisableFlag (_id,do_auto_disable); }
94 int getAutoDisableFlag()
95 { return dWorldGetAutoDisableFlag (_id); }
96
97 void impulseToForce (dReal stepsize, dReal ix, dReal iy, dReal iz,
98 dVector3 force)
99 { dWorldImpulseToForce (_id,stepsize,ix,iy,iz,force); }
100};
101
102
103class dBody {
104 dBodyID _id;
105
106 // intentionally undefined, don't use these
107 dBody (const dBody &);
108 void operator= (const dBody &);
109
110public:
111 dBody()
112 { _id = 0; }
113 dBody (dWorldID world)
114 { _id = dBodyCreate (world); }
115 ~dBody()
116 { if (_id) dBodyDestroy (_id); }
117
118 void create (dWorldID world) {
119 if (_id) dBodyDestroy (_id);
120 _id = dBodyCreate (world);
121 }
122
123 dBodyID id() const
124 { return _id; }
125 operator dBodyID() const
126 { return _id; }
127
128 void setData (void *data)
129 { dBodySetData (_id,data); }
130 void *getData() const
131 { return dBodyGetData (_id); }
132
133 void setPosition (dReal x, dReal y, dReal z)
134 { dBodySetPosition (_id,x,y,z); }
135 void setRotation (const dMatrix3 R)
136 { dBodySetRotation (_id,R); }
137 void setQuaternion (const dQuaternion q)
138 { dBodySetQuaternion (_id,q); }
139 void setLinearVel (dReal x, dReal y, dReal z)
140 { dBodySetLinearVel (_id,x,y,z); }
141 void setAngularVel (dReal x, dReal y, dReal z)
142 { dBodySetAngularVel (_id,x,y,z); }
143
144 const dReal * getPosition() const
145 { return dBodyGetPosition (_id); }
146 const dReal * getRotation() const
147 { return dBodyGetRotation (_id); }
148 const dReal * getQuaternion() const
149 { return dBodyGetQuaternion (_id); }
150 const dReal * getLinearVel() const
151 { return dBodyGetLinearVel (_id); }
152 const dReal * getAngularVel() const
153 { return dBodyGetAngularVel (_id); }
154
155 void setMass (const dMass *mass)
156 { dBodySetMass (_id,mass); }
157 void getMass (dMass *mass) const
158 { dBodyGetMass (_id,mass); }
159
160 void addForce (dReal fx, dReal fy, dReal fz)
161 { dBodyAddForce (_id, fx, fy, fz); }
162 void addTorque (dReal fx, dReal fy, dReal fz)
163 { dBodyAddTorque (_id, fx, fy, fz); }
164 void addRelForce (dReal fx, dReal fy, dReal fz)
165 { dBodyAddRelForce (_id, fx, fy, fz); }
166 void addRelTorque (dReal fx, dReal fy, dReal fz)
167 { dBodyAddRelTorque (_id, fx, fy, fz); }
168 void addForceAtPos (dReal fx, dReal fy, dReal fz,
169 dReal px, dReal py, dReal pz)
170 { dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
171 void addForceAtRelPos (dReal fx, dReal fy, dReal fz,
172 dReal px, dReal py, dReal pz)
173 { dBodyAddForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
174 void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
175 dReal px, dReal py, dReal pz)
176 { dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
177 void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
178 dReal px, dReal py, dReal pz)
179 { dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
180
181 const dReal * getForce() const
182 { return dBodyGetForce(_id); }
183 const dReal * getTorque() const
184 { return dBodyGetTorque(_id); }
185 void setForce (dReal x, dReal y, dReal z)
186 { dBodySetForce (_id,x,y,z); }
187 void setTorque (dReal x, dReal y, dReal z)
188 { dBodySetTorque (_id,x,y,z); }
189
190 void enable()
191 { dBodyEnable (_id); }
192 void disable()
193 { dBodyDisable (_id); }
194 int isEnabled() const
195 { return dBodyIsEnabled (_id); }
196
197 void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const
198 { dBodyGetRelPointPos (_id, px, py, pz, result); }
199 void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
200 { dBodyGetRelPointVel (_id, px, py, pz, result); }
201 void getPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
202 { dBodyGetPointVel (_id,px,py,pz,result); }
203 void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result) const
204 { dBodyGetPosRelPoint (_id,px,py,pz,result); }
205 void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result) const
206 { dBodyVectorToWorld (_id,px,py,pz,result); }
207 void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result) const
208 { dBodyVectorFromWorld (_id,px,py,pz,result); }
209
210 void setFiniteRotationMode (int mode)
211 { dBodySetFiniteRotationMode (_id, mode); }
212 void setFiniteRotationAxis (dReal x, dReal y, dReal z)
213 { dBodySetFiniteRotationAxis (_id, x, y, z); }
214
215 int getFiniteRotationMode() const
216 { return dBodyGetFiniteRotationMode (_id); }
217 void getFiniteRotationAxis (dVector3 result) const
218 { dBodyGetFiniteRotationAxis (_id, result); }
219
220 int getNumJoints() const
221 { return dBodyGetNumJoints (_id); }
222 dJointID getJoint (int index) const
223 { return dBodyGetJoint (_id, index); }
224
225 void setGravityMode (int mode)
226 { dBodySetGravityMode (_id,mode); }
227 int getGravityMode() const
228 { return dBodyGetGravityMode (_id); }
229
230 int isConnectedTo (dBodyID body) const
231 { return dAreConnected (_id, body); }
232
233 void setAutoDisableLinearThreshold (dReal threshold)
234 { dBodySetAutoDisableLinearThreshold (_id,threshold); }
235 dReal getAutoDisableLinearThreshold()
236 { return dBodyGetAutoDisableLinearThreshold (_id); }
237 void setAutoDisableAngularThreshold (dReal threshold)
238 { dBodySetAutoDisableAngularThreshold (_id,threshold); }
239 dReal getAutoDisableAngularThreshold()
240 { return dBodyGetAutoDisableAngularThreshold (_id); }
241 void setAutoDisableSteps (int steps)
242 { dBodySetAutoDisableSteps (_id,steps); }
243 int getAutoDisableSteps()
244 { return dBodyGetAutoDisableSteps (_id); }
245 void setAutoDisableTime (dReal time)
246 { dBodySetAutoDisableTime (_id,time); }
247 dReal getAutoDisableTime()
248 { return dBodyGetAutoDisableTime (_id); }
249 void setAutoDisableFlag (int do_auto_disable)
250 { dBodySetAutoDisableFlag (_id,do_auto_disable); }
251 int getAutoDisableFlag()
252 { return dBodyGetAutoDisableFlag (_id); }
253};
254
255
256class dJointGroup {
257 dJointGroupID _id;
258
259 // intentionally undefined, don't use these
260 dJointGroup (const dJointGroup &);
261 void operator= (const dJointGroup &);
262
263public:
264 dJointGroup (int dummy_arg=0)
265 { _id = dJointGroupCreate (0); }
266 ~dJointGroup()
267 { dJointGroupDestroy (_id); }
268 void create (int dummy_arg=0) {
269 if (_id) dJointGroupDestroy (_id);
270 _id = dJointGroupCreate (0);
271 }
272
273 dJointGroupID id() const
274 { return _id; }
275 operator dJointGroupID() const
276 { return _id; }
277
278 void empty()
279 { dJointGroupEmpty (_id); }
280};
281
282
283class dJoint {
284private:
285 // intentionally undefined, don't use these
286 dJoint (const dJoint &) ;
287 void operator= (const dJoint &);
288
289protected:
290 dJointID _id;
291
292public:
293 dJoint()
294 { _id = 0; }
295 ~dJoint()
296 { if (_id) dJointDestroy (_id); }
297
298 dJointID id() const
299 { return _id; }
300 operator dJointID() const
301 { return _id; }
302
303 void attach (dBodyID body1, dBodyID body2)
304 { dJointAttach (_id, body1, body2); }
305
306 void setData (void *data)
307 { dJointSetData (_id, data); }
308 void *getData() const
309 { return dJointGetData (_id); }
310
311 int getType() const
312 { return dJointGetType (_id); }
313
314 dBodyID getBody (int index) const
315 { return dJointGetBody (_id, index); }
316
317 void setFeedback(dJointFeedback *fb)
318 { dJointSetFeedback(_id, fb); }
319 dJointFeedback *getFeedback() const
320 { return dJointGetFeedback(_id); }
321};
322
323
324class dBallJoint : public dJoint {
325private:
326 // intentionally undefined, don't use these
327 dBallJoint (const dBallJoint &);
328 void operator= (const dBallJoint &);
329
330public:
331 dBallJoint() { }
332 dBallJoint (dWorldID world, dJointGroupID group=0)
333 { _id = dJointCreateBall (world, group); }
334
335 void create (dWorldID world, dJointGroupID group=0) {
336 if (_id) dJointDestroy (_id);
337 _id = dJointCreateBall (world, group);
338 }
339
340 void setAnchor (dReal x, dReal y, dReal z)
341 { dJointSetBallAnchor (_id, x, y, z); }
342 void getAnchor (dVector3 result) const
343 { dJointGetBallAnchor (_id, result); }
344 void getAnchor2 (dVector3 result) const
345 { dJointGetBallAnchor2 (_id, result); }
346 void setParam (int parameter, dReal value)
347 { dJointSetBallParam (_id, parameter, value); }
348 dReal getParam (int parameter) const
349 { return dJointGetBallParam (_id, parameter); }
350} ;
351
352
353class dHingeJoint : public dJoint {
354 // intentionally undefined, don't use these
355 dHingeJoint (const dHingeJoint &);
356 void operator = (const dHingeJoint &);
357
358public:
359 dHingeJoint() { }
360 dHingeJoint (dWorldID world, dJointGroupID group=0)
361 { _id = dJointCreateHinge (world, group); }
362
363 void create (dWorldID world, dJointGroupID group=0) {
364 if (_id) dJointDestroy (_id);
365 _id = dJointCreateHinge (world, group);
366 }
367
368 void setAnchor (dReal x, dReal y, dReal z)
369 { dJointSetHingeAnchor (_id, x, y, z); }
370 void getAnchor (dVector3 result) const
371 { dJointGetHingeAnchor (_id, result); }
372 void getAnchor2 (dVector3 result) const
373 { dJointGetHingeAnchor2 (_id, result); }
374
375 void setAxis (dReal x, dReal y, dReal z)
376 { dJointSetHingeAxis (_id, x, y, z); }
377 void getAxis (dVector3 result) const
378 { dJointGetHingeAxis (_id, result); }
379
380 dReal getAngle() const
381 { return dJointGetHingeAngle (_id); }
382 dReal getAngleRate() const
383 { return dJointGetHingeAngleRate (_id); }
384
385 void setParam (int parameter, dReal value)
386 { dJointSetHingeParam (_id, parameter, value); }
387 dReal getParam (int parameter) const
388 { return dJointGetHingeParam (_id, parameter); }
389
390 void addTorque (dReal torque)
391 { dJointAddHingeTorque(_id, torque); }
392};
393
394
395class dSliderJoint : public dJoint {
396 // intentionally undefined, don't use these
397 dSliderJoint (const dSliderJoint &);
398 void operator = (const dSliderJoint &);
399
400public:
401 dSliderJoint() { }
402 dSliderJoint (dWorldID world, dJointGroupID group=0)
403 { _id = dJointCreateSlider (world, group); }
404
405 void create (dWorldID world, dJointGroupID group=0) {
406 if (_id) dJointDestroy (_id);
407 _id = dJointCreateSlider (world, group);
408 }
409
410 void setAxis (dReal x, dReal y, dReal z)
411 { dJointSetSliderAxis (_id, x, y, z); }
412 void getAxis (dVector3 result) const
413 { dJointGetSliderAxis (_id, result); }
414
415 dReal getPosition() const
416 { return dJointGetSliderPosition (_id); }
417 dReal getPositionRate() const
418 { return dJointGetSliderPositionRate (_id); }
419
420 void setParam (int parameter, dReal value)
421 { dJointSetSliderParam (_id, parameter, value); }
422 dReal getParam (int parameter) const
423 { return dJointGetSliderParam (_id, parameter); }
424
425 void addForce (dReal force)
426 { dJointAddSliderForce(_id, force); }
427};
428
429
430class dUniversalJoint : public dJoint {
431 // intentionally undefined, don't use these
432 dUniversalJoint (const dUniversalJoint &);
433 void operator = (const dUniversalJoint &);
434
435public:
436 dUniversalJoint() { }
437 dUniversalJoint (dWorldID world, dJointGroupID group=0)
438 { _id = dJointCreateUniversal (world, group); }
439
440 void create (dWorldID world, dJointGroupID group=0) {
441 if (_id) dJointDestroy (_id);
442 _id = dJointCreateUniversal (world, group);
443 }
444
445 void setAnchor (dReal x, dReal y, dReal z)
446 { dJointSetUniversalAnchor (_id, x, y, z); }
447 void setAxis1 (dReal x, dReal y, dReal z)
448 { dJointSetUniversalAxis1 (_id, x, y, z); }
449 void setAxis2 (dReal x, dReal y, dReal z)
450 { dJointSetUniversalAxis2 (_id, x, y, z); }
451 void setParam (int parameter, dReal value)
452 { dJointSetUniversalParam (_id, parameter, value); }
453
454 void getAnchor (dVector3 result) const
455 { dJointGetUniversalAnchor (_id, result); }
456 void getAnchor2 (dVector3 result) const
457 { dJointGetUniversalAnchor2 (_id, result); }
458 void getAxis1 (dVector3 result) const
459 { dJointGetUniversalAxis1 (_id, result); }
460 void getAxis2 (dVector3 result) const
461 { dJointGetUniversalAxis2 (_id, result); }
462 dReal getParam (int parameter) const
463 { return dJointGetUniversalParam (_id, parameter); }
464 void getAngles(dReal *angle1, dReal *angle2) const
465 { dJointGetUniversalAngles (_id, angle1, angle2); }
466
467 dReal getAngle1() const
468 { return dJointGetUniversalAngle1 (_id); }
469 dReal getAngle1Rate() const
470 { return dJointGetUniversalAngle1Rate (_id); }
471 dReal getAngle2() const
472 { return dJointGetUniversalAngle2 (_id); }
473 dReal getAngle2Rate() const
474 { return dJointGetUniversalAngle2Rate (_id); }
475
476 void addTorques (dReal torque1, dReal torque2)
477 { dJointAddUniversalTorques(_id, torque1, torque2); }
478};
479
480
481class dHinge2Joint : public dJoint {
482 // intentionally undefined, don't use these
483 dHinge2Joint (const dHinge2Joint &);
484 void operator = (const dHinge2Joint &);
485
486public:
487 dHinge2Joint() { }
488 dHinge2Joint (dWorldID world, dJointGroupID group=0)
489 { _id = dJointCreateHinge2 (world, group); }
490
491 void create (dWorldID world, dJointGroupID group=0) {
492 if (_id) dJointDestroy (_id);
493 _id = dJointCreateHinge2 (world, group);
494 }
495
496 void setAnchor (dReal x, dReal y, dReal z)
497 { dJointSetHinge2Anchor (_id, x, y, z); }
498 void setAxis1 (dReal x, dReal y, dReal z)
499 { dJointSetHinge2Axis1 (_id, x, y, z); }
500 void setAxis2 (dReal x, dReal y, dReal z)
501 { dJointSetHinge2Axis2 (_id, x, y, z); }
502
503 void getAnchor (dVector3 result) const
504 { dJointGetHinge2Anchor (_id, result); }
505 void getAnchor2 (dVector3 result) const
506 { dJointGetHinge2Anchor2 (_id, result); }
507 void getAxis1 (dVector3 result) const
508 { dJointGetHinge2Axis1 (_id, result); }
509 void getAxis2 (dVector3 result) const
510 { dJointGetHinge2Axis2 (_id, result); }
511
512 dReal getAngle1() const
513 { return dJointGetHinge2Angle1 (_id); }
514 dReal getAngle1Rate() const
515 { return dJointGetHinge2Angle1Rate (_id); }
516 dReal getAngle2Rate() const
517 { return dJointGetHinge2Angle2Rate (_id); }
518
519 void setParam (int parameter, dReal value)
520 { dJointSetHinge2Param (_id, parameter, value); }
521 dReal getParam (int parameter) const
522 { return dJointGetHinge2Param (_id, parameter); }
523
524 void addTorques(dReal torque1, dReal torque2)
525 { dJointAddHinge2Torques(_id, torque1, torque2); }
526};
527
528
529class dPRJoint : public dJoint {
530 dPRJoint (const dPRJoint &);
531 void operator = (const dPRJoint &);
532
533public:
534 dPRJoint() { }
535 dPRJoint (dWorldID world, dJointGroupID group=0)
536 { _id = dJointCreatePR (world, group); }
537
538 void create (dWorldID world, dJointGroupID group=0) {
539 if (_id) dJointDestroy (_id);
540 _id = dJointCreatePR (world, group);
541 }
542
543 void setAnchor (dReal x, dReal y, dReal z)
544 { dJointSetPRAnchor (_id, x, y, z); }
545 void setAxis1 (dReal x, dReal y, dReal z)
546 { dJointSetPRAxis1 (_id, x, y, z); }
547 void setAxis2 (dReal x, dReal y, dReal z)
548 { dJointSetPRAxis2 (_id, x, y, z); }
549
550 void getAnchor (dVector3 result) const
551 { dJointGetPRAnchor (_id, result); }
552 void getAxis1 (dVector3 result) const
553 { dJointGetPRAxis1 (_id, result); }
554 void getAxis2 (dVector3 result) const
555 { dJointGetPRAxis2 (_id, result); }
556
557 dReal getPosition() const
558 { return dJointGetPRPosition (_id); }
559 dReal getPositionRate() const
560 { return dJointGetPRPositionRate (_id); }
561
562 void setParam (int parameter, dReal value)
563 { dJointSetPRParam (_id, parameter, value); }
564 dReal getParam (int parameter) const
565 { return dJointGetPRParam (_id, parameter); }
566};
567
568
569class dFixedJoint : public dJoint {
570 // intentionally undefined, don't use these
571 dFixedJoint (const dFixedJoint &);
572 void operator = (const dFixedJoint &);
573
574public:
575 dFixedJoint() { }
576 dFixedJoint (dWorldID world, dJointGroupID group=0)
577 { _id = dJointCreateFixed (world, group); }
578
579 void create (dWorldID world, dJointGroupID group=0) {
580 if (_id) dJointDestroy (_id);
581 _id = dJointCreateFixed (world, group);
582 }
583
584 void set()
585 { dJointSetFixed (_id); }
586
587 void setParam (int parameter, dReal value)
588 { dJointSetFixedParam (_id, parameter, value); }
589
590 dReal getParam (int parameter) const
591 { return dJointGetFixedParam (_id, parameter); }
592};
593
594
595class dContactJoint : public dJoint {
596 // intentionally undefined, don't use these
597 dContactJoint (const dContactJoint &);
598 void operator = (const dContactJoint &);
599
600public:
601 dContactJoint() { }
602 dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
603 { _id = dJointCreateContact (world, group, contact); }
604
605 void create (dWorldID world, dJointGroupID group, dContact *contact) {
606 if (_id) dJointDestroy (_id);
607 _id = dJointCreateContact (world, group, contact);
608 }
609};
610
611
612class dNullJoint : public dJoint {
613 // intentionally undefined, don't use these
614 dNullJoint (const dNullJoint &);
615 void operator = (const dNullJoint &);
616
617public:
618 dNullJoint() { }
619 dNullJoint (dWorldID world, dJointGroupID group=0)
620 { _id = dJointCreateNull (world, group); }
621
622 void create (dWorldID world, dJointGroupID group=0) {
623 if (_id) dJointDestroy (_id);
624 _id = dJointCreateNull (world, group);
625 }
626};
627
628
629class dAMotorJoint : public dJoint {
630 // intentionally undefined, don't use these
631 dAMotorJoint (const dAMotorJoint &);
632 void operator = (const dAMotorJoint &);
633
634public:
635 dAMotorJoint() { }
636 dAMotorJoint (dWorldID world, dJointGroupID group=0)
637 { _id = dJointCreateAMotor (world, group); }
638
639 void create (dWorldID world, dJointGroupID group=0) {
640 if (_id) dJointDestroy (_id);
641 _id = dJointCreateAMotor (world, group);
642 }
643
644 void setMode (int mode)
645 { dJointSetAMotorMode (_id, mode); }
646 int getMode() const
647 { return dJointGetAMotorMode (_id); }
648
649 void setNumAxes (int num)
650 { dJointSetAMotorNumAxes (_id, num); }
651 int getNumAxes() const
652 { return dJointGetAMotorNumAxes (_id); }
653
654 void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
655 { dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
656 void getAxis (int anum, dVector3 result) const
657 { dJointGetAMotorAxis (_id, anum, result); }
658 int getAxisRel (int anum) const
659 { return dJointGetAMotorAxisRel (_id, anum); }
660
661 void setAngle (int anum, dReal angle)
662 { dJointSetAMotorAngle (_id, anum, angle); }
663 dReal getAngle (int anum) const
664 { return dJointGetAMotorAngle (_id, anum); }
665 dReal getAngleRate (int anum)
666 { return dJointGetAMotorAngleRate (_id,anum); }
667
668 void setParam (int parameter, dReal value)
669 { dJointSetAMotorParam (_id, parameter, value); }
670 dReal getParam (int parameter) const
671 { return dJointGetAMotorParam (_id, parameter); }
672
673 void addTorques(dReal torque1, dReal torque2, dReal torque3)
674 { dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
675};
676
677
678class dLMotorJoint : public dJoint {
679 // intentionally undefined, don't use these
680 dLMotorJoint (const dLMotorJoint &);
681 void operator = (const dLMotorJoint &);
682
683public:
684 dLMotorJoint() { }
685 dLMotorJoint (dWorldID world, dJointGroupID group=0)
686 { _id = dJointCreateLMotor (world, group); }
687
688 void create (dWorldID world, dJointGroupID group=0) {
689 if (_id) dJointDestroy (_id);
690 _id = dJointCreateLMotor (world, group);
691 }
692
693 void setNumAxes (int num)
694 { dJointSetLMotorNumAxes (_id, num); }
695 int getNumAxes() const
696 { return dJointGetLMotorNumAxes (_id); }
697
698 void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
699 { dJointSetLMotorAxis (_id, anum, rel, x, y, z); }
700 void getAxis (int anum, dVector3 result) const
701 { dJointGetLMotorAxis (_id, anum, result); }
702
703 void setParam (int parameter, dReal value)
704 { dJointSetLMotorParam (_id, parameter, value); }
705 dReal getParam (int parameter) const
706 { return dJointGetLMotorParam (_id, parameter); }
707};
708
709
710
711#endif
712#endif
diff --git a/libraries/ode-0.9/include/ode/odecpp_collision.h b/libraries/ode-0.9/include/ode/odecpp_collision.h
new file mode 100644
index 0000000..16ca78f
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/odecpp_collision.h
@@ -0,0 +1,346 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23/* C++ interface for new collision API */
24
25
26#ifndef _ODE_ODECPP_COLLISION_H_
27#define _ODE_ODECPP_COLLISION_H_
28#ifdef __cplusplus
29
30#include <ode/error.h>
31
32
33class dGeom {
34 // intentionally undefined, don't use these
35 dGeom (dGeom &);
36 void operator= (dGeom &);
37
38protected:
39 dGeomID _id;
40
41public:
42 dGeom()
43 { _id = 0; }
44 ~dGeom()
45 { if (_id) dGeomDestroy (_id); }
46
47 dGeomID id() const
48 { return _id; }
49 operator dGeomID() const
50 { return _id; }
51
52 void destroy() {
53 if (_id) dGeomDestroy (_id);
54 _id = 0;
55 }
56
57 int getClass() const
58 { return dGeomGetClass (_id); }
59
60 dSpaceID getSpace() const
61 { return dGeomGetSpace (_id); }
62
63 void setData (void *data)
64 { dGeomSetData (_id,data); }
65 void *getData() const
66 { return dGeomGetData (_id); }
67
68 void setBody (dBodyID b)
69 { dGeomSetBody (_id,b); }
70 dBodyID getBody() const
71 { return dGeomGetBody (_id); }
72
73 void setPosition (dReal x, dReal y, dReal z)
74 { dGeomSetPosition (_id,x,y,z); }
75 const dReal * getPosition() const
76 { return dGeomGetPosition (_id); }
77
78 void setRotation (const dMatrix3 R)
79 { dGeomSetRotation (_id,R); }
80 const dReal * getRotation() const
81 { return dGeomGetRotation (_id); }
82
83 void setQuaternion (const dQuaternion quat)
84 { dGeomSetQuaternion (_id,quat); }
85 void getQuaternion (dQuaternion quat) const
86 { dGeomGetQuaternion (_id,quat); }
87
88 void getAABB (dReal aabb[6]) const
89 { dGeomGetAABB (_id, aabb); }
90
91 int isSpace()
92 { return dGeomIsSpace (_id); }
93
94 void setCategoryBits (unsigned long bits)
95 { dGeomSetCategoryBits (_id, bits); }
96 void setCollideBits (unsigned long bits)
97 { dGeomSetCollideBits (_id, bits); }
98 unsigned long getCategoryBits()
99 { return dGeomGetCategoryBits (_id); }
100 unsigned long getCollideBits()
101 { return dGeomGetCollideBits (_id); }
102
103 void enable()
104 { dGeomEnable (_id); }
105 void disable()
106 { dGeomDisable (_id); }
107 int isEnabled()
108 { return dGeomIsEnabled (_id); }
109
110 void collide2 (dGeomID g, void *data, dNearCallback *callback)
111 { dSpaceCollide2 (_id,g,data,callback); }
112};
113
114
115class dSpace : public dGeom {
116 // intentionally undefined, don't use these
117 dSpace (dSpace &);
118 void operator= (dSpace &);
119
120protected:
121 // the default constructor is protected so that you
122 // can't instance this class. you must instance one
123 // of its subclasses instead.
124 dSpace () { _id = 0; }
125
126public:
127 dSpaceID id() const
128 { return (dSpaceID) _id; }
129 operator dSpaceID() const
130 { return (dSpaceID) _id; }
131
132 void setCleanup (int mode)
133 { dSpaceSetCleanup (id(), mode); }
134 int getCleanup()
135 { return dSpaceGetCleanup (id()); }
136
137 void add (dGeomID x)
138 { dSpaceAdd (id(), x); }
139 void remove (dGeomID x)
140 { dSpaceRemove (id(), x); }
141 int query (dGeomID x)
142 { return dSpaceQuery (id(),x); }
143
144 int getNumGeoms()
145 { return dSpaceGetNumGeoms (id()); }
146 dGeomID getGeom (int i)
147 { return dSpaceGetGeom (id(),i); }
148
149 void collide (void *data, dNearCallback *callback)
150 { dSpaceCollide (id(),data,callback); }
151};
152
153
154class dSimpleSpace : public dSpace {
155 // intentionally undefined, don't use these
156 dSimpleSpace (dSimpleSpace &);
157 void operator= (dSimpleSpace &);
158
159public:
160 dSimpleSpace (dSpaceID space)
161 { _id = (dGeomID) dSimpleSpaceCreate (space); }
162};
163
164
165class dHashSpace : public dSpace {
166 // intentionally undefined, don't use these
167 dHashSpace (dHashSpace &);
168 void operator= (dHashSpace &);
169
170public:
171 dHashSpace (dSpaceID space)
172 { _id = (dGeomID) dHashSpaceCreate (space); }
173 void setLevels (int minlevel, int maxlevel)
174 { dHashSpaceSetLevels (id(),minlevel,maxlevel); }
175};
176
177
178class dQuadTreeSpace : public dSpace {
179 // intentionally undefined, don't use these
180 dQuadTreeSpace (dQuadTreeSpace &);
181 void operator= (dQuadTreeSpace &);
182
183public:
184 dQuadTreeSpace (dSpaceID space, dVector3 center, dVector3 extents, int depth)
185 { _id = (dGeomID) dQuadTreeSpaceCreate (space,center,extents,depth); }
186};
187
188
189class dSphere : public dGeom {
190 // intentionally undefined, don't use these
191 dSphere (dSphere &);
192 void operator= (dSphere &);
193
194public:
195 dSphere () { }
196 dSphere (dSpaceID space, dReal radius)
197 { _id = dCreateSphere (space, radius); }
198
199 void create (dSpaceID space, dReal radius) {
200 if (_id) dGeomDestroy (_id);
201 _id = dCreateSphere (space, radius);
202 }
203
204 void setRadius (dReal radius)
205 { dGeomSphereSetRadius (_id, radius); }
206 dReal getRadius() const
207 { return dGeomSphereGetRadius (_id); }
208};
209
210
211class dBox : public dGeom {
212 // intentionally undefined, don't use these
213 dBox (dBox &);
214 void operator= (dBox &);
215
216public:
217 dBox () { }
218 dBox (dSpaceID space, dReal lx, dReal ly, dReal lz)
219 { _id = dCreateBox (space,lx,ly,lz); }
220
221 void create (dSpaceID space, dReal lx, dReal ly, dReal lz) {
222 if (_id) dGeomDestroy (_id);
223 _id = dCreateBox (space,lx,ly,lz);
224 }
225
226 void setLengths (dReal lx, dReal ly, dReal lz)
227 { dGeomBoxSetLengths (_id, lx, ly, lz); }
228 void getLengths (dVector3 result) const
229 { dGeomBoxGetLengths (_id,result); }
230};
231
232
233class dPlane : public dGeom {
234 // intentionally undefined, don't use these
235 dPlane (dPlane &);
236 void operator= (dPlane &);
237
238public:
239 dPlane() { }
240 dPlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d)
241 { _id = dCreatePlane (space,a,b,c,d); }
242
243 void create (dSpaceID space, dReal a, dReal b, dReal c, dReal d) {
244 if (_id) dGeomDestroy (_id);
245 _id = dCreatePlane (space,a,b,c,d);
246 }
247
248 void setParams (dReal a, dReal b, dReal c, dReal d)
249 { dGeomPlaneSetParams (_id, a, b, c, d); }
250 void getParams (dVector4 result) const
251 { dGeomPlaneGetParams (_id,result); }
252};
253
254
255class dCapsule : public dGeom {
256 // intentionally undefined, don't use these
257 dCapsule (dCapsule &);
258 void operator= (dCapsule &);
259
260public:
261 dCapsule() { }
262 dCapsule (dSpaceID space, dReal radius, dReal length)
263 { _id = dCreateCapsule (space,radius,length); }
264
265 void create (dSpaceID space, dReal radius, dReal length) {
266 if (_id) dGeomDestroy (_id);
267 _id = dCreateCapsule (space,radius,length);
268 }
269
270 void setParams (dReal radius, dReal length)
271 { dGeomCapsuleSetParams (_id, radius, length); }
272 void getParams (dReal *radius, dReal *length) const
273 { dGeomCapsuleGetParams (_id,radius,length); }
274};
275
276
277class dRay : public dGeom {
278 // intentionally undefined, don't use these
279 dRay (dRay &);
280 void operator= (dRay &);
281
282public:
283 dRay() { }
284 dRay (dSpaceID space, dReal length)
285 { _id = dCreateRay (space,length); }
286
287 void create (dSpaceID space, dReal length) {
288 if (_id) dGeomDestroy (_id);
289 _id = dCreateRay (space,length);
290 }
291
292 void setLength (dReal length)
293 { dGeomRaySetLength (_id, length); }
294 dReal getLength()
295 { return dGeomRayGetLength (_id); }
296
297 void set (dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz)
298 { dGeomRaySet (_id, px, py, pz, dx, dy, dz); }
299 void get (dVector3 start, dVector3 dir)
300 { dGeomRayGet (_id, start, dir); }
301
302 void setParams (int firstContact, int backfaceCull)
303 { dGeomRaySetParams (_id, firstContact, backfaceCull); }
304 void getParams (int *firstContact, int *backfaceCull)
305 { dGeomRayGetParams (_id, firstContact, backfaceCull); }
306 void setClosestHit (int closestHit)
307 { dGeomRaySetClosestHit (_id, closestHit); }
308 int getClosestHit()
309 { return dGeomRayGetClosestHit (_id); }
310};
311
312
313class dGeomTransform : public dGeom {
314 // intentionally undefined, don't use these
315 dGeomTransform (dGeomTransform &);
316 void operator= (dGeomTransform &);
317
318public:
319 dGeomTransform() { }
320 dGeomTransform (dSpaceID space)
321 { _id = dCreateGeomTransform (space); }
322
323 void create (dSpaceID space=0) {
324 if (_id) dGeomDestroy (_id);
325 _id = dCreateGeomTransform (space);
326 }
327
328 void setGeom (dGeomID geom)
329 { dGeomTransformSetGeom (_id, geom); }
330 dGeomID getGeom() const
331 { return dGeomTransformGetGeom (_id); }
332
333 void setCleanup (int mode)
334 { dGeomTransformSetCleanup (_id,mode); }
335 int getCleanup ()
336 { return dGeomTransformGetCleanup (_id); }
337
338 void setInfo (int mode)
339 { dGeomTransformSetInfo (_id,mode); }
340 int getInfo()
341 { return dGeomTransformGetInfo (_id); }
342};
343
344
345#endif
346#endif
diff --git a/libraries/ode-0.9/include/ode/odemath.h b/libraries/ode-0.9/include/ode/odemath.h
new file mode 100644
index 0000000..f8fa3c7
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/odemath.h
@@ -0,0 +1,330 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_ODEMATH_H_
24#define _ODE_ODEMATH_H_
25
26#include <ode/common.h>
27
28#ifdef __GNUC__
29#define PURE_INLINE extern inline
30#else
31#define PURE_INLINE inline
32#endif
33
34/*
35 * macro to access elements i,j in an NxM matrix A, independent of the
36 * matrix storage convention.
37 */
38#define dACCESS33(A,i,j) ((A)[(i)*4+(j)])
39
40/*
41 * Macro to test for valid floating point values
42 */
43#define dVALIDVEC3(v) (!(dIsNan(v[0]) || dIsNan(v[1]) || dIsNan(v[2])))
44#define dVALIDVEC4(v) (!(dIsNan(v[0]) || dIsNan(v[1]) || dIsNan(v[2]) || dIsNan(v[3])))
45#define dVALIDMAT3(m) (!(dIsNan(m[0]) || dIsNan(m[1]) || dIsNan(m[2]) || dIsNan(m[3]) || dIsNan(m[4]) || dIsNan(m[5]) || dIsNan(m[6]) || dIsNan(m[7]) || dIsNan(m[8]) || dIsNan(m[9]) || dIsNan(m[10]) || dIsNan(m[11])))
46#define dVALIDMAT4(m) (!(dIsNan(m[0]) || dIsNan(m[1]) || dIsNan(m[2]) || dIsNan(m[3]) || dIsNan(m[4]) || dIsNan(m[5]) || dIsNan(m[6]) || dIsNan(m[7]) || dIsNan(m[8]) || dIsNan(m[9]) || dIsNan(m[10]) || dIsNan(m[11]) || dIsNan(m[12]) || dIsNan(m[13]) || dIsNan(m[14]) || dIsNan(m[15]) ))
47
48
49
50/*
51 * General purpose vector operations with other vectors or constants.
52 */
53
54#define dOP(a,op,b,c) \
55 (a)[0] = ((b)[0]) op ((c)[0]); \
56 (a)[1] = ((b)[1]) op ((c)[1]); \
57 (a)[2] = ((b)[2]) op ((c)[2]);
58#define dOPC(a,op,b,c) \
59 (a)[0] = ((b)[0]) op (c); \
60 (a)[1] = ((b)[1]) op (c); \
61 (a)[2] = ((b)[2]) op (c);
62#define dOPE(a,op,b) \
63 (a)[0] op ((b)[0]); \
64 (a)[1] op ((b)[1]); \
65 (a)[2] op ((b)[2]);
66#define dOPEC(a,op,c) \
67 (a)[0] op (c); \
68 (a)[1] op (c); \
69 (a)[2] op (c);
70
71
72/*
73 * Length, and squared length helpers. dLENGTH returns the length of a dVector3.
74 * dLENGTHSQUARED return the squared length of a dVector3.
75 */
76
77#define dLENGTHSQUARED(a) (((a)[0])*((a)[0]) + ((a)[1])*((a)[1]) + ((a)[2])*((a)[2]))
78
79#ifdef __cplusplus
80
81PURE_INLINE dReal dLENGTH (const dReal *a) { return dSqrt(dLENGTHSQUARED(a)); }
82
83#else
84
85#define dLENGTH(a) ( dSqrt( ((a)[0])*((a)[0]) + ((a)[1])*((a)[1]) + ((a)[2])*((a)[2]) ) )
86
87#endif /* __cplusplus */
88
89
90
91
92
93/*
94 * 3-way dot product. dDOTpq means that elements of `a' and `b' are spaced
95 * p and q indexes apart respectively. dDOT() means dDOT11.
96 * in C++ we could use function templates to get all the versions of these
97 * functions - but on some compilers this will result in sub-optimal code.
98 */
99
100#define dDOTpq(a,b,p,q) ((a)[0]*(b)[0] + (a)[p]*(b)[q] + (a)[2*(p)]*(b)[2*(q)])
101
102#ifdef __cplusplus
103
104PURE_INLINE dReal dDOT (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,1); }
105PURE_INLINE dReal dDOT13 (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,3); }
106PURE_INLINE dReal dDOT31 (const dReal *a, const dReal *b) { return dDOTpq(a,b,3,1); }
107PURE_INLINE dReal dDOT33 (const dReal *a, const dReal *b) { return dDOTpq(a,b,3,3); }
108PURE_INLINE dReal dDOT14 (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,4); }
109PURE_INLINE dReal dDOT41 (const dReal *a, const dReal *b) { return dDOTpq(a,b,4,1); }
110PURE_INLINE dReal dDOT44 (const dReal *a, const dReal *b) { return dDOTpq(a,b,4,4); }
111
112#else
113
114#define dDOT(a,b) dDOTpq(a,b,1,1)
115#define dDOT13(a,b) dDOTpq(a,b,1,3)
116#define dDOT31(a,b) dDOTpq(a,b,3,1)
117#define dDOT33(a,b) dDOTpq(a,b,3,3)
118#define dDOT14(a,b) dDOTpq(a,b,1,4)
119#define dDOT41(a,b) dDOTpq(a,b,4,1)
120#define dDOT44(a,b) dDOTpq(a,b,4,4)
121
122#endif /* __cplusplus */
123
124
125/*
126 * cross product, set a = b x c. dCROSSpqr means that elements of `a', `b'
127 * and `c' are spaced p, q and r indexes apart respectively.
128 * dCROSS() means dCROSS111. `op' is normally `=', but you can set it to
129 * +=, -= etc to get other effects.
130 */
131
132#define dCROSS(a,op,b,c) \
133do { \
134 (a)[0] op ((b)[1]*(c)[2] - (b)[2]*(c)[1]); \
135 (a)[1] op ((b)[2]*(c)[0] - (b)[0]*(c)[2]); \
136 (a)[2] op ((b)[0]*(c)[1] - (b)[1]*(c)[0]); \
137} while(0)
138#define dCROSSpqr(a,op,b,c,p,q,r) \
139do { \
140 (a)[ 0] op ((b)[ q]*(c)[2*r] - (b)[2*q]*(c)[ r]); \
141 (a)[ p] op ((b)[2*q]*(c)[ 0] - (b)[ 0]*(c)[2*r]); \
142 (a)[2*p] op ((b)[ 0]*(c)[ r] - (b)[ q]*(c)[ 0]); \
143} while(0)
144#define dCROSS114(a,op,b,c) dCROSSpqr(a,op,b,c,1,1,4)
145#define dCROSS141(a,op,b,c) dCROSSpqr(a,op,b,c,1,4,1)
146#define dCROSS144(a,op,b,c) dCROSSpqr(a,op,b,c,1,4,4)
147#define dCROSS411(a,op,b,c) dCROSSpqr(a,op,b,c,4,1,1)
148#define dCROSS414(a,op,b,c) dCROSSpqr(a,op,b,c,4,1,4)
149#define dCROSS441(a,op,b,c) dCROSSpqr(a,op,b,c,4,4,1)
150#define dCROSS444(a,op,b,c) dCROSSpqr(a,op,b,c,4,4,4)
151
152
153/*
154 * set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b.
155 * A is stored by rows, and has `skip' elements per row. the matrix is
156 * assumed to be already zero, so this does not write zero elements!
157 * if (plus,minus) is (+,-) then a positive version will be written.
158 * if (plus,minus) is (-,+) then a negative version will be written.
159 */
160
161#define dCROSSMAT(A,a,skip,plus,minus) \
162do { \
163 (A)[1] = minus (a)[2]; \
164 (A)[2] = plus (a)[1]; \
165 (A)[(skip)+0] = plus (a)[2]; \
166 (A)[(skip)+2] = minus (a)[0]; \
167 (A)[2*(skip)+0] = minus (a)[1]; \
168 (A)[2*(skip)+1] = plus (a)[0]; \
169} while(0)
170
171
172/*
173 * compute the distance between two 3D-vectors
174 */
175
176#ifdef __cplusplus
177PURE_INLINE dReal dDISTANCE (const dVector3 a, const dVector3 b)
178 { return dSqrt( (a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]) + (a[2]-b[2])*(a[2]-b[2]) ); }
179#else
180#define dDISTANCE(a,b) \
181 (dSqrt( ((a)[0]-(b)[0])*((a)[0]-(b)[0]) + ((a)[1]-(b)[1])*((a)[1]-(b)[1]) + ((a)[2]-(b)[2])*((a)[2]-(b)[2]) ))
182#endif
183
184
185/*
186 * special case matrix multipication, with operator selection
187 */
188
189#define dMULTIPLYOP0_331(A,op,B,C) \
190do { \
191 (A)[0] op dDOT((B),(C)); \
192 (A)[1] op dDOT((B+4),(C)); \
193 (A)[2] op dDOT((B+8),(C)); \
194} while(0)
195#define dMULTIPLYOP1_331(A,op,B,C) \
196do { \
197 (A)[0] op dDOT41((B),(C)); \
198 (A)[1] op dDOT41((B+1),(C)); \
199 (A)[2] op dDOT41((B+2),(C)); \
200} while(0)
201#define dMULTIPLYOP0_133(A,op,B,C) \
202do { \
203 (A)[0] op dDOT14((B),(C)); \
204 (A)[1] op dDOT14((B),(C+1)); \
205 (A)[2] op dDOT14((B),(C+2)); \
206} while(0)
207#define dMULTIPLYOP0_333(A,op,B,C) \
208do { \
209 (A)[0] op dDOT14((B),(C)); \
210 (A)[1] op dDOT14((B),(C+1)); \
211 (A)[2] op dDOT14((B),(C+2)); \
212 (A)[4] op dDOT14((B+4),(C)); \
213 (A)[5] op dDOT14((B+4),(C+1)); \
214 (A)[6] op dDOT14((B+4),(C+2)); \
215 (A)[8] op dDOT14((B+8),(C)); \
216 (A)[9] op dDOT14((B+8),(C+1)); \
217 (A)[10] op dDOT14((B+8),(C+2)); \
218} while(0)
219#define dMULTIPLYOP1_333(A,op,B,C) \
220do { \
221 (A)[0] op dDOT44((B),(C)); \
222 (A)[1] op dDOT44((B),(C+1)); \
223 (A)[2] op dDOT44((B),(C+2)); \
224 (A)[4] op dDOT44((B+1),(C)); \
225 (A)[5] op dDOT44((B+1),(C+1)); \
226 (A)[6] op dDOT44((B+1),(C+2)); \
227 (A)[8] op dDOT44((B+2),(C)); \
228 (A)[9] op dDOT44((B+2),(C+1)); \
229 (A)[10] op dDOT44((B+2),(C+2)); \
230} while(0)
231#define dMULTIPLYOP2_333(A,op,B,C) \
232do { \
233 (A)[0] op dDOT((B),(C)); \
234 (A)[1] op dDOT((B),(C+4)); \
235 (A)[2] op dDOT((B),(C+8)); \
236 (A)[4] op dDOT((B+4),(C)); \
237 (A)[5] op dDOT((B+4),(C+4)); \
238 (A)[6] op dDOT((B+4),(C+8)); \
239 (A)[8] op dDOT((B+8),(C)); \
240 (A)[9] op dDOT((B+8),(C+4)); \
241 (A)[10] op dDOT((B+8),(C+8)); \
242} while(0)
243
244#ifdef __cplusplus
245
246#define DECL template <class TA, class TB, class TC> PURE_INLINE void
247
248DECL dMULTIPLY0_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_331(A,=,B,C); }
249DECL dMULTIPLY1_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_331(A,=,B,C); }
250DECL dMULTIPLY0_133(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_133(A,=,B,C); }
251DECL dMULTIPLY0_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_333(A,=,B,C); }
252DECL dMULTIPLY1_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_333(A,=,B,C); }
253DECL dMULTIPLY2_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP2_333(A,=,B,C); }
254
255DECL dMULTIPLYADD0_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_331(A,+=,B,C); }
256DECL dMULTIPLYADD1_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_331(A,+=,B,C); }
257DECL dMULTIPLYADD0_133(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_133(A,+=,B,C); }
258DECL dMULTIPLYADD0_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_333(A,+=,B,C); }
259DECL dMULTIPLYADD1_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_333(A,+=,B,C); }
260DECL dMULTIPLYADD2_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP2_333(A,+=,B,C); }
261
262#undef DECL
263
264#else
265
266#define dMULTIPLY0_331(A,B,C) dMULTIPLYOP0_331(A,=,B,C)
267#define dMULTIPLY1_331(A,B,C) dMULTIPLYOP1_331(A,=,B,C)
268#define dMULTIPLY0_133(A,B,C) dMULTIPLYOP0_133(A,=,B,C)
269#define dMULTIPLY0_333(A,B,C) dMULTIPLYOP0_333(A,=,B,C)
270#define dMULTIPLY1_333(A,B,C) dMULTIPLYOP1_333(A,=,B,C)
271#define dMULTIPLY2_333(A,B,C) dMULTIPLYOP2_333(A,=,B,C)
272
273#define dMULTIPLYADD0_331(A,B,C) dMULTIPLYOP0_331(A,+=,B,C)
274#define dMULTIPLYADD1_331(A,B,C) dMULTIPLYOP1_331(A,+=,B,C)
275#define dMULTIPLYADD0_133(A,B,C) dMULTIPLYOP0_133(A,+=,B,C)
276#define dMULTIPLYADD0_333(A,B,C) dMULTIPLYOP0_333(A,+=,B,C)
277#define dMULTIPLYADD1_333(A,B,C) dMULTIPLYOP1_333(A,+=,B,C)
278#define dMULTIPLYADD2_333(A,B,C) dMULTIPLYOP2_333(A,+=,B,C)
279
280#endif
281
282
283#ifdef __cplusplus
284extern "C" {
285#endif
286
287/*
288 * normalize 3x1 and 4x1 vectors (i.e. scale them to unit length)
289 */
290ODE_API int dSafeNormalize3 (dVector3 a);
291ODE_API int dSafeNormalize4 (dVector4 a);
292
293// For some reason demo_chain1.c does not understand "inline" keyword.
294static __inline void _dNormalize3(dVector3 a)
295{
296 int bNormalizationResult = dSafeNormalize3(a);
297 dIASSERT(bNormalizationResult);
298 dVARIABLEUSED(bNormalizationResult);
299}
300
301static __inline void _dNormalize4(dVector4 a)
302{
303 int bNormalizationResult = dSafeNormalize4(a);
304 dIASSERT(bNormalizationResult);
305 dVARIABLEUSED(bNormalizationResult);
306}
307
308// For DLL export
309ODE_API void dNormalize3 (dVector3 a); // Potentially asserts on zero vec
310ODE_API void dNormalize4 (dVector4 a); // Potentially asserts on zero vec
311
312// For internal use
313#define dNormalize3(a) _dNormalize3(a)
314#define dNormalize4(a) _dNormalize4(a)
315
316/*
317 * given a unit length "normal" vector n, generate vectors p and q vectors
318 * that are an orthonormal basis for the plane space perpendicular to n.
319 * i.e. this makes p,q such that n,p,q are all perpendicular to each other.
320 * q will equal n x p. if n is not unit length then p will be unit length but
321 * q wont be.
322 */
323
324ODE_API void dPlaneSpace (const dVector3 n, dVector3 p, dVector3 q);
325
326#ifdef __cplusplus
327}
328#endif
329
330#endif
diff --git a/libraries/ode-0.9/include/ode/rotation.h b/libraries/ode-0.9/include/ode/rotation.h
new file mode 100644
index 0000000..a72be27
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/rotation.h
@@ -0,0 +1,70 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_ROTATION_H_
24#define _ODE_ROTATION_H_
25
26#include <ode/common.h>
27#include <ode/compatibility.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33
34ODE_API void dRSetIdentity (dMatrix3 R);
35
36ODE_API void dRFromAxisAndAngle (dMatrix3 R, dReal ax, dReal ay, dReal az,
37 dReal angle);
38
39ODE_API void dRFromEulerAngles (dMatrix3 R, dReal phi, dReal theta, dReal psi);
40
41ODE_API void dRFrom2Axes (dMatrix3 R, dReal ax, dReal ay, dReal az,
42 dReal bx, dReal by, dReal bz);
43
44ODE_API void dRFromZAxis (dMatrix3 R, dReal ax, dReal ay, dReal az);
45
46ODE_API void dQSetIdentity (dQuaternion q);
47
48ODE_API void dQFromAxisAndAngle (dQuaternion q, dReal ax, dReal ay, dReal az,
49 dReal angle);
50
51/* Quaternion multiplication, analogous to the matrix multiplication routines. */
52/* qa = rotate by qc, then qb */
53ODE_API void dQMultiply0 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
54/* qa = rotate by qc, then by inverse of qb */
55ODE_API void dQMultiply1 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
56/* qa = rotate by inverse of qc, then by qb */
57ODE_API void dQMultiply2 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
58/* qa = rotate by inverse of qc, then by inverse of qb */
59ODE_API void dQMultiply3 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
60
61ODE_API void dRfromQ (dMatrix3 R, const dQuaternion q);
62ODE_API void dQfromR (dQuaternion q, const dMatrix3 R);
63ODE_API void dDQfromW (dReal dq[4], const dVector3 w, const dQuaternion q);
64
65
66#ifdef __cplusplus
67}
68#endif
69
70#endif
diff --git a/libraries/ode-0.9/include/ode/timer.h b/libraries/ode-0.9/include/ode/timer.h
new file mode 100644
index 0000000..c3f42a7
--- /dev/null
+++ b/libraries/ode-0.9/include/ode/timer.h
@@ -0,0 +1,76 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_TIMER_H_
24#define _ODE_TIMER_H_
25
26#include <ode/config.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32
33/* stop watch objects */
34
35typedef struct dStopwatch {
36 double time; /* total clock count */
37 unsigned long cc[2]; /* clock count since last `start' */
38} dStopwatch;
39
40ODE_API void dStopwatchReset (dStopwatch *);
41ODE_API void dStopwatchStart (dStopwatch *);
42ODE_API void dStopwatchStop (dStopwatch *);
43ODE_API double dStopwatchTime (dStopwatch *); /* returns total time in secs */
44
45
46/* code timers */
47
48ODE_API void dTimerStart (const char *description); /* pass a static string here */
49ODE_API void dTimerNow (const char *description); /* pass a static string here */
50ODE_API void dTimerEnd(void);
51
52/* print out a timer report. if `average' is nonzero, print out the average
53 * time for each slot (this is only meaningful if the same start-now-end
54 * calls are being made repeatedly.
55 */
56ODE_API void dTimerReport (FILE *fout, int average);
57
58
59/* resolution */
60
61/* returns the timer ticks per second implied by the timing hardware or API.
62 * the actual timer resolution may not be this great.
63 */
64ODE_API double dTimerTicksPerSecond(void);
65
66/* returns an estimate of the actual timer resolution, in seconds. this may
67 * be greater than 1/ticks_per_second.
68 */
69ODE_API double dTimerResolution(void);
70
71
72#ifdef __cplusplus
73}
74#endif
75
76#endif