removed obsolete ODE sdk

This commit is contained in:
ejcoumans 2006-05-26 19:15:23 +00:00
parent 95ea729454
commit 1035e21422
126 changed files with 0 additions and 42757 deletions

View File

@ -1,34 +0,0 @@
This is the BSD-style license for the Open Dynamics Engine
----------------------------------------------------------
Open Dynamics Engine
Copyright (c) 2001-2004, Russell L. Smith.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the names of ODE's copyright owner nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,502 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -1,204 +0,0 @@
# Microsoft Developer Studio Project File - Name="DrawStuff" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=DrawStuff - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "DrawStuff.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "DrawStuff.mak" CFG="DrawStuff - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "DrawStuff - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "DrawStuff - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "DrawStuff - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "DrawStuff_Release"
# PROP Intermediate_Dir "DrawStuff_Release\Int"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W2 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\..\..\lib\DrawStuff.lib"
!ELSEIF "$(CFG)" == "DrawStuff - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DrawStuff_Debug"
# PROP Intermediate_Dir "DrawStuff_Debug\Int"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W2 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\..\..\lib\DrawStuffd.lib"
!ENDIF
# Begin Target
# Name "DrawStuff - Win32 Release"
# Name "DrawStuff - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\drawstuff\src\drawstuff.cpp
# End Source File
# Begin Source File
SOURCE=..\..\drawstuff\src\resources.rc
# End Source File
# Begin Source File
SOURCE=..\..\drawstuff\src\windows.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h"
# Begin Source File
SOURCE=..\..\drawstuff\src\internal.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -1,194 +0,0 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="DrawStuff"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\DrawStuff_Release"
IntermediateDirectory=".\DrawStuff_Release\Int"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\DrawStuff_Release\Int/DrawStuff.pch"
AssemblerListingLocation=".\DrawStuff_Release\Int/"
ObjectFile=".\DrawStuff_Release\Int/"
ProgramDataBaseFileName=".\DrawStuff_Release\Int/"
WarningLevel="2"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\..\..\lib\DrawStuff.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\DrawStuff_Debug"
IntermediateDirectory=".\DrawStuff_Debug\Int"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\DrawStuff_Debug\Int/DrawStuff.pch"
AssemblerListingLocation=".\DrawStuff_Debug\Int/"
ObjectFile=".\DrawStuff_Debug\Int/"
ProgramDataBaseFileName=".\DrawStuff_Debug\Int/"
BrowseInformation="1"
WarningLevel="2"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\..\..\lib\DrawStuffd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\drawstuff\src\drawstuff.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\drawstuff\src\resources.rc">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\develop\bullet\Extras\ode\drawstuff\src"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\develop\bullet\Extras\ode\drawstuff\src"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\drawstuff\src\windows.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h">
<File
RelativePath="..\..\drawstuff\src\internal.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,65 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DrawStuff", "DrawStuff.vcproj", "{72D5B37B-FB7B-48A0-B4CA-EC019DEF577B}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ode", "..\ode.vcproj", "{153C9883-E788-4FD5-A5B1-D09FEEAADFBF}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test_BulletBoxStack", "Test_BoxStack.vcproj", "{B1689C8C-9E82-48DE-B896-DE8DB08541B4}"
ProjectSection(ProjectDependencies) = postProject
{44672927-0084-4B70-8CDA-8697BF848C7F} = {44672927-0084-4B70-8CDA-8697BF848C7F}
{90F5975E-550B-EEC8-9A8A-B8581D3FCF97} = {90F5975E-550B-EEC8-9A8A-B8581D3FCF97}
{72D5B37B-FB7B-48A0-B4CA-EC019DEF577B} = {72D5B37B-FB7B-48A0-B4CA-EC019DEF577B}
{153C9883-E788-4FD5-A5B1-D09FEEAADFBF} = {153C9883-E788-4FD5-A5B1-D09FEEAADFBF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BulletOdeCollide", "..\..\..\BulletOdeCollide\BulletOdeCollide_vc7.vcproj", "{44672927-0084-4B70-8CDA-8697BF848C7F}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet", "..\..\..\..\msvc\71\libbullet.vcproj", "{90F5975E-550B-EEC8-9A8A-B8581D3FCF97}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 1
SccProjectUniqueName0 = ..\\ode.vcproj
SccProjectName0 = \u0022$/TR4/ODE\u0022,\u0020BHKAAAAA
SccLocalPath0 = ..\\..
SccProvider0 = MSSCCI:ClearCase
SccProjectFilePathRelativizedFromConnection0 = VC6\\
EndGlobalSection
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{72D5B37B-FB7B-48A0-B4CA-EC019DEF577B}.Debug.ActiveCfg = Debug|Win32
{72D5B37B-FB7B-48A0-B4CA-EC019DEF577B}.Debug.Build.0 = Debug|Win32
{72D5B37B-FB7B-48A0-B4CA-EC019DEF577B}.Release.ActiveCfg = Release|Win32
{72D5B37B-FB7B-48A0-B4CA-EC019DEF577B}.Release.Build.0 = Release|Win32
{153C9883-E788-4FD5-A5B1-D09FEEAADFBF}.Debug.ActiveCfg = Debug|Win32
{153C9883-E788-4FD5-A5B1-D09FEEAADFBF}.Debug.Build.0 = Debug|Win32
{153C9883-E788-4FD5-A5B1-D09FEEAADFBF}.Release.ActiveCfg = Release|Win32
{153C9883-E788-4FD5-A5B1-D09FEEAADFBF}.Release.Build.0 = Release|Win32
{B1689C8C-9E82-48DE-B896-DE8DB08541B4}.Debug.ActiveCfg = Debug|Win32
{B1689C8C-9E82-48DE-B896-DE8DB08541B4}.Debug.Build.0 = Debug|Win32
{B1689C8C-9E82-48DE-B896-DE8DB08541B4}.Release.ActiveCfg = Release|Win32
{B1689C8C-9E82-48DE-B896-DE8DB08541B4}.Release.Build.0 = Release|Win32
{44672927-0084-4B70-8CDA-8697BF848C7F}.Debug.ActiveCfg = Debug|Win32
{44672927-0084-4B70-8CDA-8697BF848C7F}.Debug.Build.0 = Debug|Win32
{44672927-0084-4B70-8CDA-8697BF848C7F}.Release.ActiveCfg = Release|Win32
{44672927-0084-4B70-8CDA-8697BF848C7F}.Release.Build.0 = Release|Win32
{90F5975E-550B-EEC8-9A8A-B8581D3FCF97}.Debug.ActiveCfg = Debug|Win32
{90F5975E-550B-EEC8-9A8A-B8581D3FCF97}.Debug.Build.0 = Debug|Win32
{90F5975E-550B-EEC8-9A8A-B8581D3FCF97}.Release.ActiveCfg = Release|Win32
{90F5975E-550B-EEC8-9A8A-B8581D3FCF97}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -1,197 +0,0 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Test_BulletBoxStack"
ProjectGUID="{B1689C8C-9E82-48DE-B896-DE8DB08541B4}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Test_BoxStack_Debug"
IntermediateDirectory=".\Test_BoxStack_Debug\Int"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;..\..\Include;..\..\OPCODE;../../../BulletOdeCollide;../../../../Bullet;../../../../BulletDynamics;../../../../LinearMath"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BULLET_CONVEX_SUPPORT"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Test_BoxStack_Debug\Int/Test_BoxStack.pch"
AssemblerListingLocation=".\Test_BoxStack_Debug\Int/"
ObjectFile=".\Test_BoxStack_Debug\Int/"
ProgramDataBaseFileName=".\Test_BoxStack_Debug\Int/"
BrowseInformation="1"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="oded.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib"
OutputFile=".\Test_BoxStack_Debug/Test_BoxStack.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Test_BoxStack_Debug/Test_BoxStack.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Test_BoxStack_Debug/Test_BoxStack.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
Description="- Copying .exe to test dir -"
CommandLine="copy &quot;$(TargetPath)&quot; ..\..\ode\test\"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Test_BoxStack_Release"
IntermediateDirectory=".\Test_BoxStack_Release\Int"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include;..\..\Include;..\..\OPCODE;../../../BulletOdeCollide;../../../../Bullet;../../../../BulletDynamics;../../../../LinearMath"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BULLET_CONVEX_SUPPORT"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Test_BoxStack_Release\Int/Test_BoxStack.pch"
AssemblerListingLocation=".\Test_BoxStack_Release\Int/"
ObjectFile=".\Test_BoxStack_Release\Int/"
ProgramDataBaseFileName=".\Test_BoxStack_Release\Int/"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/fixed:no"
AdditionalDependencies="odbc32.lib odbccp32.lib opengl32.lib glu32.lib"
OutputFile=".\Test_BoxStack_Release/Test_BoxStack.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Test_BoxStack_Release/Test_BoxStack.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Test_BoxStack_Release/Test_BoxStack.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
Description="- Copying .exe to test dir -"
CommandLine="copy &quot;$(TargetPath)&quot; ..\..\ode\test\"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\ode\test\test_convex_stack.cpp">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="..\..\drawstuff\src\resources.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\release\bullet\Extras\ode\drawstuff\src"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\release\bullet\Extras\ode\drawstuff\src"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="DrawStuff headers"
Filter="">
<File
RelativePath="..\..\..\..\include\drawstuff\drawstuff.h">
</File>
</Filter>
<File
RelativePath=".\VTune\Test_BulletBoxStack.vpj">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,119 +0,0 @@
# Microsoft Developer Studio Project File - Name="Test_BulletGjk" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Test_BulletGjk - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Test_BulletGjk.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Test_BulletGjk.mak" CFG="Test_BulletGjk - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Test_BulletGjk - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Test_BulletGjk - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Test_BulletGjk - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Test_BulletGjk_Release"
# PROP Intermediate_Dir "Test_BulletGjk_Release\Int"
# PROP Ignore_Export_Lib 0
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /GX /O2 /I "..\..\include" /I "..\..\Include" /I "..\..\OPCODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\lib"
# Begin Special Build Tool
TargetPath=.\Test_BulletGjk_Release\Test_BulletGjk.exe
SOURCE="$(InputPath)"
PostBuild_Desc=- Copying .exe to test dir -
PostBuild_Cmds=copy $(TargetPath) ..\..\ode\test\
# End Special Build Tool
!ELSEIF "$(CFG)" == "Test_BulletGjk - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Test_BulletGjk_Debug"
# PROP Intermediate_Dir "Test_BulletGjk_Debug\Int"
# PROP Ignore_Export_Lib 0
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\Include" /I "..\..\OPCODE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 oded.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\lib"
# Begin Special Build Tool
TargetPath=.\Test_BulletGjk_Debug\Test_BulletGjk.exe
SOURCE="$(InputPath)"
PostBuild_Desc=- Copying .exe to test dir -
PostBuild_Cmds=copy $(TargetPath) ..\..\ode\test\
# End Special Build Tool
!ENDIF
# Begin Target
# Name "Test_BulletGjk - Win32 Release"
# Name "Test_BulletGjk - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\ode\test\test_BulletGjk.cpp
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=..\..\drawstuff\src\resources.rc
# End Source File
# End Group
# Begin Group "DrawStuff headers"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\..\include\drawstuff\drawstuff.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -1,209 +0,0 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Test_BulletGjk"
ProjectGUID="{58C3DE5C-5E87-49C7-8A59-1B833050AF92}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Test_BulletGjk_Debug"
IntermediateDirectory=".\Test_BulletGjk_Debug\Int"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;..\..\..\..\Bullet;..\..\..\..\LinearMath"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Test_BulletGjk_Debug\Int/Test_BulletGjk.pch"
AssemblerListingLocation=".\Test_BulletGjk_Debug\Int/"
ObjectFile=".\Test_BulletGjk_Debug\Int/"
ProgramDataBaseFileName=".\Test_BulletGjk_Debug\Int/"
BrowseInformation="1"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="oded.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib"
OutputFile=".\Test_BulletGjk_Debug/Test_BulletGjk.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Test_BulletGjk_Debug/Test_BulletGjk.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Test_BulletGjk_Debug/Test_BulletGjk.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
Description="- Copying .exe to test dir -"
CommandLine="copy &quot;$(TargetPath)&quot; ..\..\ode\test\"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Test_BulletGjk_Release"
IntermediateDirectory=".\Test_BulletGjk_Release\Int"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include;..\..\..\..\Bullet;..\..\..\..\LinearMath"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Test_BulletGjk_Release\Int/Test_BulletGjk.pch"
AssemblerListingLocation=".\Test_BulletGjk_Release\Int/"
ObjectFile=".\Test_BulletGjk_Release\Int/"
ProgramDataBaseFileName=".\Test_BulletGjk_Release\Int/"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib opengl32.lib glu32.lib"
OutputFile=".\Test_BulletGjk_Release/Test_BulletGjk.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib"
ProgramDatabaseFile=".\Test_BulletGjk_Release/Test_BulletGjk.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Test_BulletGjk_Release/Test_BulletGjk.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
Description="- Copying .exe to test dir -"
CommandLine="copy &quot;$(TargetPath)&quot; ..\..\ode\test\"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\ode\test\test_BulletGjk.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="..\..\drawstuff\src\resources.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\develop\bullet\Extras\ode\drawstuff\src"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\develop\bullet\Extras\ode\drawstuff\src"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="DrawStuff headers"
Filter="">
<File
RelativePath="..\..\..\..\include\drawstuff\drawstuff.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,192 +0,0 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Test_BulletTrimesh"
ProjectGUID="{AA67E9DC-C632-4694-8638-D0F689EA0A1A}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Test_Trimesh_Release"
IntermediateDirectory=".\Test_Trimesh_Release/Int"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\Include;..\..\OPCODE;../../../BulletOdeCollide;../../../../Bullet;../../../../LinearMath"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BULLET_CONVEX_SUPPORT"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Test_Trimesh_Release/Int/Test_Trimesh.pch"
AssemblerListingLocation=".\Test_Trimesh_Release/Int/"
ObjectFile=".\Test_Trimesh_Release/Int/"
ProgramDataBaseFileName=".\Test_Trimesh_Release/Int/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib opengl32.lib glu32.lib"
OutputFile=".\Test_Trimesh_Release/Test_Trimesh.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib"
ProgramDatabaseFile=".\Test_Trimesh_Release/Test_Trimesh.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Test_Trimesh_Release/Test_Trimesh.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
Description="- Copying .exe to test dir -"
CommandLine="copy &quot;$(TargetPath)&quot; ..\..\ode\test\"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Test_Trimesh_Debug"
IntermediateDirectory=".\Test_Trimesh_Debug/Int"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\Include;..\..\OPCODE;../../../BulletOdeCollide;../../../../Bullet;../../../../LinearMath"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Test_Trimesh_Debug/Int/Test_Trimesh.pch"
AssemblerListingLocation=".\Test_Trimesh_Debug/Int/"
ObjectFile=".\Test_Trimesh_Debug/Int/"
ProgramDataBaseFileName=".\Test_Trimesh_Debug/Int/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib opengl32.lib glu32.lib"
OutputFile=".\Test_Trimesh_Debug/Test_Trimesh.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Test_Trimesh_Debug/Test_Trimesh.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Test_Trimesh_Debug/Test_Trimesh.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
Description="- Copying .exe to test dir -"
CommandLine="copy &quot;$(TargetPath)&quot; ..\..\ode\test\"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="2057"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\ode\test\test_convex_trimesh.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\..\..\..\include\drawstuff\drawstuff.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="..\..\drawstuff\src\resources.rc">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\release\bullet\Extras\ode\drawstuff\src"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\release\bullet\Extras\ode\drawstuff\src"/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,304 +0,0 @@
# Microsoft Developer Studio Project File - Name="ode" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=ode - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ode.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ode.mak" CFG="ode - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ode - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "ode - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/TR4/ODE", BHKAAAAA"
# PROP Scc_LocalPath ".."
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "ode - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W2 /GX /O2 /I "..\Include" /I "..\OPCODE" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib\ode.lib"
!ELSEIF "$(CFG)" == "ode - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W2 /Gm /GX /ZI /Od /I "..\Include" /I "..\OPCODE" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib\oded.lib"
!ENDIF
# Begin Target
# Name "ode - Win32 Release"
# Name "ode - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\ode\src\array.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_kernel.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_quadtreespace.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_space.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_std.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_transform.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_trimesh.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_trimesh_box.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_trimesh_ccylinder.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_trimesh_distance.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_trimesh_ray.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_trimesh_sphere.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_trimesh_trimesh.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_util.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\error.cpp
# End Source File
# Begin Source File
SOURCE="..\ode\src\export-dif.cpp"
# End Source File
# Begin Source File
SOURCE=..\ode\src\fastdot.c
# End Source File
# Begin Source File
SOURCE=..\ode\src\fastldlt.c
# End Source File
# Begin Source File
SOURCE=..\ode\src\fastlsolve.c
# End Source File
# Begin Source File
SOURCE=..\ode\src\fastltsolve.c
# End Source File
# Begin Source File
SOURCE=..\ode\src\joint.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\lcp.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\mass.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\mat.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\matrix.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\memory.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\misc.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\obstack.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\ode.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\odemath.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\quickstep.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\rotation.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\step.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\stepfast.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\testing.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\timer.cpp
# End Source File
# Begin Source File
SOURCE=..\ode\src\util.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\ode\src\array.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_kernel.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_space_internal.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_std.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_transform.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_trimesh_internal.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\collision_util.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\joint.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\lcp.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\mat.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\objects.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\obstack.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\quickstep.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\step.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\testing.h
# End Source File
# Begin Source File
SOURCE=..\ode\src\util.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -1,53 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "OPCODE"=..\OPCODE\Opcode.dsp - Package Owner=<4>
Package=<5>
{{{
begin source code control
"$/TR4/ODE/VC6", WNKAAAAA
.
end source code control
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "ode"=.\ode.dsp - Package Owner=<4>
Package=<5>
{{{
begin source code control
"$/TR4/ODE/VC6", WNKAAAAA
.
end source code control
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name OPCODE
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -1,813 +0,0 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="ode"
SccProjectName="&quot;$/TR4/ODE&quot;, BHKAAAAA"
SccLocalPath="..">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Include;..\..\..\Bullet;..\..\..\LinearMath;..\..\BulletOdeCollide"
PreprocessorDefinitions="BULLET_CONVEX_SUPPORT,WIN32;_DEBUG;_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/ode.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="2"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\oded.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="2057"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\Include;..\..\..\Bullet;..\..\..\LinearMath;..\..\BulletOdeCollide"
PreprocessorDefinitions="BULLET_CONVEX_SUPPORT,WIN32;NDEBUG;_LIB"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/ode.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="2"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\ode.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\ode\src\array.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\collision_kernel.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\collision_quadtreespace.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\collision_space.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\collision_std.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\collision_transform.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\collision_util.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\error.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\export-dif.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\fastdot.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\fastldlt.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\fastlsolve.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\fastltsolve.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\joint.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\lcp.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\mass.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\mat.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\matrix.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\memory.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\misc.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\obstack.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\ode.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\odemath.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\quickstep.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\rotation.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\step.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\stepfast.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\testing.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\timer.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\ode\src\util.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\ode\src\array.h">
</File>
<File
RelativePath="..\ode\src\collision_convex_internal.h">
</File>
<File
RelativePath="..\ode\src\collision_kernel.h">
</File>
<File
RelativePath="..\ode\src\collision_space_internal.h">
</File>
<File
RelativePath="..\ode\src\collision_std.h">
</File>
<File
RelativePath="..\ode\src\collision_transform.h">
</File>
<File
RelativePath="..\ode\src\collision_trimesh_internal.h">
</File>
<File
RelativePath="..\ode\src\collision_util.h">
</File>
<File
RelativePath="..\ode\src\joint.h">
</File>
<File
RelativePath="..\ode\src\lcp.h">
</File>
<File
RelativePath="..\ode\src\mat.h">
</File>
<File
RelativePath="..\ode\src\objects.h">
</File>
<File
RelativePath="..\ode\src\obstack.h">
</File>
<File
RelativePath="..\ode\src\quickstep.h">
</File>
<File
RelativePath="..\ode\src\step.h">
</File>
<File
RelativePath="..\ode\src\testing.h">
</File>
<File
RelativePath="..\ode\src\util.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,83 +0,0 @@
variable names used in the per-platform makefile configuration files:
platform stuff
--------------
WINDOWS set to 1 if this is a microsoft windows based platform
filesystem stuff and commands
-----------------------------
THIS_DIR1 prefix to run a command from the current directory (from within make)
THIS_DIR2 prefix to run a command from the current directory (from command line)
DEL_CMD the name of the delete command
compiler stuff
--------------
CC the C/C++ compiler to use
OBJ the object file extension
C_FLAGS the standard set of compiler flags
C_INC flag to add an include path
C_OUT flag to specify the object file output
C_EXEOUT flag to specify the executable file output
C_DEF flag to add a define
C_OPT flag to set the optimization level
OPT the optimization level to use
library archiver
----------------
AR library archiver command
RANLIB ranlib command, if necessary
LIB_PREFIX library file prefix
LIB_SUFFIX library file suffix
LINK_OPENGL link flags to link in windowing stuff and opengl
LINK_MATH link flags to link in the system math library
windows specific stuff
----------------------
RC_RULE makefile rule to use for the resource compiler

View File

@ -1,33 +0,0 @@
WINDOWS=1
THIS_DIR1=./
THIS_DIR2=./
DEL_CMD=rm -f
CC=gcc
OBJ=.o
C_FLAGS=-c -Wall -fno-exceptions -fno-rtti -DWIN32 -DCYGWIN
C_INC=-I
C_OUT=-o
C_EXEOUT=-o
C_DEF=-D
C_OPT=-O
AR=ar rc
RANLIB=
LIB_PREFIX=lib
LIB_SUFFIX=.a
LINK_OPENGL=-lstdc++ -lComctl32 -lkernel32 -luser32 -lgdi32 -lOpenGL32 -lGlu32
LINK_MATH=-lm
RC_RULE=windres -I rc -O coff $< $@
ifeq ($(BUILD),release)
OPT=2
C_FLAGS+=-fomit-frame-pointer -ffast-math
endif
ifeq ($(BUILD),debug)
OPT=0
C_FLAGS+=-g
endif
I_AM_GCC=yes

View File

@ -1,34 +0,0 @@
WINDOWS=1
THIS_DIR1=
THIS_DIR2=
DEL_CMD=tools/rm.exe
CC=gcc
OBJ=.o
C_FLAGS=-c -Wall -fno-exceptions -fno-rtti -DWIN32
C_INC=-I
C_OUT=-o
C_EXEOUT=-o
C_DEF=-D
C_OPT=-O
AR=ar rc
RANLIB=
LIB_PREFIX=lib
LIB_SUFFIX=.a
LINK_OPENGL=-lstdc++ -lComctl32 -lkernel32 -luser32 -lgdi32 -lOpenGL32 -lGlu32
LINK_MATH=-lm
RC_RULE=windres -I rc -O coff $< $@
ifeq ($(BUILD),release)
OPT=2
C_FLAGS+=-fomit-frame-pointer -ffast-math
endif
ifeq ($(BUILD),debug)
OPT=0
C_FLAGS+=-g
endif
I_AM_GCC=yes

View File

@ -1,28 +0,0 @@
WINDOWS=1
THIS_DIR1=
THIS_DIR2=
DEL_CMD=tools\\rm
CC=cl /nologo /DWIN32
OBJ=.obj
C_FLAGS=/c /GR- /GX- /W3 /GF
C_INC=/I
C_OUT=/Fo
C_EXEOUT=/Fe
C_DEF=/D
C_OPT=/O
AR=lib /nologo /OUT:
RANLIB=
LIB_PREFIX=
LIB_SUFFIX=.lib
LINK_OPENGL=Comctl32.lib kernel32.lib user32.lib gdi32.lib OpenGL32.lib Glu32.lib
LINK_MATH=
RC_RULE=rc /r /fo$@ $<
ifeq ($(BUILD),release)
OPT=2
C_FLAGS+=/Oy
endif
ifeq ($(BUILD),debug)
OPT=d
endif

View File

@ -1,30 +0,0 @@
# To build ODE using VC++ from the cygwin make environment
WINDOWS=1
THIS_DIR1=./
THIS_DIR2=
DEL_CMD=rm -f
CC=cl /nologo /DWIN32
OBJ=.obj
C_FLAGS=/c /GR- /GX- /W3 /GF
C_INC=/I
C_OUT=/Fo
C_EXEOUT=/Fe
C_DEF=/D
C_OPT=/O
AR=lib /nologo /OUT:
RANLIB=
LIB_PREFIX=
LIB_SUFFIX=.lib
LINK_OPENGL=Comctl32.lib kernel32.lib user32.lib gdi32.lib OpenGL32.lib Glu32.lib
LINK_MATH=
RC_RULE=rc /r /fo$@ $<
ifeq ($(BUILD),release)
OPT=2
C_FLAGS+=/Oy
endif
ifeq ($(BUILD),debug)
OPT=d
endif

View File

@ -1,36 +0,0 @@
WINDOWS=1
THIS_DIR1=
THIS_DIR2=
DEL_CMD=tools\rm
CC=cl /nologo /DWIN32
OBJ=.obj
C_FLAGS=/c /GR- /GX- /W3 /GF
C_INC=/I
C_OUT=/Fo
C_EXEOUT=/Fe
C_DEF=/D
C_OPT=/O
AR=lib /nologo /OUT:
RANLIB=
LIB_PREFIX=
LIB_SUFFIX=.lib
LINK_OPENGL=Comctl32.lib kernel32.lib user32.lib gdi32.lib OpenGL32.lib Glu32.lib
LINK_MATH=
RC_RULE=rc /r /fo$@ $<
ifeq ($(BUILD),release)
OPT=2
C_FLAGS+=/Oy
endif
ifeq ($(BUILD),debug)
OPT=d
endif
ifdef OPCODE_DIRECTORY
DEFS_FILE=msvcdefs-trimesh.def
else
DEFS_FILE=msvcdefs.def
endif
ODE_LIB_AR_RULE=link /dll /nologo /SUBSYSTEM:WINDOWS /LIBPATH:"C:\Programme\Micros~2\VC98\Lib" /def:config/$(DEFS_FILE) $(LINK_OPENGL) /OUT:$(patsubst %.lib,%.dll,$@)

View File

@ -1,38 +0,0 @@
# To build ODE.dll using VC++ from the cygwin make environment
WINDOWS=1
THIS_DIR1=./
THIS_DIR2=
DEL_CMD=rm -f
CC=cl /nologo /DWIN32
OBJ=.obj
C_FLAGS=/c /GR- /GX- /W3 /GF
C_INC=/I
C_OUT=/Fo
C_EXEOUT=/Fe
C_DEF=/D
C_OPT=/O
AR=lib /nologo /OUT:
RANLIB=
LIB_PREFIX=
LIB_SUFFIX=.lib
LINK_OPENGL=Comctl32.lib kernel32.lib user32.lib gdi32.lib OpenGL32.lib Glu32.lib
LINK_MATH=
RC_RULE=rc /r /fo$@ $<
ifeq ($(BUILD),release)
OPT=2
C_FLAGS+=/Oy
endif
ifeq ($(BUILD),debug)
OPT=d
endif
ifdef OPCODE_DIRECTORY
DEFS_FILE=msvcdefs-trimesh.def
else
DEFS_FILE=msvcdefs.def
endif
ODE_LIB_AR_RULE=link /dll /nologo /SUBSYSTEM:WINDOWS /LIBPATH:"C:\Programme\Micros~2\VC98\Lib" /def:config/$(DEFS_FILE) $(LINK_OPENGL) /OUT:$(patsubst %.lib,%.dll,$@)

View File

@ -1,31 +0,0 @@
THIS_DIR1=./
THIS_DIR2=./
DEL_CMD=rm -f
CC=g++
OBJ=.o
C_FLAGS=-c -Wall -fno-rtti -fno-exceptions -Wall -I/usr/X11R6/include
C_INC=-I
C_OUT=-o
C_EXEOUT=-o
C_DEF=-D
C_OPT=-O
AR=ar rc
RANLIB=ranlib -s
LIB_PREFIX=lib
LIB_SUFFIX=.a
LINK_OPENGL=-L/usr/X11R6/lib -lX11 -lGL -lGLU
LINK_MATH=-lm
ifeq ($(BUILD),release)
OPT=2
C_FLAGS+=-fomit-frame-pointer -ffast-math
endif
ifeq ($(BUILD),debug)
OPT=0
C_FLAGS+=-g
endif
I_AM_GCC=yes

View File

@ -1,33 +0,0 @@
THIS_DIR1=./
THIS_DIR2=./
DEL_CMD=rm -f
CC=g++
OBJ=.o
C_FLAGS=-c -Wall -fno-rtti -fno-exceptions -Wall
C_INC=-I
C_OUT=-o
C_EXEOUT=-o
C_DEF=-D
C_OPT=-O
AR=ar rc
RANLIB=
LIB_PREFIX=lib
LIB_SUFFIX=.a
LINK_OPENGL=-L/usr/X11R6/lib -L/usr/X11/lib -L/usr/lib/X11R6 -L/usr/lib/X11 -lX11 -lGL -lGLU
LINK_MATH=-lm
ifeq ($(BUILD),release)
OPT=2
C_FLAGS+=-fomit-frame-pointer -ffast-math
endif
ifeq ($(BUILD),debug)
OPT=0
C_FLAGS+=-g
endif
# some other possible flags:
# -malign-double -mpentiumpro -march=pentiumpro
I_AM_GCC=yes

View File

@ -1,25 +0,0 @@
THIS_DIR1=./
THIS_DIR2=./
DEL_CMD=rm -f
CC=CC
OBJ=.o
C_FLAGS=-c
C_INC=-I
C_OUT=-o
C_EXEOUT=-o
C_DEF=-D
C_OPT=-O
AR=ar rc
RANLIB=
LIB_PREFIX=lib
LIB_SUFFIX=.a
LINK_OPENGL=-L/usr/X11R6/lib -L/usr/X11/lib -L/usr/lib/X11R6 -L/usr/lib/X11 -lX11 -lGL -lGLU
LINK_MATH=-lm
ifeq ($(BUILD),release)
OPT=2
endif
ifeq ($(BUILD),debug)
OPT=0
endif

View File

@ -1,660 +0,0 @@
EXPORTS
dAreConnected
dAreConnectedExcluding
dBodyAddForce
dBodyAddForceAtPos
dBodyAddForceAtRelPos
dBodyAddRelForce
dBodyAddRelForceAtPos
dBodyAddRelForceAtRelPos
dBodyAddRelTorque
dBodyAddTorque
dBodyCreate
dBodyDestroy
dBodyDisable
dBodyEnable
dBodyGetAngularVel
dBodyGetAutoDisableAngularThreshold
dBodyGetAutoDisableFlag
dBodyGetAutoDisableLinearThreshold
dBodyGetAutoDisableSteps
dBodyGetAutoDisableTime
dBodyGetData
dBodyGetFiniteRotationAxis
dBodyGetFiniteRotationMode
dBodyGetForce
dBodyGetGravityMode
dBodyGetJoint
dBodyGetLinearVel
dBodyGetMass
dBodyGetNumJoints
dBodyGetPointVel
dBodyGetPosition
dBodyGetPosRelPoint
dBodyGetQuaternion
dBodyGetRelPointPos
dBodyGetRelPointVel
dBodyGetRotation
dBodyGetTorque
dBodyIsEnabled
dBodySetAngularVel
dBodySetAutoDisableAngularThreshold
dBodySetAutoDisableDefaults
dBodySetAutoDisableFlag
dBodySetAutoDisableLinearThreshold
dBodySetAutoDisableSteps
dBodySetAutoDisableTime
dBodySetData
dBodySetFiniteRotationAxis
dBodySetFiniteRotationMode
dBodySetForce
dBodySetGravityMode
dBodySetLinearVel
dBodySetMass
dBodySetPosition
dBodySetQuaternion
dBodySetRotation
dBodySetTorque
dBodyVectorFromWorld
dBodyVectorToWorld
dBoxBox
dBoxTouchesBox
dClearUpperTriangle
dCloseODE
dClosestLineSegmentPoints
dCollide
dCreateBox
dCreateCCylinder
dCreateGeom
dCreateGeomClass
dCreateGeomTransform
dCreatePlane
dCreateRay
dCreateSphere
dCreateTriMesh
dDebug
dDQfromW
dError
dFactorCholesky
dFactorLDLT
dGeomBoxGetLengths
dGeomBoxPointDepth
dGeomBoxSetLengths
dGeomCCylinderGetParams
dGeomCCylinderPointDepth
dGeomCCylinderSetParams
dGeomDestroy
dGeomDisable
dGeomEnable
dGeomGetAABB
dGeomGetBody
dGeomGetCategoryBits
dGeomGetClass
dGeomGetClassData
dGeomGetCollideBits
dGeomGetData
dGeomGetPosition
dGeomGetQuaternion
dGeomGetRotation
dGeomGetSpace
dGeomIsEnabled
dGeomIsSpace
dGeomPlaneGetParams
dGeomPlanePointDepth
dGeomPlaneSetParams
dGeomRayGet
dGeomRayGetClosestHit
dGeomRayGetLength
dGeomRaySet
dGeomRaySetClosestHit
dGeomRaySetLength
dGeomRaySetParams
dGeomSetBody
dGeomSetCategoryBits
dGeomSetCollideBits
dGeomSetData
dGeomSetPosition
dGeomSetQuaternion
dGeomSetRotation
dGeomSphereGetRadius
dGeomSpherePointDepth
dGeomSphereSetRadius
dGeomTransformGetCleanup
dGeomTransformGetGeom
dGeomTransformGetInfo
dGeomTransformSetCleanup
dGeomTransformSetGeom
dGeomTransformSetInfo
dGeomTriMeshClearTCCache
dGeomTriMeshDataBuildDouble
dGeomTriMeshDataBuildSimple
dGeomTriMeshDataBuildSingle
dGeomTriMeshDataCreate
dGeomTriMeshDataDestroy
dGeomTriMeshEnableTC
dGeomTriMeshGetArrayCallback
dGeomTriMeshGetCallback
dGeomTriMeshGetPoint
dGeomTriMeshGetRayCallback
dGeomTriMeshGetTriangle
dGeomTriMeshGetTriangleCount
dGeomTriMeshIsTCEnabled
dGeomTriMeshSetArrayCallback
dGeomTriMeshSetCallback
dGeomTriMeshSetData
dGeomTriMeshSetRayCallback
dHashSpaceCreate
dHashSpaceGetLevels
dHashSpaceSetLevels
dInfiniteAABB
dInvertPDMatrix
dIsPositiveDefinite
dJointAddAMotorTorques
dJointAddHinge2Torques
dJointAddHingeTorque
dJointAddSliderForce
dJointAddUniversalTorques
dJointAttach
dJointCreateAMotor
dJointCreateBall
dJointCreateContact
dJointCreateFixed
dJointCreateHinge
dJointCreateHinge2
dJointCreateSlider
dJointCreateUniversal
dJointDestroy
dJointGetAMotorAngle
dJointGetAMotorAngleRate
dJointGetAMotorAxis
dJointGetAMotorAxisRel
dJointGetAMotorMode
dJointGetAMotorNumAxes
dJointGetAMotorParam
dJointGetBallAnchor
dJointGetBallAnchor2
dJointGetBody
dJointGetData
dJointGetFeedback
dJointGetHinge2Anchor
dJointGetHinge2Anchor2
dJointGetHinge2Angle1
dJointGetHinge2Angle1Rate
dJointGetHinge2Angle2Rate
dJointGetHinge2Axis1
dJointGetHinge2Axis2
dJointGetHinge2Param
dJointGetHingeAnchor
dJointGetHingeAnchor2
dJointGetHingeAngle
dJointGetHingeAngleRate
dJointGetHingeAxis
dJointGetHingeParam
dJointGetSliderAxis
dJointGetSliderParam
dJointGetSliderPosition
dJointGetSliderPositionRate
dJointGetType
dJointGetUniversalAnchor
dJointGetUniversalAnchor2
dJointGetUniversalAngle1
dJointGetUniversalAngle1Rate
dJointGetUniversalAngle2
dJointGetUniversalAngle2Rate
dJointGetUniversalAxis1
dJointGetUniversalAxis2
dJointGetUniversalParam
dJointGroupCreate
dJointGroupDestroy
dJointGroupEmpty
dJointSetAMotorAngle
dJointSetAMotorAxis
dJointSetAMotorMode
dJointSetAMotorNumAxes
dJointSetAMotorParam
dJointSetBallAnchor
dJointSetData
dJointSetFeedback
dJointSetFixed
dJointSetHinge2Anchor
dJointSetHinge2Axis1
dJointSetHinge2Axis2
dJointSetHinge2Param
dJointSetHingeAnchor
dJointSetHingeAxis
dJointSetHingeParam
dJointSetSliderAxis
dJointSetSliderParam
dJointSetUniversalAnchor
dJointSetUniversalAxis1
dJointSetUniversalAxis2
dJointSetUniversalParam
dLDLTAddTL
dLDLTRemove
dMakeRandomMatrix
dMakeRandomVector
dMassAdd
dMassAdjust
dMassRotate
dMassSetBox
dMassSetBoxTotal
dMassSetCappedCylinder
dMassSetCappedCylinderTotal
dMassSetCylinder
dMassSetCylinderTotal
dMassSetParameters
dMassSetSphere
dMassSetSphereTotal
dMassSetZero
dMassTranslate
dMaxDifference
dMessage
dMultiply0
dMultiply1
dMultiply2
dNormalize3
dNormalize4
dPlaneSpace
dQFromAxisAndAngle
dQfromR
dQMultiply0
dQMultiply1
dQMultiply2
dQMultiply3
dQSetIdentity
dQuadTreeSpaceCreate
dRandGetSeed
dRandInt
dRandReal
dRandSetSeed
dRemoveRowCol
dRFrom2Axes
dRFromAxisAndAngle
dRFromEulerAngles
dRfromQ
dRFromZAxis
dRSetIdentity
dSetDebugHandler
dSetErrorHandler
dSetMessageHandler
dSetZero
dSimpleSpaceCreate
dSolveCholesky
dSolveLDLT
dSpaceAdd
dSpaceClean
dSpaceCollide
dSpaceCollide2
dSpaceDestroy
dSpaceGetCleanup
dSpaceGetGeom
dSpaceGetNumGeoms
dSpaceQuery
dSpaceRemove
dSpaceSetCleanup
dTestMatrixComparison
dTestRand
dTestSolveLCP
dWorldCreate
dWorldDestroy
dWorldExportDIF
dWorldGetAutoDisableAngularThreshold
dWorldGetAutoDisableFlag
dWorldGetAutoDisableLinearThreshold
dWorldGetAutoDisableSteps
dWorldGetAutoDisableTime
dWorldGetAutoEnableDepthSF1
dWorldGetCFM
dWorldGetERP
dWorldGetGravity
dWorldImpulseToForce
dWorldSetAutoDisableAngularThreshold
dWorldSetAutoDisableFlag
dWorldSetAutoDisableLinearThreshold
dWorldSetAutoDisableSteps
dWorldSetAutoDisableTime
dWorldSetAutoEnableDepthSF1
dWorldSetCFM
dWorldSetERP
dWorldSetGravity
dWorldStep
dWorldStepFast1
dWorldQuickStep
dWorldSetQuickStepNumIterations
dWorldGetQuickStepNumIterations
dWorldSetQuickStepW
dWorldGetQuickStepW
dWorldSetContactMaxCorrectingVel
dWorldGetContactMaxCorrectingVel
dWorldSetContactSurfaceLayer
dWorldGetContactSurfaceLayer

View File

@ -1,622 +0,0 @@
EXPORTS
dAreConnected
dAreConnectedExcluding
dBodyAddForce
dBodyAddForceAtPos
dBodyAddForceAtRelPos
dBodyAddRelForce
dBodyAddRelForceAtPos
dBodyAddRelForceAtRelPos
dBodyAddRelTorque
dBodyAddTorque
dBodyCreate
dBodyDestroy
dBodyDisable
dBodyEnable
dBodyGetAngularVel
dBodyGetAutoDisableAngularThreshold
dBodyGetAutoDisableFlag
dBodyGetAutoDisableLinearThreshold
dBodyGetAutoDisableSteps
dBodyGetAutoDisableTime
dBodyGetData
dBodyGetFiniteRotationAxis
dBodyGetFiniteRotationMode
dBodyGetForce
dBodyGetGravityMode
dBodyGetJoint
dBodyGetLinearVel
dBodyGetMass
dBodyGetNumJoints
dBodyGetPointVel
dBodyGetPosition
dBodyGetPosRelPoint
dBodyGetQuaternion
dBodyGetRelPointPos
dBodyGetRelPointVel
dBodyGetRotation
dBodyGetTorque
dBodyIsEnabled
dBodySetAngularVel
dBodySetAutoDisableAngularThreshold
dBodySetAutoDisableDefaults
dBodySetAutoDisableFlag
dBodySetAutoDisableLinearThreshold
dBodySetAutoDisableSteps
dBodySetAutoDisableTime
dBodySetData
dBodySetFiniteRotationAxis
dBodySetFiniteRotationMode
dBodySetForce
dBodySetGravityMode
dBodySetLinearVel
dBodySetMass
dBodySetPosition
dBodySetQuaternion
dBodySetRotation
dBodySetTorque
dBodyVectorFromWorld
dBodyVectorToWorld
dBoxBox
dBoxTouchesBox
dClearUpperTriangle
dCloseODE
dClosestLineSegmentPoints
dCollide
dCreateBox
dCreateCCylinder
dCreateGeom
dCreateGeomClass
dCreateGeomTransform
dCreatePlane
dCreateRay
dCreateSphere
dDebug
dDQfromW
dError
dFactorCholesky
dFactorLDLT
dGeomBoxGetLengths
dGeomBoxPointDepth
dGeomBoxSetLengths
dGeomCCylinderGetParams
dGeomCCylinderPointDepth
dGeomCCylinderSetParams
dGeomDestroy
dGeomDisable
dGeomEnable
dGeomGetAABB
dGeomGetBody
dGeomGetCategoryBits
dGeomGetClass
dGeomGetClassData
dGeomGetCollideBits
dGeomGetData
dGeomGetPosition
dGeomGetQuaternion
dGeomGetRotation
dGeomGetSpace
dGeomIsEnabled
dGeomIsSpace
dGeomPlaneGetParams
dGeomPlanePointDepth
dGeomPlaneSetParams
dGeomRayGet
dGeomRayGetClosestHit
dGeomRayGetLength
dGeomRaySet
dGeomRaySetClosestHit
dGeomRaySetLength
dGeomRaySetParams
dGeomSetBody
dGeomSetCategoryBits
dGeomSetCollideBits
dGeomSetData
dGeomSetPosition
dGeomSetQuaternion
dGeomSetRotation
dGeomSphereGetRadius
dGeomSpherePointDepth
dGeomSphereSetRadius
dGeomTransformGetCleanup
dGeomTransformGetGeom
dGeomTransformGetInfo
dGeomTransformSetCleanup
dGeomTransformSetGeom
dGeomTransformSetInfo
dHashSpaceCreate
dHashSpaceGetLevels
dHashSpaceSetLevels
dInfiniteAABB
dInvertPDMatrix
dIsPositiveDefinite
dJointAddAMotorTorques
dJointAddHinge2Torques
dJointAddHingeTorque
dJointAddSliderForce
dJointAddUniversalTorques
dJointAttach
dJointCreateAMotor
dJointCreateBall
dJointCreateContact
dJointCreateFixed
dJointCreateHinge
dJointCreateHinge2
dJointCreateSlider
dJointCreateUniversal
dJointDestroy
dJointGetAMotorAngle
dJointGetAMotorAngleRate
dJointGetAMotorAxis
dJointGetAMotorAxisRel
dJointGetAMotorMode
dJointGetAMotorNumAxes
dJointGetAMotorParam
dJointGetBallAnchor
dJointGetBallAnchor2
dJointGetBody
dJointGetData
dJointGetFeedback
dJointGetHinge2Anchor
dJointGetHinge2Anchor2
dJointGetHinge2Angle1
dJointGetHinge2Angle1Rate
dJointGetHinge2Angle2Rate
dJointGetHinge2Axis1
dJointGetHinge2Axis2
dJointGetHinge2Param
dJointGetHingeAnchor
dJointGetHingeAnchor2
dJointGetHingeAngle
dJointGetHingeAngleRate
dJointGetHingeAxis
dJointGetHingeParam
dJointGetSliderAxis
dJointGetSliderParam
dJointGetSliderPosition
dJointGetSliderPositionRate
dJointGetType
dJointGetUniversalAnchor
dJointGetUniversalAnchor2
dJointGetUniversalAngle1
dJointGetUniversalAngle1Rate
dJointGetUniversalAngle2
dJointGetUniversalAngle2Rate
dJointGetUniversalAxis1
dJointGetUniversalAxis2
dJointGetUniversalParam
dJointGroupCreate
dJointGroupDestroy
dJointGroupEmpty
dJointSetAMotorAngle
dJointSetAMotorAxis
dJointSetAMotorMode
dJointSetAMotorNumAxes
dJointSetAMotorParam
dJointSetBallAnchor
dJointSetData
dJointSetFeedback
dJointSetFixed
dJointSetHinge2Anchor
dJointSetHinge2Axis1
dJointSetHinge2Axis2
dJointSetHinge2Param
dJointSetHingeAnchor
dJointSetHingeAxis
dJointSetHingeParam
dJointSetSliderAxis
dJointSetSliderParam
dJointSetUniversalAnchor
dJointSetUniversalAxis1
dJointSetUniversalAxis2
dJointSetUniversalParam
dLDLTAddTL
dLDLTRemove
dMakeRandomMatrix
dMakeRandomVector
dMassAdd
dMassAdjust
dMassRotate
dMassSetBox
dMassSetBoxTotal
dMassSetCappedCylinder
dMassSetCappedCylinderTotal
dMassSetCylinder
dMassSetCylinderTotal
dMassSetParameters
dMassSetSphere
dMassSetSphereTotal
dMassSetZero
dMassTranslate
dMaxDifference
dMessage
dMultiply0
dMultiply1
dMultiply2
dNormalize3
dNormalize4
dPlaneSpace
dQFromAxisAndAngle
dQfromR
dQMultiply0
dQMultiply1
dQMultiply2
dQMultiply3
dQSetIdentity
dQuadTreeSpaceCreate
dRandGetSeed
dRandInt
dRandReal
dRandSetSeed
dRemoveRowCol
dRFrom2Axes
dRFromAxisAndAngle
dRFromEulerAngles
dRfromQ
dRFromZAxis
dRSetIdentity
dSetDebugHandler
dSetErrorHandler
dSetMessageHandler
dSetZero
dSimpleSpaceCreate
dSolveCholesky
dSolveLDLT
dSpaceAdd
dSpaceClean
dSpaceCollide
dSpaceCollide2
dSpaceDestroy
dSpaceGetCleanup
dSpaceGetGeom
dSpaceGetNumGeoms
dSpaceQuery
dSpaceRemove
dSpaceSetCleanup
dTestMatrixComparison
dTestRand
dTestSolveLCP
dWorldCreate
dWorldDestroy
dWorldExportDIF
dWorldGetAutoDisableAngularThreshold
dWorldGetAutoDisableFlag
dWorldGetAutoDisableLinearThreshold
dWorldGetAutoDisableSteps
dWorldGetAutoDisableTime
dWorldGetAutoEnableDepthSF1
dWorldGetCFM
dWorldGetERP
dWorldGetGravity
dWorldImpulseToForce
dWorldSetAutoDisableAngularThreshold
dWorldSetAutoDisableFlag
dWorldSetAutoDisableLinearThreshold
dWorldSetAutoDisableSteps
dWorldSetAutoDisableTime
dWorldSetAutoEnableDepthSF1
dWorldSetCFM
dWorldSetERP
dWorldSetGravity
dWorldStep
dWorldStepFast1
dWorldQuickStep
dWorldSetQuickStepNumIterations
dWorldGetQuickStepNumIterations
dWorldSetQuickStepW
dWorldGetQuickStepW
dWorldSetContactMaxCorrectingVel
dWorldGetContactMaxCorrectingVel
dWorldSetContactSurfaceLayer
dWorldGetContactSurfaceLayer

View File

@ -1,44 +0,0 @@
# ODE user settings: the following variables must be set by the user
# (1) the platform to use. this name should have a corresponding
# makefile.PLATFORM file. currently supported platforms are:
# msvc microsoft visual C/C++
# msvc-dll microsoft visual C/C++, create a DLL
# mingw minimalist GNU for windows
# cygwin cygnus GNU for windows
# unix-gcc GNU gcc on unix
# unix-generic generic unix compiler. you may need to edit the CC
# variable in makefile.unix-generic
# osx Mac OS-X, with the gnu compiler.
PLATFORM=unix-gcc
# (2) the floating point precision to use (either "SINGLE" or "DOUBLE")
#PRECISION=SINGLE
PRECISION=DOUBLE
# (3) the library type to build (either "debug" if you are doing development,
# or "release" for the optimized library)
#BUILD=debug
BUILD=release
# (4) if you are using an old version of MS-Windows that has command line
# length limitations then you will need to set this to "1". otherwise,
# leave it at "0".
WINDOWS16=0
# (5) If you want to use the TriList (triangle mesh) geometry class, you must
# have the OPCODE library installed somewhere. If this is the case then
# uncomment the following variable and set it to point to the directory
# where OPCODE is installed (note that you must have already compiled
# OPCODE, ODE's build system will not do that for you).
# See http://www.codercorner.com/Opcode.htm for more information about
# OPCODE. A recent version of OPCODE is provided in the ODE distribution
# in the OPCODE subdirectory. This code was originally written for and
# compiled on windows, but it has been ported so that it should compile
# under unix/gcc too. Your mileage may vary.
#OPCODE_DIRECTORY=OPCODE

View File

@ -1,125 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <stdio.h>
#include <math.h>
#include <drawstuff/drawstuff.h>
#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif
void start()
{
// adjust the starting viewpoint a bit
float xyz[3],hpr[3];
dsGetViewpoint (xyz,hpr);
hpr[0] += 7;
dsSetViewpoint (xyz,hpr);
}
void simLoop (int pause)
{
float pos[3];
float R[12];
static float a = 0;
if (!pause) a += 0.02f;
if (a > (2*M_PI)) a -= (float) (2*M_PI);
float ca = (float) cos(a);
float sa = (float) sin(a);
dsSetTexture (DS_WOOD);
float b = (a > M_PI) ? (2*(a-(float)M_PI)) : a*2;
pos[0] = -0.3f;
pos[1] = 0;
pos[2] = (float) (0.1f*(2*M_PI*b - b*b) + 0.65f);
R[0] = ca; R[1] = 0; R[2] = -sa;
R[4] = 0; R[5] = 1; R[6] = 0;
R[8] = sa; R[9] = 0; R[10] = ca;
dsSetColor (1,0.8f,0.6f);
dsDrawSphere (pos,R,0.3f);
dsSetTexture (DS_NONE);
pos[0] = -0.2f;
pos[1] = 0.8f;
pos[2] = 0.4f;
R[0] = ca; R[1] = -sa; R[2] = 0;
R[4] = sa; R[5] = ca; R[6] = 0;
R[8] = 0; R[9] = 0; R[10] = 1;
float sides[3] = {0.1f,0.4f,0.8f};
dsSetColor (0.6f,0.6f,1);
dsDrawBox (pos,R,sides);
dsSetTexture (DS_WOOD);
float r = 0.3f; // cylinder radius
float d = (float)cos(a*2) * 0.4f;
float cd = (float)cos(-d/r);
float sd = (float)sin(-d/r);
pos[0] = -0.2f;
pos[1] = -1 + d;
pos[2] = 0.3f;
R[0] = 0; R[1] = 0; R[2] = -1;
R[4] = -sd; R[5] = cd; R[6] = 0;
R[8] = cd; R[9] = sd; R[10] = 0;
dsSetColor (0.4f,1,1);
dsDrawCylinder (pos,R,0.8f,r);
pos[0] = 0;
pos[1] = 0;
pos[2] = 0.2f;
R[0] = 0; R[1] = sa; R[2] = -ca;
R[4] = 0; R[5] = ca; R[6] = sa;
R[8] = 1; R[9] = 0; R[10] = 0;
dsSetColor (1,0.9f,0.2f);
dsDrawCappedCylinder (pos,R,0.8f,0.2f);
}
void command (int cmd)
{
dsPrint ("received command %d (`%c')\n",cmd,cmd);
}
int main (int argc, char **argv)
{
// setup pointers to callback functions
dsFunctions fn;
fn.version = DS_VERSION;
fn.start = &start;
fn.step = &simLoop;
fn.command = command;
fn.stop = 0;
fn.path_to_textures = 0; // uses default
// run simulation
dsSimulationLoop (argc,argv,400,400,&fn);
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,50 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/* functions supplied and used by the platform specific code */
#ifndef __DS_INTERNAL_H
#define __DS_INTERNAL_H
#include "drawstuff/drawstuff.h"
// supplied by platform specific code
void dsPlatformSimLoop (int window_width, int window_height,
dsFunctions *fn, int initial_pause);
// used by platform specific code
void dsStartGraphics (int width, int height, dsFunctions *fn);
void dsDrawFrame (int width, int height, dsFunctions *fn, int pause);
void dsStopGraphics();
void dsMotion (int mode, int deltax, int deltay);
int dsGetShadows();
void dsSetShadows (int a);
int dsGetTextures();
void dsSetTextures (int a);
#endif

View File

@ -1,28 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by resources.rc
//
#define IDD_MSGDLG 101
#define IDR_MENU1 102
#define IDD_ABOUT 103
#define IDR_ACCELERATOR1 104
#define IDC_LIST1 1000
#define IDM_EXIT 40001
#define IDM_ABOUT 40002
#define IDM_PAUSE 40003
#define IDM_PERF_MONITOR 40004
#define IDM_SHADOWS 40005
#define IDM_TEXTURES 40006
#define IDM_SAVE_SETTINGS 40007
#define IDM_SINGLE_STEP 40008
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40009
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,153 +0,0 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
//#include "afxres.h"
// added by RLS to make this work with windres
#include "winresrc.h"
#define IDC_STATIC (-1)
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUT DIALOG DISCARDABLE 0, 0, 257, 105
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,200,84,50,14
LTEXT "Simulation test environment",IDC_STATIC,7,7,243,8
LTEXT "Change the camera position by clicking + dragging in the main window.",
IDC_STATIC,7,24,243,8
LTEXT "Left button - pan and tilt.",IDC_STATIC,25,37,225,8
LTEXT "Right button - forward and sideways.",IDC_STATIC,25,48,
225,8
LTEXT "Left + Right button (or middle button) - sideways and up.",
IDC_STATIC,25,59,225,8
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
//"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU1 MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Exit\tCtrl+X", IDM_EXIT
END
POPUP "&Simulation"
BEGIN
MENUITEM "&Pause\tCtrl+P", IDM_PAUSE
MENUITEM "Single Step\tCtrl+O", IDM_SINGLE_STEP
MENUITEM "Performance &Monitor", IDM_PERF_MONITOR
MENUITEM SEPARATOR
MENUITEM "&Shadows\tCtrl+S", IDM_SHADOWS, CHECKED
MENUITEM "&Textures\tCtrl+T", IDM_TEXTURES, CHECKED
MENUITEM SEPARATOR
MENUITEM "S&ave Settings", IDM_SAVE_SETTINGS
END
POPUP "&Help"
BEGIN
MENUITEM "&About", IDM_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 250
VERTGUIDE, 25
TOPMARGIN, 7
BOTTOMMARGIN, 98
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE
BEGIN
"O", IDM_SINGLE_STEP, VIRTKEY, CONTROL, NOINVERT
"P", IDM_PAUSE, VIRTKEY, CONTROL, NOINVERT
"S", IDM_SHADOWS, VIRTKEY, CONTROL, NOINVERT
"T", IDM_TEXTURES, VIRTKEY, CONTROL, NOINVERT
"X", IDM_EXIT, VIRTKEY, CONTROL, NOINVERT
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,486 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifdef WIN32 // this prevents warnings when dependencies built
#include <windows.h>
#endif
#include <ode/config.h>
#include <GL/gl.h>
#include "resource.h"
#include "internal.h"
//***************************************************************************
// application globals
static HINSTANCE ghInstance = 0;
static int gnCmdShow = 0;
static HACCEL accelerators = 0;
static HWND main_window = 0;
//***************************************************************************
// error and message handling
static void errorBox (char *title, char *msg, va_list ap)
{
char s[1000];
vsprintf (s,msg,ap);
MessageBox (0,s,title,MB_OK | MB_APPLMODAL | MB_ICONEXCLAMATION);
}
static void dsWarning (char *msg, ...)
{
va_list ap;
va_start (ap,msg);
errorBox ("Warning",msg,ap);
}
extern "C" void dsError (char *msg, ...)
{
va_list ap;
va_start (ap,msg);
errorBox ("Error",msg,ap);
exit (1);
}
extern "C" void dsDebug (char *msg, ...)
{
va_list ap;
va_start (ap,msg);
errorBox ("INTERNAL ERROR",msg,ap);
// *((char *)0) = 0; ... commit SEGVicide ?
abort();
exit (1); // should never get here, but just in case...
}
extern "C" void dsPrint (char *msg, ...)
{
va_list ap;
va_start (ap,msg);
vprintf (msg,ap);
}
//***************************************************************************
// rendering thread
// globals used to communicate with rendering thread
static volatile int renderer_run = 1;
static volatile int renderer_pause = 0; // 0=run, 1=pause
static volatile int renderer_ss = 0; // single step command
static volatile int renderer_width = 1;
static volatile int renderer_height = 1;
static dsFunctions *renderer_fn = 0;
static volatile HDC renderer_dc = 0;
static volatile int keybuffer[16]; // fifo ring buffer for keypresses
static volatile int keybuffer_head = 0; // index of next key to put in (modified by GUI)
static volatile int keybuffer_tail = 0; // index of next key to take out (modified by renderer)
static void setupRendererGlobals()
{
renderer_run = 1;
renderer_pause = 0;
renderer_ss = 0;
renderer_width = 1;
renderer_height = 1;
renderer_fn = 0;
renderer_dc = 0;
keybuffer[16];
keybuffer_head = 0;
keybuffer_tail = 0;
}
static DWORD WINAPI renderingThread (LPVOID lpParam)
{
// create openGL context and make it current
HGLRC glc = wglCreateContext (renderer_dc);
if (glc==NULL) dsError ("could not create OpenGL context");
if (wglMakeCurrent (renderer_dc,glc) != TRUE)
dsError ("could not make OpenGL context current");
// test openGL capabilities
int maxtsize=0;
glGetIntegerv (GL_MAX_TEXTURE_SIZE,&maxtsize);
if (maxtsize < 128) dsWarning ("max texture size too small (%dx%d)",
maxtsize,maxtsize);
dsStartGraphics (renderer_width,renderer_height,renderer_fn);
if (renderer_fn->start) renderer_fn->start();
while (renderer_run) {
// need to make local copy of renderer_ss to help prevent races
int ss = renderer_ss;
dsDrawFrame (renderer_width,renderer_height,renderer_fn,
renderer_pause && !ss);
if (ss) renderer_ss = 0;
// read keys out of ring buffer and feed them to the command function
while (keybuffer_head != keybuffer_tail) {
if (renderer_fn->command) renderer_fn->command (keybuffer[keybuffer_tail]);
keybuffer_tail = (keybuffer_tail+1) & 15;
}
// swap buffers
SwapBuffers (renderer_dc);
}
if (renderer_fn->stop) renderer_fn->stop();
dsStopGraphics();
// delete openGL context
wglMakeCurrent (NULL,NULL);
wglDeleteContext (glc);
return 123; // magic value used to test for thread termination
}
//***************************************************************************
// window handling
// callback function for "about" dialog box
static LRESULT CALLBACK AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch (wParam) {
case IDOK:
EndDialog (hDlg, TRUE);
return TRUE;
}
break;
}
return FALSE;
}
// callback function for the main window
static LRESULT CALLBACK mainWndProc (HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam)
{
static int button=0,lastx=0,lasty=0;
int ctrl = wParam & MK_CONTROL;
switch (msg) {
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
if (msg==WM_LBUTTONDOWN) button |= 1;
else if (msg==WM_MBUTTONDOWN) button |= 2;
else button |= 4;
lastx = SHORT(LOWORD(lParam));
lasty = SHORT(HIWORD(lParam));
SetCapture (hWnd);
break;
case WM_LBUTTONUP:
case WM_MBUTTONUP:
case WM_RBUTTONUP:
if (msg==WM_LBUTTONUP) button &= ~1;
else if (msg==WM_MBUTTONUP) button &= ~2;
else button &= ~4;
if (button==0) ReleaseCapture();
break;
case WM_MOUSEMOVE: {
int x = SHORT(LOWORD(lParam));
int y = SHORT(HIWORD(lParam));
if (button) dsMotion (button,x-lastx,y-lasty);
lastx = x;
lasty = y;
break;
}
case WM_CHAR: {
if (wParam >= ' ' && wParam <= 126) {
int nexth = (keybuffer_head+1) & 15;
if (nexth != keybuffer_tail) {
keybuffer[keybuffer_head] = wParam;
keybuffer_head = nexth;
}
}
break;
}
case WM_SIZE:
// lParam will contain the size of the *client* area!
renderer_width = LOWORD(lParam);
renderer_height = HIWORD(lParam);
break;
case WM_COMMAND:
switch (wParam & 0xffff) {
case IDM_ABOUT:
DialogBox (ghInstance,MAKEINTRESOURCE(IDD_ABOUT),hWnd,
(DLGPROC) AboutDlgProc);
break;
case IDM_PAUSE: {
renderer_pause ^= 1;
CheckMenuItem (GetMenu(hWnd),IDM_PAUSE,
renderer_pause ? MF_CHECKED : MF_UNCHECKED);
if (renderer_pause) renderer_ss = 0;
break;
}
case IDM_SINGLE_STEP: {
renderer_ss = 1;
break;
}
case IDM_PERF_MONITOR: {
dsWarning ("Performance monitor not yet implemented.");
break;
}
case IDM_TEXTURES: {
static int tex = 1;
tex ^= 1;
CheckMenuItem (GetMenu(hWnd),IDM_TEXTURES,
tex ? MF_CHECKED : MF_UNCHECKED);
dsSetTextures (tex);
break;
}
case IDM_SHADOWS: {
static int shadows = 1;
shadows ^= 1;
CheckMenuItem (GetMenu(hWnd),IDM_SHADOWS,
shadows ? MF_CHECKED : MF_UNCHECKED);
dsSetShadows (shadows);
break;
}
case IDM_SAVE_SETTINGS: {
dsWarning ("\"Save Settings\" not yet implemented.");
break;
}
case IDM_EXIT:
PostQuitMessage (0);
break;
}
break;
case WM_CLOSE:
PostQuitMessage (0);
break;
default:
return (DefWindowProc (hWnd, msg, wParam, lParam));
}
return 0;
}
// this comes from an MSDN example. believe it or not, this is the recommended
// way to get the console window handle.
static HWND GetConsoleHwnd()
{
// the console window title to a "unique" value, then find the window
// that has this title.
char title[1024];
wsprintf (title,"DrawStuff:%d/%d",GetTickCount(),GetCurrentProcessId());
SetConsoleTitle (title);
Sleep(40); // ensure window title has been updated
return FindWindow (NULL,title);
}
static void drawStuffStartup()
{
static int startup_called = 0;
if (startup_called) return;
startup_called = 1;
ghInstance = GetModuleHandleA (NULL);
gnCmdShow = SW_SHOWNORMAL; // @@@ fix this later
// redirect standard I/O to a new console (except on cygwin)
#ifndef CYGWIN
FreeConsole();
if (AllocConsole()==0) dsError ("AllocConsole() failed");
if (freopen ("CONIN$","rt",stdin)==0) dsError ("could not open stdin");
if (freopen ("CONOUT$","wt",stdout)==0) dsError ("could not open stdout");
if (freopen ("CONOUT$","wt",stderr)==0) dsError ("could not open stderr");
BringWindowToTop (GetConsoleHwnd());
SetConsoleTitle ("DrawStuff Messages");
#endif
// register the window class
WNDCLASS wc;
wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
wc.lpfnWndProc = mainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = ghInstance;
wc.hIcon = LoadIcon (NULL,IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL,IDC_ARROW);
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
wc.lpszClassName = "SimAppClass";
if (RegisterClass (&wc)==0) dsError ("could not register window class");
// load accelerators
accelerators = LoadAccelerators (ghInstance,
MAKEINTRESOURCE(IDR_ACCELERATOR1));
if (accelerators==NULL) dsError ("could not load accelerators");
}
void dsPlatformSimLoop (int window_width, int window_height,
dsFunctions *fn, int initial_pause)
{
drawStuffStartup();
setupRendererGlobals();
renderer_pause = initial_pause;
// create window - but first get window size for desired size of client area.
// if this adjustment isn't made then the openGL area will be shifted into
// the nonclient area and determining the frame buffer coordinate from the
// client area coordinate will be hard.
RECT winrect;
winrect.left = 50;
winrect.top = 80;
winrect.right = winrect.left + window_width;
winrect.bottom = winrect.top + window_height;
DWORD style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
AdjustWindowRect (&winrect,style,1);
char title[100];
sprintf (title,"Simulation test environment v%d.%02d",
DS_VERSION >> 8,DS_VERSION & 0xff);
main_window = CreateWindow ("SimAppClass",title,style,
winrect.left,winrect.top,winrect.right-winrect.left,winrect.bottom-winrect.top,
NULL,NULL,ghInstance,NULL);
if (main_window==NULL) dsError ("could not create main window");
ShowWindow (main_window, gnCmdShow);
HDC dc = GetDC (main_window); // get DC for this window
if (dc==NULL) dsError ("could not get window DC");
// set pixel format for DC
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL | // support OpenGL
PFD_DOUBLEBUFFER, // double buffered
PFD_TYPE_RGBA, // RGBA type
24, // 24-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
0, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
32, // 32-bit z-buffer
0, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};
// get the best available match of pixel format for the device context
int iPixelFormat = ChoosePixelFormat (dc,&pfd);
if (iPixelFormat==0)
dsError ("could not find a good OpenGL pixel format");
// set the pixel format of the device context
if (SetPixelFormat (dc,iPixelFormat,&pfd)==FALSE)
dsError ("could not set DC pixel format for OpenGL");
// **********
// start the rendering thread
// set renderer globals
renderer_dc = dc;
renderer_width = window_width;
renderer_height = window_height;
renderer_fn = fn;
DWORD threadId, thirdParam = 0;
HANDLE hThread;
hThread = CreateThread(
NULL, // no security attributes
0, // use default stack size
renderingThread, // thread function
&thirdParam, // argument to thread function
0, // use default creation flags
&threadId); // returns the thread identifier
if (hThread==NULL) dsError ("Could not create rendering thread");
// **********
// start GUI message processing
MSG msg;
while (GetMessage (&msg,main_window,0,0)) {
if (!TranslateAccelerator (main_window,accelerators,&msg)) {
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
// terminate rendering thread
renderer_run = 0;
DWORD ret = WaitForSingleObject (hThread,2000);
if (ret==WAIT_TIMEOUT) dsWarning ("Could not kill rendering thread (1)");
DWORD exitcode=0;
if (!(GetExitCodeThread (hThread,&exitcode) && exitcode == 123))
dsWarning ("Could not kill rendering thread (2)");
CloseHandle (hThread); // dont need thread handle anymore
// destroy window
DestroyWindow (main_window);
}
extern "C" void dsStop()
{
// just calling PostQuitMessage() here wont work, as this function is
// typically called from the rendering thread, not the GUI thread.
// instead we must post the message to the GUI window explicitly.
if (main_window) PostMessage (main_window,WM_QUIT,0,0);
}
//***************************************************************************
// windows entry point
//
// NOTE: WinMain is not guaranteed to be called with MinGW, because MinGW
// always calls main if it is defined and most users of this library will
// define their own main. So the startup functionality is kept in
// zDriverStartup(), which is also called when dsSimulationLoop() is called.
extern "C" int main (int argc, char **argv);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
drawStuffStartup();
return main (0,0); // @@@ should really pass cmd line arguments
}

View File

@ -1,383 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// main window and event handling for X11
#include <ode/config.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
#include <GL/glx.h>
#include <drawstuff/drawstuff.h>
#include <drawstuff/version.h>
#include "internal.h"
//***************************************************************************
// error handling for unix
static void printMessage (char *msg1, char *msg2, va_list ap)
{
fflush (stderr);
fflush (stdout);
fprintf (stderr,"\n%s: ",msg1);
vfprintf (stderr,msg2,ap);
fprintf (stderr,"\n");
fflush (stderr);
}
extern "C" void dsError (char *msg, ...)
{
va_list ap;
va_start (ap,msg);
printMessage ("Error",msg,ap);
exit (1);
}
extern "C" void dsDebug (char *msg, ...)
{
va_list ap;
va_start (ap,msg);
printMessage ("INTERNAL ERROR",msg,ap);
// *((char *)0) = 0; ... commit SEGVicide ?
abort();
}
extern "C" void dsPrint (char *msg, ...)
{
va_list ap;
va_start (ap,msg);
vprintf (msg,ap);
}
//***************************************************************************
// openGL window
// X11 display info
static Display *display=0;
static int screen=0;
static XVisualInfo *visual=0; // best visual for openGL
static Colormap colormap=0; // window's colormap
static Atom wm_protocols_atom = 0;
static Atom wm_delete_window_atom = 0;
// window and openGL
static Window win=0; // X11 window, 0 if not initialized
static int width=0,height=0; // window size
static GLXContext glx_context=0; // openGL rendering context
static int last_key_pressed=0; // last key pressed in the window
static int run=1; // 1 if simulation running
static int pause=0; // 1 if in `pause' mode
static int singlestep=0; // 1 if single step key pressed
static int writeframes=0; // 1 if frame files to be written
static void createMainWindow (int _width, int _height)
{
// create X11 display connection
display = XOpenDisplay (NULL);
if (!display) dsError ("can not open X11 display");
screen = DefaultScreen(display);
// get GL visual
static int attribList[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE,16,
GLX_RED_SIZE,4, GLX_GREEN_SIZE,4,
GLX_BLUE_SIZE,4, None};
visual = glXChooseVisual (display,screen,attribList);
if (!visual) dsError ("no good X11 visual found for OpenGL");
// create colormap
colormap = XCreateColormap (display,RootWindow(display,screen),
visual->visual,AllocNone);
// initialize variables
win = 0;
width = _width;
height = _height;
glx_context = 0;
last_key_pressed = 0;
if (width < 1 || height < 1) dsDebug (0,"bad window width or height");
// create the window
XSetWindowAttributes attributes;
attributes.background_pixel = BlackPixel(display,screen);
attributes.colormap = colormap;
attributes.event_mask = ButtonPressMask | ButtonReleaseMask |
KeyPressMask | KeyReleaseMask | ButtonMotionMask | PointerMotionHintMask |
StructureNotifyMask;
win = XCreateWindow (display,RootWindow(display,screen),50,50,width,height,
0,visual->depth, InputOutput,visual->visual,
CWBackPixel | CWColormap | CWEventMask,&attributes);
// associate a GLX context with the window
glx_context = glXCreateContext (display,visual,0,GL_TRUE);
if (!glx_context) dsError ("can't make an OpenGL context");
// set the window title
XTextProperty window_name;
window_name.value = (unsigned char *) "Simulation";
window_name.encoding = XA_STRING;
window_name.format = 8;
window_name.nitems = strlen((char *) window_name.value);
XSetWMName (display,win,&window_name);
// participate in the window manager 'delete yourself' protocol
wm_protocols_atom = XInternAtom (display,"WM_PROTOCOLS",False);
wm_delete_window_atom = XInternAtom (display,"WM_DELETE_WINDOW",False);
if (XSetWMProtocols (display,win,&wm_delete_window_atom,1)==0)
dsError ("XSetWMProtocols() call failed");
// pop up the window
XMapWindow (display,win);
XSync (display,win);
}
static void destroyMainWindow()
{
glXDestroyContext (display,glx_context);
XDestroyWindow (display,win);
XSync (display,0);
display = 0;
win = 0;
glx_context = 0;
}
static void handleEvent (XEvent &event, dsFunctions *fn)
{
static int mx=0,my=0; // mouse position
static int mode = 0; // mouse button bits
switch (event.type) {
case ButtonPress: {
if (event.xbutton.button == Button1) mode |= 1;
if (event.xbutton.button == Button2) mode |= 2;
if (event.xbutton.button == Button3) mode |= 4;
mx = event.xbutton.x;
my = event.xbutton.y;
}
return;
case ButtonRelease: {
if (event.xbutton.button == Button1) mode &= (~1);
if (event.xbutton.button == Button2) mode &= (~2);
if (event.xbutton.button == Button3) mode &= (~4);
mx = event.xbutton.x;
my = event.xbutton.x;
}
return;
case MotionNotify: {
if (event.xmotion.is_hint) {
Window root,child;
unsigned int mask;
XQueryPointer (display,win,&root,&child,&event.xbutton.x_root,
&event.xbutton.y_root,&event.xbutton.x,&event.xbutton.y,
&mask);
}
dsMotion (mode, event.xmotion.x - mx, event.xmotion.y - my);
mx = event.xmotion.x;
my = event.xmotion.y;
}
return;
case KeyPress: {
KeySym key;
XLookupString (&event.xkey,NULL,0,&key,0);
if ((event.xkey.state & ControlMask) == 0) {
if (key >= ' ' && key <= 126 && fn->command) fn->command (key);
}
else if (event.xkey.state & ControlMask) {
switch (key) {
case 't': case 'T':
dsSetTextures (dsGetTextures() ^ 1);
break;
case 's': case 'S':
dsSetShadows (dsGetShadows() ^ 1);
break;
case 'x': case 'X':
run = 0;
break;
case 'p': case 'P':
pause ^= 1;
singlestep = 0;
break;
case 'o': case 'O':
if (pause) singlestep = 1;
break;
case 'v': case 'V': {
float xyz[3],hpr[3];
dsGetViewpoint (xyz,hpr);
printf ("Viewpoint = (%.4f,%.4f,%.4f,%.4f,%.4f,%.4f)\n",
xyz[0],xyz[1],xyz[2],hpr[0],hpr[1],hpr[2]);
break;
}
case 'w': case 'W':
writeframes ^= 1;
if (writeframes) printf ("Now writing frames to PPM files\n");
break;
}
}
last_key_pressed = key; // a kludgy place to put this...
}
return;
case KeyRelease: {
// hmmmm...
}
return;
case ClientMessage:
if (event.xclient.message_type == wm_protocols_atom &&
event.xclient.format == 32 &&
Atom(event.xclient.data.l[0]) == wm_delete_window_atom) {
run = 0;
return;
}
return;
case ConfigureNotify:
width = event.xconfigure.width;
height = event.xconfigure.height;
return;
}
}
// return the index of the highest bit
static int getHighBitIndex (unsigned int x)
{
int i = 0;
while (x) {
i++;
x >>= 1;
}
return i-1;
}
// shift x left by i, where i can be positive or negative
#define SHIFTL(x,i) (((i) >= 0) ? ((x) << (i)) : ((x) >> (-i)))
static void captureFrame (int num)
{
fprintf (stderr,"capturing frame %04d\n",num);
char s[100];
sprintf (s,"frame/frame%04d.ppm",num);
FILE *f = fopen (s,"wb");
if (!f) dsError ("can't open \"%s\" for writing",s);
fprintf (f,"P6\n%d %d\n255\n",width,height);
XImage *image = XGetImage (display,win,0,0,width,height,~0,ZPixmap);
int rshift = 7 - getHighBitIndex (image->red_mask);
int gshift = 7 - getHighBitIndex (image->green_mask);
int bshift = 7 - getHighBitIndex (image->blue_mask);
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
unsigned long pixel = XGetPixel (image,x,y);
unsigned char b[3];
b[0] = SHIFTL(pixel & image->red_mask,rshift);
b[1] = SHIFTL(pixel & image->green_mask,gshift);
b[2] = SHIFTL(pixel & image->blue_mask,bshift);
fwrite (b,3,1,f);
}
}
fclose (f);
XDestroyImage (image);
}
void dsPlatformSimLoop (int window_width, int window_height, dsFunctions *fn,
int initial_pause)
{
pause = initial_pause;
createMainWindow (window_width, window_height);
glXMakeCurrent (display,win,glx_context);
dsStartGraphics (window_width,window_height,fn);
fprintf (stderr,
"\n"
"Simulation test environment v%d.%02d\n"
" Ctrl-P : pause / unpause (or say `-pause' on command line).\n"
" Ctrl-O : single step when paused.\n"
" Ctrl-T : toggle textures (or say `-notex' on command line).\n"
" Ctrl-S : toggle shadows (or say `-noshadow' on command line).\n"
" Ctrl-V : print current viewpoint coordinates (x,y,z,h,p,r).\n"
" Ctrl-W : write frames to ppm files: frame/frameNNN.ppm\n"
" Ctrl-X : exit.\n"
"\n"
"Change the camera position by clicking + dragging in the window.\n"
" Left button - pan and tilt.\n"
" Right button - forward and sideways.\n"
" Left + Right button (or middle button) - sideways and up.\n"
"\n",DS_VERSION >> 8,DS_VERSION & 0xff);
if (fn->start) fn->start();
int frame = 1;
run = 1;
while (run) {
// read in and process all pending events for the main window
XEvent event;
while (run && XPending (display)) {
XNextEvent (display,&event);
handleEvent (event,fn);
}
dsDrawFrame (width,height,fn,pause && !singlestep);
singlestep = 0;
glFlush();
glXSwapBuffers (display,win);
XSync (display,0);
// capture frames if necessary
if (pause==0 && writeframes) {
captureFrame (frame);
frame++;
}
};
if (fn->stop) fn->stop();
dsStopGraphics();
destroyMainWindow();
}
extern "C" void dsStop()
{
run = 0;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,172 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
Draw Stuff
----------
this is a library for rendering simple 3D objects in a virtual environment.
NOTES
-----
in the virtual world, the z axis is "up" and z=0 is the floor.
the user is able to click+drag in the main window to move the camera:
* left button - pan and tilt.
* right button - forward and sideways.
* left + right button (or middle button) - sideways and up.
*/
#ifndef __DRAWSTUFF_H__
#define __DRAWSTUFF_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <drawstuff/version.h>
/* texture numbers */
#define DS_NONE 0 /* uses the current color instead of a texture */
#define DS_WOOD 1
typedef struct dsFunctions {
int version; /* put DS_VERSION here */
/* version 1 data */
void (*start)(); /* called before sim loop starts */
void (*step) (int pause); /* called before every frame */
void (*command) (int cmd); /* called if a command key is pressed */
void (*stop)(); /* called after sim loop exits */
/* version 2 data */
char *path_to_textures; /* if nonzero, path to texture files */
} dsFunctions;
/* the main() function should fill in the dsFunctions structure then
* call this.
*/
void dsSimulationLoop (int argc, char **argv,
int window_width, int window_height,
struct dsFunctions *fn);
/* these functions display an error message then exit. they take arguments
* in the same way as printf(), except you do not have to add a terminating
* '\n'. Debug() tries to dump core or start the debugger.
*/
void dsError (char *msg, ...);
void dsDebug (char *msg, ...);
/* dsPrint() prints out a message. it takes arguments in the same way as
* printf() (i.e. you must add a '\n' at the end of every line).
*/
void dsPrint (char *msg, ...);
/* set and get the camera position. xyz is the cameria position (x,y,z).
* hpr contains heading, pitch and roll numbers in degrees. heading=0
* points along the x axis, pitch=0 is looking towards the horizon, and
* roll 0 is "unrotated".
*/
void dsSetViewpoint (float xyz[3], float hpr[3]);
void dsGetViewpoint (float xyz[3], float hpr[3]);
/* stop the simulation loop. calling this from within dsSimulationLoop()
* will cause it to exit and return to the caller. it is the same as if the
* user used the exit command. using this outside the loop will have no
* effect.
*/
void dsStop();
/* change the way objects are drawn. these changes will apply to all further
* dsDrawXXX() functions. the texture number must be a DS_xxx texture
* constant. the red, green, and blue number are between 0 and 1.
* alpha is between 0 and 1 - if alpha is not specified it's assubed to be 1.
* the current texture is colored according to the current color.
* at the start of each frame, the texture is reset to none and the color is
* reset to white.
*/
void dsSetTexture (int texture_number);
void dsSetColor (float red, float green, float blue);
void dsSetColorAlpha (float red, float green, float blue, float alpha);
/* draw objects.
* - pos[] is the x,y,z of the center of the object.
* - R[] is a 3x3 rotation matrix for the object, stored by row like this:
* [ R11 R12 R13 0 ]
* [ R21 R22 R23 0 ]
* [ R31 R32 R33 0 ]
* - sides[] is an array of x,y,z side lengths.
* - all cylinders are aligned along the z axis.
*/
void dsDrawBox (const float pos[3], const float R[12], const float sides[3]);
void dsDrawSphere (const float pos[3], const float R[12], float radius);
void dsDrawTriangle (const float pos[3], const float R[12],
const float *v0, const float *v1, const float *v2, int solid);
void dsDrawCylinder (const float pos[3], const float R[12],
float length, float radius);
void dsDrawCone(const float pos[3], const float R[12],
float length, float radius);
void dsDrawCylinder2 (const float pos[3], const float R[12],
float length, float radius,float radius2);
void dsDrawCappedCylinder (const float pos[3], const float R[12],
float length, float radius);
void dsDrawLine (const float pos1[3], const float pos2[3]);
/* these drawing functions are identical to the ones above, except they take
* double arrays for `pos' and `R'.
*/
void dsDrawBoxD (const double pos[3], const double R[12],
const double sides[3]);
void dsDrawSphereD (const double pos[3], const double R[12],
const float radius);
void dsDrawTriangleD (const double pos[3], const double R[12],
const double *v0, const double *v1, const double *v2, int solid);
void dsDrawCylinderD (const double pos[3], const double R[12],
float length, float radius);
void dsDrawCappedCylinderD (const double pos[3], const double R[12],
float length, float radius);
void dsDrawLineD (const double pos1[3], const double pos2[3]);
/* Set the drawn quality of the objects. Higher numbers are higher quality,
* but slower to draw. This must be set before the first objects are drawn to
* be effective.
*/
void dsSetSphereQuality (int n); /* default = 1 */
void dsSetCappedCylinderQuality (int n); /* default = 3 */
/* closing bracket for extern "C" */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,29 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef __VERSION_H
#define __VERSION_H
/* high byte is major version, low byte is minor version */
#define DS_VERSION 0x0002
#endif

View File

@ -1,18 +0,0 @@
this is the public C interface to the ODE library.
all these files should be includable from C, i.e. they should not use any
C++ features. everything should be protected with
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
the only exceptions are the odecpp.h and odecpp_collisioh.h files, which define a C++ wrapper for
the C interface. remember to keep this in sync!

View File

@ -1,190 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_COLLISION_H_
#define _ODE_COLLISION_H_
#include <ode/common.h>
#include <ode/collision_space.h>
#include <ode/contact.h>
#ifdef __cplusplus
extern "C" {
#endif
/* ************************************************************************ */
/* general functions */
void dGeomDestroy (dGeomID);
void dGeomSetData (dGeomID, void *);
void *dGeomGetData (dGeomID);
void dGeomSetBody (dGeomID, dBodyID);
dBodyID dGeomGetBody (dGeomID);
void dGeomSetPosition (dGeomID, dReal x, dReal y, dReal z);
void dGeomSetRotation (dGeomID, const dMatrix3 R);
void dGeomSetQuaternion (dGeomID, const dQuaternion);
const dReal * dGeomGetPosition (dGeomID);
const dReal * dGeomGetRotation (dGeomID);
void dGeomGetQuaternion (dGeomID, dQuaternion result);
void dGeomGetAABB (dGeomID, dReal aabb[6]);
int dGeomIsSpace (dGeomID);
dSpaceID dGeomGetSpace (dGeomID);
int dGeomGetClass (dGeomID);
void dGeomSetCategoryBits (dGeomID, unsigned long bits);
void dGeomSetCollideBits (dGeomID, unsigned long bits);
unsigned long dGeomGetCategoryBits (dGeomID);
unsigned long dGeomGetCollideBits (dGeomID);
void dGeomEnable (dGeomID);
void dGeomDisable (dGeomID);
int dGeomIsEnabled (dGeomID);
/* ************************************************************************ */
/* collision detection */
int dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact,
int skip);
void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback);
void dSpaceCollide2 (dGeomID o1, dGeomID o2, void *data,
dNearCallback *callback);
/* ************************************************************************ */
/* standard classes */
/* the maximum number of user classes that are supported */
enum {
dMaxUserClasses = 4
};
/* class numbers - each geometry object needs a unique number */
enum {
dSphereClass = 0,
dBoxClass,
dCCylinderClass,
dCylinderClass,
dPlaneClass,
dRayClass,
dGeomTransformClass,
dTriMeshClass,
dConvexClass,
dFirstSpaceClass,
dSimpleSpaceClass = dFirstSpaceClass,
dHashSpaceClass,
dQuadTreeSpaceClass,
dLastSpaceClass = dQuadTreeSpaceClass,
dFirstUserClass,
dLastUserClass = dFirstUserClass + dMaxUserClasses - 1,
dGeomNumClasses
};
dGeomID dCreateSphere (dSpaceID space, dReal radius);
void dGeomSphereSetRadius (dGeomID sphere, dReal radius);
dReal dGeomSphereGetRadius (dGeomID sphere);
dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z);
dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz);
void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz);
void dGeomBoxGetLengths (dGeomID box, dVector3 result);
dReal dGeomBoxPointDepth (dGeomID box, dReal x, dReal y, dReal z);
dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d);
void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d);
void dGeomPlaneGetParams (dGeomID plane, dVector4 result);
dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z);
dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length);
void dGeomCCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length);
void dGeomCCylinderGetParams (dGeomID ccylinder, dReal *radius, dReal *length);
dReal dGeomCCylinderPointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z);
dGeomID dCreateRay (dSpaceID space, dReal length);
void dGeomRaySetLength (dGeomID ray, dReal length);
dReal dGeomRayGetLength (dGeomID ray);
void dGeomRaySet (dGeomID ray, dReal px, dReal py, dReal pz,
dReal dx, dReal dy, dReal dz);
void dGeomRayGet (dGeomID ray, dVector3 start, dVector3 dir);
/*
* Set/get ray flags that influence ray collision detection.
* These flags are currently only noticed by the trimesh collider, because
* they can make a major differences there.
*/
void dGeomRaySetParams (dGeomID g, int FirstContact, int BackfaceCull);
void dGeomRayGetParams (dGeomID g, int *FirstContact, int *BackfaceCull);
void dGeomRaySetClosestHit (dGeomID g, int closestHit);
int dGeomRayGetClosestHit (dGeomID g);
#include "collision_trimesh.h"
dGeomID dCreateGeomTransform (dSpaceID space);
void dGeomTransformSetGeom (dGeomID g, dGeomID obj);
dGeomID dGeomTransformGetGeom (dGeomID g);
void dGeomTransformSetCleanup (dGeomID g, int mode);
int dGeomTransformGetCleanup (dGeomID g);
void dGeomTransformSetInfo (dGeomID g, int mode);
int dGeomTransformGetInfo (dGeomID g);
/* ************************************************************************ */
/* utility functions */
void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a2,
const dVector3 b1, const dVector3 b2,
dVector3 cp1, dVector3 cp2);
int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1,
const dVector3 side1, const dVector3 _p2,
const dMatrix3 R2, const dVector3 side2);
void dInfiniteAABB (dGeomID geom, dReal aabb[6]);
void dCloseODE(void);
/* ************************************************************************ */
/* custom classes */
typedef void dGetAABBFn (dGeomID, dReal aabb[6]);
typedef int dColliderFn (dGeomID o1, dGeomID o2,
int flags, dContactGeom *contact, int skip);
typedef dColliderFn * dGetColliderFnFn (int num);
typedef void dGeomDtorFn (dGeomID o);
typedef int dAABBTestFn (dGeomID o1, dGeomID o2, dReal aabb[6]);
typedef struct dGeomClass {
int bytes;
dGetColliderFnFn *collider;
dGetAABBFn *aabb;
dAABBTestFn *aabb_test;
dGeomDtorFn *dtor;
} dGeomClass;
int dCreateGeomClass (const dGeomClass *classptr);
void * dGeomGetClassData (dGeomID);
dGeomID dCreateGeom (int classnum);
/* ************************************************************************ */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,61 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_COLLISION_SPACE_H_
#define _ODE_COLLISION_SPACE_H_
#include <ode/common.h>
#ifdef __cplusplus
extern "C" {
#endif
struct dContactGeom;
typedef void dNearCallback (void *data, dGeomID o1, dGeomID o2);
dSpaceID dSimpleSpaceCreate (dSpaceID space);
dSpaceID dHashSpaceCreate (dSpaceID space);
dSpaceID dQuadTreeSpaceCreate (dSpaceID space, dVector3 Center, dVector3 Extents, int Depth);
void dSpaceDestroy (dSpaceID);
void dHashSpaceSetLevels (dSpaceID space, int minlevel, int maxlevel);
void dHashSpaceGetLevels (dSpaceID space, int *minlevel, int *maxlevel);
void dSpaceSetCleanup (dSpaceID space, int mode);
int dSpaceGetCleanup (dSpaceID space);
void dSpaceAdd (dSpaceID, dGeomID);
void dSpaceRemove (dSpaceID, dGeomID);
int dSpaceQuery (dSpaceID, dGeomID);
void dSpaceClean (dSpaceID);
int dSpaceGetNumGeoms (dSpaceID);
dGeomID dSpaceGetGeom (dSpaceID, int i);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,184 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
* TriMesh code by Erwin de Vries.
*
* Trimesh data.
* This is where the actual vertexdata (pointers), and BV tree is stored.
* Vertices should be single precision!
* This should be more sophisticated, so that the user can easyly implement
* another collision library, but this is a lot of work, and also costs some
* performance because some data has to be copied.
*/
#ifndef _ODE_COLLISION_TRIMESH_H_
#define _ODE_COLLISION_TRIMESH_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* Data storage for triangle meshes.
*/
struct dxTriMeshData;
typedef struct dxTriMeshData* dTriMeshDataID;
/*
* These dont make much sense now, but they will later when we add more
* features.
*/
dTriMeshDataID dGeomTriMeshDataCreate(void);
void dGeomTriMeshDataDestroy(dTriMeshDataID g);
enum { TRIMESH_FACE_NORMALS, TRIMESH_LAST_TRANSFORMATION };
void dGeomTriMeshDataSet(dTriMeshDataID g, int data_id, void* in_data);
void* dGeomTriMeshDataGet(dTriMeshDataID g, int data_id);
/*
* Build TriMesh data with single pricision used in vertex data .
*/
void dGeomTriMeshDataBuildSingle(dTriMeshDataID g,
const void* Vertices, int VertexStride, int VertexCount,
const void* Indices, int IndexCount, int TriStride);
/* same again with a normals array (used as trimesh-trimesh optimization) */
void dGeomTriMeshDataBuildSingle1(dTriMeshDataID g,
const void* Vertices, int VertexStride, int VertexCount,
const void* Indices, int IndexCount, int TriStride,
const void* Normals);
/*
* Build TriMesh data with double pricision used in vertex data .
*/
void dGeomTriMeshDataBuildDouble(dTriMeshDataID g,
const void* Vertices, int VertexStride, int VertexCount,
const void* Indices, int IndexCount, int TriStride);
/* same again with a normals array (used as trimesh-trimesh optimization) */
void dGeomTriMeshDataBuildDouble1(dTriMeshDataID g,
const void* Vertices, int VertexStride, int VertexCount,
const void* Indices, int IndexCount, int TriStride,
const void* Normals);
/*
* Simple build. Single/double precision based on dSINGLE/dDOUBLE!
*/
void dGeomTriMeshDataBuildSimple(dTriMeshDataID g,
const dReal* Vertices, int VertexCount,
const int* Indices, int IndexCount);
/* same again with a normals array (used as trimesh-trimesh optimization) */
void dGeomTriMeshDataBuildSimple1(dTriMeshDataID g,
const dReal* Vertices, int VertexCount,
const int* Indices, int IndexCount,
const int* Normals);
/*
* Per triangle callback. Allows the user to say if he wants a collision with
* a particular triangle.
*/
typedef int dTriCallback(dGeomID TriMesh, dGeomID RefObject, int TriangleIndex);
void dGeomTriMeshSetCallback(dGeomID g, dTriCallback* Callback);
dTriCallback* dGeomTriMeshGetCallback(dGeomID g);
/*
* Per object callback. Allows the user to get the list of triangles in 1
* shot. Maybe we should remove this one.
*/
typedef void dTriArrayCallback(dGeomID TriMesh, dGeomID RefObject, const int* TriIndices, int TriCount);
void dGeomTriMeshSetArrayCallback(dGeomID g, dTriArrayCallback* ArrayCallback);
dTriArrayCallback* dGeomTriMeshGetArrayCallback(dGeomID g);
/*
* Ray callback.
* Allows the user to say if a ray collides with a triangle on barycentric
* coords. The user can for example sample a texture with alpha transparency
* to determine if a collision should occur.
*/
typedef int dTriRayCallback(dGeomID TriMesh, dGeomID Ray, int TriangleIndex, dReal u, dReal v);
void dGeomTriMeshSetRayCallback(dGeomID g, dTriRayCallback* Callback);
dTriRayCallback* dGeomTriMeshGetRayCallback(dGeomID g);
/*
* Trimesh class
* Construction. Callbacks are optional.
*/
dGeomID dCreateTriMesh(dSpaceID space, dTriMeshDataID Data, dTriCallback* Callback, dTriArrayCallback* ArrayCallback, dTriRayCallback* RayCallback);
void dGeomTriMeshSetData(dGeomID g, dTriMeshDataID Data);
dTriMeshDataID dGeomTriMeshGetData(dGeomID g);
// enable/disable/check temporal coherence
void dGeomTriMeshEnableTC(dGeomID g, int geomClass, int enable);
int dGeomTriMeshIsTCEnabled(dGeomID g, int geomClass);
/*
* Clears the internal temporal coherence caches. When a geom has its
* collision checked with a trimesh once, data is stored inside the trimesh.
* With large worlds with lots of seperate objects this list could get huge.
* We should be able to do this automagically.
*/
void dGeomTriMeshClearTCCache(dGeomID g);
/*
* returns the TriMeshDataID
*/
dTriMeshDataID dGeomTriMeshGetTriMeshDataID(dGeomID g);
/*
* Gets a triangle.
*/
void dGeomTriMeshGetTriangle(dGeomID g, int Index, dVector3* v0, dVector3* v1, dVector3* v2);
/*
* Gets the point on the requested triangle and the given barycentric
* coordinates.
*/
void dGeomTriMeshGetPoint(dGeomID g, int Index, dReal u, dReal v, dVector3 Out);
/*
This is how the strided data works:
struct StridedVertex{
dVector3 Vertex;
// Userdata
};
int VertexStride = sizeof(StridedVertex);
struct StridedTri{
int Indices[3];
// Userdata
};
int TriStride = sizeof(StridedTri);
*/
int dGeomTriMeshGetTriangleCount (dGeomID g);
#ifdef __cplusplus
}
#endif
#endif /* _ODE_COLLISION_TRIMESH_H_ */

View File

@ -1,338 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_COMMON_H_
#define _ODE_COMMON_H_
#include <ode/config.h>
#include <ode/error.h>
#ifdef __cplusplus
extern "C" {
#endif
/* configuration stuff */
/* the efficient alignment. most platforms align data structures to some
* number of bytes, but this is not always the most efficient alignment.
* for example, many x86 compilers align to 4 bytes, but on a pentium it
* is important to align doubles to 8 byte boundaries (for speed), and
* the 4 floats in a SIMD register to 16 byte boundaries. many other
* platforms have similar behavior. setting a larger alignment can waste
* a (very) small amount of memory. NOTE: this number must be a power of
* two. this is set to 16 by default.
*/
#define EFFICIENT_ALIGNMENT 16
/* constants */
/* pi and 1/sqrt(2) are defined here if necessary because they don't get
* defined in <math.h> on some platforms (like MS-Windows)
*/
#ifndef M_PI
#define M_PI REAL(3.1415926535897932384626433832795029)
#endif
#ifndef M_SQRT1_2
#define M_SQRT1_2 REAL(0.7071067811865475244008443621048490)
#endif
/* debugging:
* IASSERT is an internal assertion, i.e. a consistency check. if it fails
* we want to know where.
* UASSERT is a user assertion, i.e. if it fails a nice error message
* should be printed for the user.
* AASSERT is an arguments assertion, i.e. if it fails "bad argument(s)"
* is printed.
* DEBUGMSG just prints out a message
*/
#ifndef dNODEBUG
#ifdef __GNUC__
#define dIASSERT(a) if (!(a)) dDebug (d_ERR_IASSERT, \
"assertion \"" #a "\" failed in %s() [%s]",__FUNCTION__,__FILE__);
#define dUASSERT(a,msg) if (!(a)) dDebug (d_ERR_UASSERT, \
msg " in %s()", __FUNCTION__);
#define dDEBUGMSG(msg) dMessage (d_ERR_UASSERT, \
msg " in %s()", __FUNCTION__);
#else
#define dIASSERT(a) if (!(a)) dDebug (d_ERR_IASSERT, \
"assertion \"" #a "\" failed in %s:%d",__FILE__,__LINE__);
#define dUASSERT(a,msg) if (!(a)) dDebug (d_ERR_UASSERT, \
msg " (%s:%d)", __FILE__,__LINE__);
#define dDEBUGMSG(msg) dMessage (d_ERR_UASSERT, \
msg " (%s:%d)", __FILE__,__LINE__);
#endif
#else
#define dIASSERT(a) ;
#define dUASSERT(a,msg) ;
#define dDEBUGMSG(msg) ;
#endif
#define dAASSERT(a) dUASSERT(a,"Bad argument(s)")
/* floating point data type, vector, matrix and quaternion types */
#if defined(dSINGLE)
typedef float dReal;
#elif defined(dDOUBLE)
typedef double dReal;
#else
#error You must #define dSINGLE or dDOUBLE
#endif
/* round an integer up to a multiple of 4, except that 0 and 1 are unmodified
* (used to compute matrix leading dimensions)
*/
#define dPAD(a) (((a) > 1) ? ((((a)-1)|3)+1) : (a))
/* these types are mainly just used in headers */
typedef dReal dVector3[4];
typedef dReal dVector4[4];
typedef dReal dMatrix3[4*3];
typedef dReal dMatrix4[4*4];
typedef dReal dMatrix6[8*6];
typedef dReal dQuaternion[4];
/* precision dependent scalar math functions */
#if defined(dSINGLE)
#define REAL(x) (x ## f) /* form a constant */
#define dRecip(x) ((float)(1.0f/(x))) /* reciprocal */
#define dSqrt(x) ((float)sqrtf(float(x))) /* square root */
#define dRecipSqrt(x) ((float)(1.0f/sqrtf(float(x)))) /* reciprocal square root */
#define dSin(x) ((float)sinf(float(x))) /* sine */
#define dCos(x) ((float)cosf(float(x))) /* cosine */
#define dFabs(x) ((float)fabsf(float(x))) /* absolute value */
#define dAtan2(y,x) ((float)atan2f(float(y),float(x))) /* arc tangent with 2 args */
#define dFMod(a,b) ((float)fmodf(float(a),float(b))) /* modulo */
#define dCopySign(a,b) ((float)copysignf(float(a),float(b)))
#elif defined(dDOUBLE)
#define REAL(x) (x)
#define dRecip(x) (1.0/(x))
#define dSqrt(x) sqrt(x)
#define dRecipSqrt(x) (1.0/sqrt(x))
#define dSin(x) sin(x)
#define dCos(x) cos(x)
#define dFabs(x) fabs(x)
#define dAtan2(y,x) atan2((y),(x))
#define dFMod(a,b) (fmod((a),(b)))
#define dCopySign(a,b) (copysign((a),(b)))
#else
#error You must #define dSINGLE or dDOUBLE
#endif
/* utility */
/* round something up to be a multiple of the EFFICIENT_ALIGNMENT */
#define dEFFICIENT_SIZE(x) ((((x)-1)|(EFFICIENT_ALIGNMENT-1))+1)
/* alloca aligned to the EFFICIENT_ALIGNMENT. note that this can waste
* up to 15 bytes per allocation, depending on what alloca() returns.
*/
#define dALLOCA16(n) \
((char*)dEFFICIENT_SIZE(((size_t)(alloca((n)+(EFFICIENT_ALIGNMENT-1))))))
// Use the error-checking memory allocation system. Becuase this system uses heap
// (malloc) instead of stack (alloca), it is slower. However, it allows you to
// simulate larger scenes, as well as handle out-of-memory errors in a somewhat
// graceful manner
// #define dUSE_MALLOC_FOR_ALLOCA
#ifdef dUSE_MALLOC_FOR_ALLOCA
enum {
d_MEMORY_OK = 0, /* no memory errors */
d_MEMORY_OUT_OF_MEMORY /* malloc failed due to out of memory error */
};
#endif
/* internal object types (all prefixed with `dx') */
struct dxWorld; /* dynamics world */
struct dxSpace; /* collision space */
struct dxBody; /* rigid body (dynamics object) */
struct dxGeom; /* geometry (collision object) */
struct dxJoint;
struct dxJointNode;
struct dxJointGroup;
typedef struct dxWorld *dWorldID;
typedef struct dxSpace *dSpaceID;
typedef struct dxBody *dBodyID;
typedef struct dxGeom *dGeomID;
typedef struct dxJoint *dJointID;
typedef struct dxJointGroup *dJointGroupID;
/* error numbers */
enum {
d_ERR_UNKNOWN = 0, /* unknown error */
d_ERR_IASSERT, /* internal assertion failed */
d_ERR_UASSERT, /* user assertion failed */
d_ERR_LCP /* user assertion failed */
};
/* joint type numbers */
enum {
dJointTypeNone = 0, /* or "unknown" */
dJointTypeBall,
dJointTypeHinge,
dJointTypeSlider,
dJointTypeContact,
dJointTypeUniversal,
dJointTypeHinge2,
dJointTypeFixed,
dJointTypeNull,
dJointTypeAMotor
};
/* an alternative way of setting joint parameters, using joint parameter
* structures and member constants. we don't actually do this yet.
*/
/*
typedef struct dLimot {
int mode;
dReal lostop, histop;
dReal vel, fmax;
dReal fudge_factor;
dReal bounce, soft;
dReal suspension_erp, suspension_cfm;
} dLimot;
enum {
dLimotLoStop = 0x0001,
dLimotHiStop = 0x0002,
dLimotVel = 0x0004,
dLimotFMax = 0x0008,
dLimotFudgeFactor = 0x0010,
dLimotBounce = 0x0020,
dLimotSoft = 0x0040
};
*/
/* standard joint parameter names. why are these here? - because we don't want
* to include all the joint function definitions in joint.cpp. hmmmm.
* MSVC complains if we call D_ALL_PARAM_NAMES_X with a blank second argument,
* which is why we have the D_ALL_PARAM_NAMES macro as well. please copy and
* paste between these two.
*/
#define D_ALL_PARAM_NAMES(start) \
/* parameters for limits and motors */ \
dParamLoStop = start, \
dParamHiStop, \
dParamVel, \
dParamFMax, \
dParamFudgeFactor, \
dParamBounce, \
dParamCFM, \
dParamStopERP, \
dParamStopCFM, \
/* parameters for suspension */ \
dParamSuspensionERP, \
dParamSuspensionCFM,
#define D_ALL_PARAM_NAMES_X(start,x) \
/* parameters for limits and motors */ \
dParamLoStop ## x = start, \
dParamHiStop ## x, \
dParamVel ## x, \
dParamFMax ## x, \
dParamFudgeFactor ## x, \
dParamBounce ## x, \
dParamCFM ## x, \
dParamStopERP ## x, \
dParamStopCFM ## x, \
/* parameters for suspension */ \
dParamSuspensionERP ## x, \
dParamSuspensionCFM ## x,
enum {
D_ALL_PARAM_NAMES(0)
D_ALL_PARAM_NAMES_X(0x100,2)
D_ALL_PARAM_NAMES_X(0x200,3)
/* add a multiple of this constant to the basic parameter numbers to get
* the parameters for the second, third etc axes.
*/
dParamGroup=0x100
};
/* angular motor mode numbers */
enum{
dAMotorUser = 0,
dAMotorEuler = 1
};
/* joint force feedback information */
typedef struct dJointFeedback {
dVector3 f1; /* force applied to body 1 */
dVector3 t1; /* torque applied to body 1 */
dVector3 f2; /* force applied to body 2 */
dVector3 t2; /* torque applied to body 2 */
} dJointFeedback;
/* private functions that must be implemented by the collision library:
* (1) indicate that a geom has moved, (2) get the next geom in a body list.
* these functions are called whenever the position of geoms connected to a
* body have changed, e.g. with dBodySetPosition(), dBodySetRotation(), or
* when the ODE step function updates the body state.
*/
void dGeomMoved (dGeomID);
dGeomID dGeomGetBodyNext (dGeomID);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,40 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_COMPATIBILITY_H_
#define _ODE_COMPATIBILITY_H_
/*
* ODE's backward compatibility system ensures that as ODE's API
* evolves, user code will not break.
*/
/*
* These new rotation function names are more consistent with the
* rest of the API.
*/
#define dQtoR(q,R) dRfromQ((R),(q))
#define dRtoQ(R,q) dQfromR((q),(R))
#define dWtoDQ(w,q,dq) dDQfromW((dq),(w),(q))
#endif

View File

@ -1,53 +0,0 @@
/* per-machine configuration. this file is automatically generated. */
#ifndef _ODE_CONFIG_H_
#define _ODE_CONFIG_H_
/* standard system headers */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdarg.h>
#include <malloc.h>
#include <float.h>
#ifdef __cplusplus
extern "C" {
#endif
/* is this a pentium on a gcc-based platform? */
/* #define PENTIUM 1 -- not a pentium */
/* integer types (we assume int >= 32 bits) */
typedef char int8;
typedef unsigned char uint8;
typedef short int16;
typedef unsigned short uint16;
typedef int int32;
typedef unsigned int uint32;
/* an integer type that we can safely cast a pointer to and
* from without loss of bits.
*/
typedef unsigned int intP;
/* select the base floating point type */
#define dSINGLE 1
/* the floating point infinity */
#define dInfinity FLT_MAX
/* available functions */
#define copysignf _copysign
#define copysign _copysign
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,90 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_CONTACT_H_
#define _ODE_CONTACT_H_
#include <ode/common.h>
#ifdef __cplusplus
extern "C" {
#endif
enum {
dContactMu2 = 0x001,
dContactFDir1 = 0x002,
dContactBounce = 0x004,
dContactSoftERP = 0x008,
dContactSoftCFM = 0x010,
dContactMotion1 = 0x020,
dContactMotion2 = 0x040,
dContactSlip1 = 0x080,
dContactSlip2 = 0x100,
dContactApprox0 = 0x0000,
dContactApprox1_1 = 0x1000,
dContactApprox1_2 = 0x2000,
dContactApprox1 = 0x3000
};
typedef struct dSurfaceParameters {
/* must always be defined */
int mode;
dReal mu;
/* only defined if the corresponding flag is set in mode */
dReal mu2;
dReal bounce;
dReal bounce_vel;
dReal soft_erp;
dReal soft_cfm;
dReal motion1,motion2;
dReal slip1,slip2;
} dSurfaceParameters;
/* contact info set by collision functions */
typedef struct dContactGeom {
dVector3 pos;
dVector3 normal;
dReal depth;
dGeomID g1,g2;
} dContactGeom;
/* contact info used by contact joint */
typedef struct dContact {
dSurfaceParameters surface;
dContactGeom geom;
dVector3 fdir1;
} dContact;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,63 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/* this comes from the `reuse' library. copy any changes back to the source */
#ifndef _ODE_ERROR_H_
#define _ODE_ERROR_H_
#include <ode/config.h>
#ifdef __cplusplus
extern "C" {
#endif
/* all user defined error functions have this type. error and debug functions
* should not return.
*/
typedef void dMessageFunction (int errnum, const char *msg, va_list ap);
/* set a new error, debug or warning handler. if fn is 0, the default handlers
* are used.
*/
void dSetErrorHandler (dMessageFunction *fn);
void dSetDebugHandler (dMessageFunction *fn);
void dSetMessageHandler (dMessageFunction *fn);
/* return the current error, debug or warning handler. if the return value is
* 0, the default handlers are in place.
*/
dMessageFunction *dGetErrorHandler(void);
dMessageFunction *dGetDebugHandler(void);
dMessageFunction *dGetMessageHandler(void);
/* generate a fatal error, debug trap or a message. */
void dError (int num, const char *msg, ...);
void dDebug (int num, const char *msg, ...);
void dMessage (int num, const char *msg, ...);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,32 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_EXPORT_DIF_
#define _ODE_EXPORT_DIF_
#include <ode/common.h>
void dWorldExportDIF (dWorldID w, FILE *file, const char *world_name);
#endif

View File

@ -1,107 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_MASS_H_
#define _ODE_MASS_H_
#include <ode/common.h>
#ifdef __cplusplus
extern "C" {
#endif
struct dMass;
typedef struct dMass dMass;
void dMassSetZero (dMass *);
void dMassSetParameters (dMass *, dReal themass,
dReal cgx, dReal cgy, dReal cgz,
dReal I11, dReal I22, dReal I33,
dReal I12, dReal I13, dReal I23);
void dMassSetSphere (dMass *, dReal density, dReal radius);
void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius);
void dMassSetCappedCylinder (dMass *, dReal density, int direction,
dReal radius, dReal length);
void dMassSetCappedCylinderTotal (dMass *, dReal total_mass, int direction,
dReal radius, dReal length);
void dMassSetCylinder (dMass *, dReal density, int direction,
dReal radius, dReal length);
void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction,
dReal radius, dReal length);
void dMassSetBox (dMass *, dReal density,
dReal lx, dReal ly, dReal lz);
void dMassSetBoxTotal (dMass *, dReal total_mass,
dReal lx, dReal ly, dReal lz);
void dMassAdjust (dMass *, dReal newmass);
void dMassTranslate (dMass *, dReal x, dReal y, dReal z);
void dMassRotate (dMass *, const dMatrix3 R);
void dMassAdd (dMass *a, const dMass *b);
struct dMass {
dReal mass;
dVector4 c;
dMatrix3 I;
#ifdef __cplusplus
dMass()
{ dMassSetZero (this); }
void setZero()
{ dMassSetZero (this); }
void setParameters (dReal themass, dReal cgx, dReal cgy, dReal cgz,
dReal I11, dReal I22, dReal I33,
dReal I12, dReal I13, dReal I23)
{ dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); }
void setSphere (dReal density, dReal radius)
{ dMassSetSphere (this,density,radius); }
void setCappedCylinder (dReal density, int direction, dReal a, dReal b)
{ dMassSetCappedCylinder (this,density,direction,a,b); }
void setBox (dReal density, dReal lx, dReal ly, dReal lz)
{ dMassSetBox (this,density,lx,ly,lz); }
void adjust (dReal newmass)
{ dMassAdjust (this,newmass); }
void translate (dReal x, dReal y, dReal z)
{ dMassTranslate (this,x,y,z); }
void rotate (const dMatrix3 R)
{ dMassRotate (this,R); }
void add (const dMass *b)
{ dMassAdd (this,b); }
#endif
};
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,194 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/* optimized and unoptimized vector and matrix functions */
#ifndef _ODE_MATRIX_H_
#define _ODE_MATRIX_H_
#include <ode/common.h>
#ifdef __cplusplus
extern "C" {
#endif
/* set a vector/matrix of size n to all zeros, or to a specific value. */
void dSetZero (dReal *a, int n);
void dSetValue (dReal *a, int n, dReal value);
/* get the dot product of two n*1 vectors. if n <= 0 then
* zero will be returned (in which case a and b need not be valid).
*/
dReal dDot (const dReal *a, const dReal *b, int n);
/* get the dot products of (a0,b), (a1,b), etc and return them in outsum.
* all vectors are n*1. if n <= 0 then zeroes will be returned (in which case
* the input vectors need not be valid). this function is somewhat faster
* than calling dDot() for all of the combinations separately.
*/
/* NOT INCLUDED in the library for now.
void dMultidot2 (const dReal *a0, const dReal *a1,
const dReal *b, dReal *outsum, int n);
*/
/* matrix multiplication. all matrices are stored in standard row format.
* the digit refers to the argument that is transposed:
* 0: A = B * C (sizes: A:p*r B:p*q C:q*r)
* 1: A = B' * C (sizes: A:p*r B:q*p C:q*r)
* 2: A = B * C' (sizes: A:p*r B:p*q C:r*q)
* case 1,2 are equivalent to saying that the operation is A=B*C but
* B or C are stored in standard column format.
*/
void dMultiply0 (dReal *A, const dReal *B, const dReal *C, int p,int q,int r);
void dMultiply1 (dReal *A, const dReal *B, const dReal *C, int p,int q,int r);
void dMultiply2 (dReal *A, const dReal *B, const dReal *C, int p,int q,int r);
/* do an in-place cholesky decomposition on the lower triangle of the n*n
* symmetric matrix A (which is stored by rows). the resulting lower triangle
* will be such that L*L'=A. return 1 on success and 0 on failure (on failure
* the matrix is not positive definite).
*/
int dFactorCholesky (dReal *A, int n);
/* solve for x: L*L'*x = b, and put the result back into x.
* L is size n*n, b is size n*1. only the lower triangle of L is considered.
*/
void dSolveCholesky (const dReal *L, dReal *b, int n);
/* compute the inverse of the n*n positive definite matrix A and put it in
* Ainv. this is not especially fast. this returns 1 on success (A was
* positive definite) or 0 on failure (not PD).
*/
int dInvertPDMatrix (const dReal *A, dReal *Ainv, int n);
/* check whether an n*n matrix A is positive definite, return 1/0 (yes/no).
* positive definite means that x'*A*x > 0 for any x. this performs a
* cholesky decomposition of A. if the decomposition fails then the matrix
* is not positive definite. A is stored by rows. A is not altered.
*/
int dIsPositiveDefinite (const dReal *A, int n);
/* factorize a matrix A into L*D*L', where L is lower triangular with ones on
* the diagonal, and D is diagonal.
* A is an n*n matrix stored by rows, with a leading dimension of n rounded
* up to 4. L is written into the strict lower triangle of A (the ones are not
* written) and the reciprocal of the diagonal elements of D are written into
* d.
*/
void dFactorLDLT (dReal *A, dReal *d, int n, int nskip);
/* solve L*x=b, where L is n*n lower triangular with ones on the diagonal,
* and x,b are n*1. b is overwritten with x.
* the leading dimension of L is `nskip'.
*/
void dSolveL1 (const dReal *L, dReal *b, int n, int nskip);
/* solve L'*x=b, where L is n*n lower triangular with ones on the diagonal,
* and x,b are n*1. b is overwritten with x.
* the leading dimension of L is `nskip'.
*/
void dSolveL1T (const dReal *L, dReal *b, int n, int nskip);
/* in matlab syntax: a(1:n) = a(1:n) .* d(1:n) */
void dVectorScale (dReal *a, const dReal *d, int n);
/* given `L', a n*n lower triangular matrix with ones on the diagonal,
* and `d', a n*1 vector of the reciprocal diagonal elements of an n*n matrix
* D, solve L*D*L'*x=b where x,b are n*1. x overwrites b.
* the leading dimension of L is `nskip'.
*/
void dSolveLDLT (const dReal *L, const dReal *d, dReal *b, int n, int nskip);
/* given an L*D*L' factorization of an n*n matrix A, return the updated
* factorization L2*D2*L2' of A plus the following "top left" matrix:
*
* [ b a' ] <-- b is a[0]
* [ a 0 ] <-- a is a[1..n-1]
*
* - L has size n*n, its leading dimension is nskip. L is lower triangular
* with ones on the diagonal. only the lower triangle of L is referenced.
* - d has size n. d contains the reciprocal diagonal elements of D.
* - a has size n.
* the result is written into L, except that the left column of L and d[0]
* are not actually modified. see ldltaddTL.m for further comments.
*/
void dLDLTAddTL (dReal *L, dReal *d, const dReal *a, int n, int nskip);
/* given an L*D*L' factorization of a permuted matrix A, produce a new
* factorization for row and column `r' removed.
* - A has size n1*n1, its leading dimension in nskip. A is symmetric and
* positive definite. only the lower triangle of A is referenced.
* A itself may actually be an array of row pointers.
* - L has size n2*n2, its leading dimension in nskip. L is lower triangular
* with ones on the diagonal. only the lower triangle of L is referenced.
* - d has size n2. d contains the reciprocal diagonal elements of D.
* - p is a permutation vector. it contains n2 indexes into A. each index
* must be in the range 0..n1-1.
* - r is the row/column of L to remove.
* the new L will be written within the old L, i.e. will have the same leading
* dimension. the last row and column of L, and the last element of d, are
* undefined on exit.
*
* a fast O(n^2) algorithm is used. see ldltremove.m for further comments.
*/
void dLDLTRemove (dReal **A, const int *p, dReal *L, dReal *d,
int n1, int n2, int r, int nskip);
/* given an n*n matrix A (with leading dimension nskip), remove the r'th row
* and column by moving elements. the new matrix will have the same leading
* dimension. the last row and column of A are untouched on exit.
*/
void dRemoveRowCol (dReal *A, int n, int nskip, int r);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,59 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/* this comes from the `reuse' library. copy any changes back to the source */
#ifndef _ODE_MEMORY_H_
#define _ODE_MEMORY_H_
#include "ode/config.h"
#ifdef __cplusplus
extern "C" {
#endif
/* function types to allocate and free memory */
typedef void * dAllocFunction (size_t size);
typedef void * dReallocFunction (void *ptr, size_t oldsize, size_t newsize);
typedef void dFreeFunction (void *ptr, size_t size);
/* set new memory management functions. if fn is 0, the default handlers are
* used. */
void dSetAllocHandler (dAllocFunction *fn);
void dSetReallocHandler (dReallocFunction *fn);
void dSetFreeHandler (dFreeFunction *fn);
/* get current memory management functions */
dAllocFunction *dGetAllocHandler (void);
dReallocFunction *dGetReallocHandler (void);
dFreeFunction *dGetFreeHandler (void);
/* allocate and free memory. */
void * dAlloc (size_t size);
void * dRealloc (void *ptr, size_t oldsize, size_t newsize);
void dFree (void *ptr, size_t size);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,85 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/* miscellaneous math functions. these are mostly useful for testing */
#ifndef _ODE_MISC_H_
#define _ODE_MISC_H_
#include <ode/common.h>
#ifdef __cplusplus
extern "C" {
#endif
/* return 1 if the random number generator is working. */
int dTestRand(void);
/* return next 32 bit random number. this uses a not-very-random linear
* congruential method.
*/
unsigned long dRand(void);
/* get and set the current random number seed. */
unsigned long dRandGetSeed(void);
void dRandSetSeed (unsigned long s);
/* return a random integer between 0..n-1. the distribution will get worse
* as n approaches 2^32.
*/
int dRandInt (int n);
/* return a random real number between 0..1 */
dReal dRandReal(void);
/* print out a matrix */
#ifdef __cplusplus
void dPrintMatrix (const dReal *A, int n, int m, char *fmt = "%10.4f ",
FILE *f=stdout);
#else
void dPrintMatrix (const dReal *A, int n, int m, char *fmt, FILE *f);
#endif
/* make a random vector with entries between +/- range. A has n elements. */
void dMakeRandomVector (dReal *A, int n, dReal range);
/* make a random matrix with entries between +/- range. A has size n*m. */
void dMakeRandomMatrix (dReal *A, int n, int m, dReal range);
/* clear the upper triangle of a square matrix */
void dClearUpperTriangle (dReal *A, int n);
/* return the maximum element difference between the two n*m matrices */
dReal dMaxDifference (const dReal *A, const dReal *B, int n, int m);
/* return the maximum element difference between the lower triangle of two
* n*n matrices */
dReal dMaxDifferenceLowerTriangle (const dReal *A, const dReal *B, int n);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,269 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_OBJECTS_H_
#define _ODE_OBJECTS_H_
#include <ode/common.h>
#include <ode/mass.h>
#include <ode/contact.h>
#ifdef __cplusplus
extern "C" {
#endif
/* world */
dWorldID dWorldCreate(void);
void dWorldDestroy (dWorldID);
void dWorldSetGravity (dWorldID, dReal x, dReal y, dReal z);
void dWorldGetGravity (dWorldID, dVector3 gravity);
void dWorldSetERP (dWorldID, dReal erp);
dReal dWorldGetERP (dWorldID);
void dWorldSetCFM (dWorldID, dReal cfm);
dReal dWorldGetCFM (dWorldID);
void dWorldStep (dWorldID, dReal stepsize);
void dWorldImpulseToForce (dWorldID, dReal stepsize,
dReal ix, dReal iy, dReal iz, dVector3 force);
/* World QuickStep functions */
void dWorldQuickStep (dWorldID w, dReal stepsize);
void dWorldSetQuickStepNumIterations (dWorldID, int num);
int dWorldGetQuickStepNumIterations (dWorldID);
void dWorldSetQuickStepW (dWorldID, dReal param);
dReal dWorldGetQuickStepW (dWorldID);
/* World contact parameter functions */
void dWorldSetContactMaxCorrectingVel (dWorldID, dReal vel);
dReal dWorldGetContactMaxCorrectingVel (dWorldID);
void dWorldSetContactSurfaceLayer (dWorldID, dReal depth);
dReal dWorldGetContactSurfaceLayer (dWorldID);
/* StepFast1 functions */
void dWorldStepFast1(dWorldID, dReal stepsize, int maxiterations);
void dWorldSetAutoEnableDepthSF1(dWorldID, int autoEnableDepth);
int dWorldGetAutoEnableDepthSF1(dWorldID);
/* Auto-disable functions */
dReal dWorldGetAutoDisableLinearThreshold (dWorldID);
void dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold);
dReal dWorldGetAutoDisableAngularThreshold (dWorldID);
void dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold);
int dWorldGetAutoDisableSteps (dWorldID);
void dWorldSetAutoDisableSteps (dWorldID, int steps);
dReal dWorldGetAutoDisableTime (dWorldID);
void dWorldSetAutoDisableTime (dWorldID, dReal time);
int dWorldGetAutoDisableFlag (dWorldID);
void dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable);
dReal dBodyGetAutoDisableLinearThreshold (dBodyID);
void dBodySetAutoDisableLinearThreshold (dBodyID, dReal linear_threshold);
dReal dBodyGetAutoDisableAngularThreshold (dBodyID);
void dBodySetAutoDisableAngularThreshold (dBodyID, dReal angular_threshold);
int dBodyGetAutoDisableSteps (dBodyID);
void dBodySetAutoDisableSteps (dBodyID, int steps);
dReal dBodyGetAutoDisableTime (dBodyID);
void dBodySetAutoDisableTime (dBodyID, dReal time);
int dBodyGetAutoDisableFlag (dBodyID);
void dBodySetAutoDisableFlag (dBodyID, int do_auto_disable);
void dBodySetAutoDisableDefaults (dBodyID);
/* bodies */
dBodyID dBodyCreate (dWorldID);
void dBodyDestroy (dBodyID);
void dBodySetData (dBodyID, void *data);
void *dBodyGetData (dBodyID);
void dBodySetPosition (dBodyID, dReal x, dReal y, dReal z);
void dBodySetRotation (dBodyID, const dMatrix3 R);
void dBodySetQuaternion (dBodyID, const dQuaternion q);
void dBodySetLinearVel (dBodyID, dReal x, dReal y, dReal z);
void dBodySetAngularVel (dBodyID, dReal x, dReal y, dReal z);
const dReal * dBodyGetPosition (dBodyID);
const dReal * dBodyGetRotation (dBodyID); /* ptr to 4x3 rot matrix */
const dReal * dBodyGetQuaternion (dBodyID);
const dReal * dBodyGetLinearVel (dBodyID);
const dReal * dBodyGetAngularVel (dBodyID);
void dBodySetMass (dBodyID, const dMass *mass);
void dBodyGetMass (dBodyID, dMass *mass);
void dBodyAddForce (dBodyID, dReal fx, dReal fy, dReal fz);
void dBodyAddTorque (dBodyID, dReal fx, dReal fy, dReal fz);
void dBodyAddRelForce (dBodyID, dReal fx, dReal fy, dReal fz);
void dBodyAddRelTorque (dBodyID, dReal fx, dReal fy, dReal fz);
void dBodyAddForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
void dBodyAddForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
void dBodyAddRelForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
void dBodyAddRelForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
const dReal * dBodyGetForce (dBodyID);
const dReal * dBodyGetTorque (dBodyID);
void dBodySetForce (dBodyID b, dReal x, dReal y, dReal z);
void dBodySetTorque (dBodyID b, dReal x, dReal y, dReal z);
void dBodyGetRelPointPos (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result);
void dBodyGetRelPointVel (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result);
void dBodyGetPointVel (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result);
void dBodyGetPosRelPoint (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result);
void dBodyVectorToWorld (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result);
void dBodyVectorFromWorld (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result);
void dBodySetFiniteRotationMode (dBodyID, int mode);
void dBodySetFiniteRotationAxis (dBodyID, dReal x, dReal y, dReal z);
int dBodyGetFiniteRotationMode (dBodyID);
void dBodyGetFiniteRotationAxis (dBodyID, dVector3 result);
int dBodyGetNumJoints (dBodyID b);
dJointID dBodyGetJoint (dBodyID, int index);
void dBodyEnable (dBodyID);
void dBodyDisable (dBodyID);
int dBodyIsEnabled (dBodyID);
void dBodySetGravityMode (dBodyID b, int mode);
int dBodyGetGravityMode (dBodyID b);
/* joints */
dJointID dJointCreateBall (dWorldID, dJointGroupID);
dJointID dJointCreateHinge (dWorldID, dJointGroupID);
dJointID dJointCreateSlider (dWorldID, dJointGroupID);
dJointID dJointCreateContact (dWorldID, dJointGroupID, const dContact *);
dJointID dJointCreateHinge2 (dWorldID, dJointGroupID);
dJointID dJointCreateUniversal (dWorldID, dJointGroupID);
dJointID dJointCreateFixed (dWorldID, dJointGroupID);
dJointID dJointCreateNull (dWorldID, dJointGroupID);
dJointID dJointCreateAMotor (dWorldID, dJointGroupID);
void dJointDestroy (dJointID);
dJointGroupID dJointGroupCreate (int max_size);
void dJointGroupDestroy (dJointGroupID);
void dJointGroupEmpty (dJointGroupID);
void dJointAttach (dJointID, dBodyID body1, dBodyID body2);
void dJointSetData (dJointID, void *data);
void *dJointGetData (dJointID);
int dJointGetType (dJointID);
dBodyID dJointGetBody (dJointID, int index);
void dJointSetFeedback (dJointID, dJointFeedback *);
dJointFeedback *dJointGetFeedback (dJointID);
void dJointSetBallAnchor (dJointID, dReal x, dReal y, dReal z);
void dJointSetBallAnchor2 (dJointID, dReal x, dReal y, dReal z);
void dJointSetHingeAnchor (dJointID, dReal x, dReal y, dReal z);
void dJointSetHingeAnchorDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z);
void dJointSetHingeParam (dJointID, int parameter, dReal value);
void dJointAddHingeTorque(dJointID joint, dReal torque);
void dJointSetSliderAxis (dJointID, dReal x, dReal y, dReal z);
void dJointSetSliderAxisDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
void dJointSetSliderParam (dJointID, int parameter, dReal value);
void dJointAddSliderForce(dJointID joint, dReal force);
void dJointSetHinge2Anchor (dJointID, dReal x, dReal y, dReal z);
void dJointSetHinge2Axis1 (dJointID, dReal x, dReal y, dReal z);
void dJointSetHinge2Axis2 (dJointID, dReal x, dReal y, dReal z);
void dJointSetHinge2Param (dJointID, int parameter, dReal value);
void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2);
void dJointSetUniversalAnchor (dJointID, dReal x, dReal y, dReal z);
void dJointSetUniversalAxis1 (dJointID, dReal x, dReal y, dReal z);
void dJointSetUniversalAxis2 (dJointID, dReal x, dReal y, dReal z);
void dJointSetUniversalParam (dJointID, int parameter, dReal value);
void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2);
void dJointSetFixed (dJointID);
void dJointSetAMotorNumAxes (dJointID, int num);
void dJointSetAMotorAxis (dJointID, int anum, int rel,
dReal x, dReal y, dReal z);
void dJointSetAMotorAngle (dJointID, int anum, dReal angle);
void dJointSetAMotorParam (dJointID, int parameter, dReal value);
void dJointSetAMotorMode (dJointID, int mode);
void dJointAddAMotorTorques (dJointID, dReal torque1, dReal torque2, dReal torque3);
void dJointGetBallAnchor (dJointID, dVector3 result);
void dJointGetBallAnchor2 (dJointID, dVector3 result);
void dJointGetHingeAnchor (dJointID, dVector3 result);
void dJointGetHingeAnchor2 (dJointID, dVector3 result);
void dJointGetHingeAxis (dJointID, dVector3 result);
dReal dJointGetHingeParam (dJointID, int parameter);
dReal dJointGetHingeAngle (dJointID);
dReal dJointGetHingeAngleRate (dJointID);
dReal dJointGetSliderPosition (dJointID);
dReal dJointGetSliderPositionRate (dJointID);
void dJointGetSliderAxis (dJointID, dVector3 result);
dReal dJointGetSliderParam (dJointID, int parameter);
void dJointGetHinge2Anchor (dJointID, dVector3 result);
void dJointGetHinge2Anchor2 (dJointID, dVector3 result);
void dJointGetHinge2Axis1 (dJointID, dVector3 result);
void dJointGetHinge2Axis2 (dJointID, dVector3 result);
dReal dJointGetHinge2Param (dJointID, int parameter);
dReal dJointGetHinge2Angle1 (dJointID);
dReal dJointGetHinge2Angle1Rate (dJointID);
dReal dJointGetHinge2Angle2Rate (dJointID);
void dJointGetUniversalAnchor (dJointID, dVector3 result);
void dJointGetUniversalAnchor2 (dJointID, dVector3 result);
void dJointGetUniversalAxis1 (dJointID, dVector3 result);
void dJointGetUniversalAxis2 (dJointID, dVector3 result);
dReal dJointGetUniversalParam (dJointID, int parameter);
dReal dJointGetUniversalAngle1 (dJointID);
dReal dJointGetUniversalAngle2 (dJointID);
dReal dJointGetUniversalAngle1Rate (dJointID);
dReal dJointGetUniversalAngle2Rate (dJointID);
int dJointGetAMotorNumAxes (dJointID);
void dJointGetAMotorAxis (dJointID, int anum, dVector3 result);
int dJointGetAMotorAxisRel (dJointID, int anum);
dReal dJointGetAMotorAngle (dJointID, int anum);
dReal dJointGetAMotorAngleRate (dJointID, int anum);
dReal dJointGetAMotorParam (dJointID, int parameter);
int dJointGetAMotorMode (dJointID);
dJointID dConnectingJoint (dBodyID, dBodyID);
int dConnectingJointList (dBodyID, dBodyID, dJointID*);
int dAreConnected (dBodyID, dBodyID);
int dAreConnectedExcluding (dBodyID, dBodyID, int joint_type);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,47 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_ODE_H_
#define _ODE_ODE_H_
/* include *everything* here */
#include <ode/config.h>
#include <ode/compatibility.h>
#include <ode/common.h>
#include <ode/contact.h>
#include <ode/error.h>
#include <ode/memory.h>
#include <ode/odemath.h>
#include <ode/matrix.h>
#include <ode/timer.h>
#include <ode/rotation.h>
#include <ode/mass.h>
#include <ode/misc.h>
#include <ode/objects.h>
#include <ode/odecpp.h>
#include <ode/collision_space.h>
#include <ode/collision.h>
#include <ode/odecpp_collision.h>
#include <ode/export-dif.h>
#endif

View File

@ -1,621 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/* C++ interface for non-collision stuff */
#ifndef _ODE_ODECPP_H_
#define _ODE_ODECPP_H_
#ifdef __cplusplus
#include <ode/error.h>
class dWorld {
dWorldID _id;
// intentionally undefined, don't use these
dWorld (const dWorld &);
void operator= (const dWorld &);
public:
dWorld()
{ _id = dWorldCreate(); }
~dWorld()
{ dWorldDestroy (_id); }
dWorldID id() const
{ return _id; }
operator dWorldID() const
{ return _id; }
void setGravity (dReal x, dReal y, dReal z)
{ dWorldSetGravity (_id,x,y,z); }
void getGravity (dVector3 g) const
{ dWorldGetGravity (_id,g); }
void setERP (dReal erp)
{ dWorldSetERP(_id, erp); }
dReal getERP() const
{ return dWorldGetERP(_id); }
void setCFM (dReal cfm)
{ dWorldSetCFM(_id, cfm); }
dReal getCFM() const
{ return dWorldGetCFM(_id); }
void step (dReal stepsize)
{ dWorldStep (_id,stepsize); }
void stepFast1 (dReal stepsize, int maxiterations)
{ dWorldStepFast1 (_id,stepsize,maxiterations); }
void setAutoEnableDepthSF1(dWorldID, int depth)
{ dWorldSetAutoEnableDepthSF1 (_id, depth); }
int getAutoEnableDepthSF1(dWorldID)
{ return dWorldGetAutoEnableDepthSF1 (_id); }
void setAutoDisableLinearThreshold (dReal threshold)
{ dWorldSetAutoDisableLinearThreshold (_id,threshold); }
dReal getAutoDisableLinearThreshold()
{ return dWorldGetAutoDisableLinearThreshold (_id); }
void setAutoDisableAngularThreshold (dReal threshold)
{ dWorldSetAutoDisableAngularThreshold (_id,threshold); }
dReal getAutoDisableAngularThreshold()
{ return dWorldGetAutoDisableAngularThreshold (_id); }
void setAutoDisableSteps (int steps)
{ dWorldSetAutoDisableSteps (_id,steps); }
int getAutoDisableSteps()
{ return dWorldGetAutoDisableSteps (_id); }
void setAutoDisableTime (dReal time)
{ dWorldSetAutoDisableTime (_id,time); }
dReal getAutoDisableTime()
{ return dWorldGetAutoDisableTime (_id); }
void setAutoDisableFlag (int do_auto_disable)
{ dWorldSetAutoDisableFlag (_id,do_auto_disable); }
int getAutoDisableFlag()
{ return dWorldGetAutoDisableFlag (_id); }
void impulseToForce (dReal stepsize, dReal ix, dReal iy, dReal iz,
dVector3 force)
{ dWorldImpulseToForce (_id,stepsize,ix,iy,iz,force); }
};
class dBody {
dBodyID _id;
// intentionally undefined, don't use these
dBody (const dBody &);
void operator= (const dBody &);
public:
dBody()
{ _id = 0; }
dBody (dWorldID world)
{ _id = dBodyCreate (world); }
~dBody()
{ if (_id) dBodyDestroy (_id); }
void create (dWorldID world) {
if (_id) dBodyDestroy (_id);
_id = dBodyCreate (world);
}
dBodyID id() const
{ return _id; }
operator dBodyID() const
{ return _id; }
void setData (void *data)
{ dBodySetData (_id,data); }
void *getData() const
{ return dBodyGetData (_id); }
void setPosition (dReal x, dReal y, dReal z)
{ dBodySetPosition (_id,x,y,z); }
void setRotation (const dMatrix3 R)
{ dBodySetRotation (_id,R); }
void setQuaternion (const dQuaternion q)
{ dBodySetQuaternion (_id,q); }
void setLinearVel (dReal x, dReal y, dReal z)
{ dBodySetLinearVel (_id,x,y,z); }
void setAngularVel (dReal x, dReal y, dReal z)
{ dBodySetAngularVel (_id,x,y,z); }
const dReal * getPosition() const
{ return dBodyGetPosition (_id); }
const dReal * getRotation() const
{ return dBodyGetRotation (_id); }
const dReal * getQuaternion() const
{ return dBodyGetQuaternion (_id); }
const dReal * getLinearVel() const
{ return dBodyGetLinearVel (_id); }
const dReal * getAngularVel() const
{ return dBodyGetAngularVel (_id); }
void setMass (const dMass *mass)
{ dBodySetMass (_id,mass); }
void getMass (dMass *mass) const
{ dBodyGetMass (_id,mass); }
void addForce (dReal fx, dReal fy, dReal fz)
{ dBodyAddForce (_id, fx, fy, fz); }
void addTorque (dReal fx, dReal fy, dReal fz)
{ dBodyAddTorque (_id, fx, fy, fz); }
void addRelForce (dReal fx, dReal fy, dReal fz)
{ dBodyAddRelForce (_id, fx, fy, fz); }
void addRelTorque (dReal fx, dReal fy, dReal fz)
{ dBodyAddRelTorque (_id, fx, fy, fz); }
void addForceAtPos (dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz)
{ dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
void addForceAtRelPos (dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz)
{ dBodyAddForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz)
{ dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz)
{ dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
const dReal * getForce() const
{ return dBodyGetForce(_id); }
const dReal * getTorque() const
{ return dBodyGetTorque(_id); }
void setForce (dReal x, dReal y, dReal z)
{ dBodySetForce (_id,x,y,z); }
void setTorque (dReal x, dReal y, dReal z)
{ dBodySetTorque (_id,x,y,z); }
void enable()
{ dBodyEnable (_id); }
void disable()
{ dBodyDisable (_id); }
int isEnabled() const
{ return dBodyIsEnabled (_id); }
void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const
{ dBodyGetRelPointPos (_id, px, py, pz, result); }
void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
{ dBodyGetRelPointVel (_id, px, py, pz, result); }
void getPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
{ dBodyGetPointVel (_id,px,py,pz,result); }
void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result) const
{ dBodyGetPosRelPoint (_id,px,py,pz,result); }
void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result) const
{ dBodyVectorToWorld (_id,px,py,pz,result); }
void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result) const
{ dBodyVectorFromWorld (_id,px,py,pz,result); }
void setFiniteRotationMode (int mode)
{ dBodySetFiniteRotationMode (_id, mode); }
void setFiniteRotationAxis (dReal x, dReal y, dReal z)
{ dBodySetFiniteRotationAxis (_id, x, y, z); }
int getFiniteRotationMode() const
{ return dBodyGetFiniteRotationMode (_id); }
void getFiniteRotationAxis (dVector3 result) const
{ dBodyGetFiniteRotationAxis (_id, result); }
int getNumJoints() const
{ return dBodyGetNumJoints (_id); }
dJointID getJoint (int index) const
{ return dBodyGetJoint (_id, index); }
void setGravityMode (int mode)
{ dBodySetGravityMode (_id,mode); }
int getGravityMode() const
{ return dBodyGetGravityMode (_id); }
int isConnectedTo (dBodyID body) const
{ return dAreConnected (_id, body); }
void setAutoDisableLinearThreshold (dReal threshold)
{ dBodySetAutoDisableLinearThreshold (_id,threshold); }
dReal getAutoDisableLinearThreshold()
{ return dBodyGetAutoDisableLinearThreshold (_id); }
void setAutoDisableAngularThreshold (dReal threshold)
{ dBodySetAutoDisableAngularThreshold (_id,threshold); }
dReal getAutoDisableAngularThreshold()
{ return dBodyGetAutoDisableAngularThreshold (_id); }
void setAutoDisableSteps (int steps)
{ dBodySetAutoDisableSteps (_id,steps); }
int getAutoDisableSteps()
{ return dBodyGetAutoDisableSteps (_id); }
void setAutoDisableTime (dReal time)
{ dBodySetAutoDisableTime (_id,time); }
dReal getAutoDisableTime()
{ return dBodyGetAutoDisableTime (_id); }
void setAutoDisableFlag (int do_auto_disable)
{ dBodySetAutoDisableFlag (_id,do_auto_disable); }
int getAutoDisableFlag()
{ return dBodyGetAutoDisableFlag (_id); }
};
class dJointGroup {
dJointGroupID _id;
// intentionally undefined, don't use these
dJointGroup (const dJointGroup &);
void operator= (const dJointGroup &);
public:
dJointGroup (int dummy_arg=0)
{ _id = dJointGroupCreate (0); }
~dJointGroup()
{ dJointGroupDestroy (_id); }
void create (int dummy_arg=0) {
if (_id) dJointGroupDestroy (_id);
_id = dJointGroupCreate (0);
}
dJointGroupID id() const
{ return _id; }
operator dJointGroupID() const
{ return _id; }
void empty()
{ dJointGroupEmpty (_id); }
};
class dJoint {
private:
// intentionally undefined, don't use these
dJoint (const dJoint &) ;
void operator= (const dJoint &);
protected:
dJointID _id;
public:
dJoint()
{ _id = 0; }
~dJoint()
{ if (_id) dJointDestroy (_id); }
dJointID id() const
{ return _id; }
operator dJointID() const
{ return _id; }
void attach (dBodyID body1, dBodyID body2)
{ dJointAttach (_id, body1, body2); }
void setData (void *data)
{ dJointSetData (_id, data); }
void *getData() const
{ return dJointGetData (_id); }
int getType() const
{ return dJointGetType (_id); }
dBodyID getBody (int index) const
{ return dJointGetBody (_id, index); }
};
class dBallJoint : public dJoint {
private:
// intentionally undefined, don't use these
dBallJoint (const dBallJoint &);
void operator= (const dBallJoint &);
public:
dBallJoint() { }
dBallJoint (dWorldID world, dJointGroupID group=0)
{ _id = dJointCreateBall (world, group); }
void create (dWorldID world, dJointGroupID group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateBall (world, group);
}
void setAnchor (dReal x, dReal y, dReal z)
{ dJointSetBallAnchor (_id, x, y, z); }
void getAnchor (dVector3 result) const
{ dJointGetBallAnchor (_id, result); }
void getAnchor2 (dVector3 result) const
{ dJointGetBallAnchor2 (_id, result); }
} ;
class dHingeJoint : public dJoint {
// intentionally undefined, don't use these
dHingeJoint (const dHingeJoint &);
void operator = (const dHingeJoint &);
public:
dHingeJoint() { }
dHingeJoint (dWorldID world, dJointGroupID group=0)
{ _id = dJointCreateHinge (world, group); }
void create (dWorldID world, dJointGroupID group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateHinge (world, group);
}
void setAnchor (dReal x, dReal y, dReal z)
{ dJointSetHingeAnchor (_id, x, y, z); }
void getAnchor (dVector3 result) const
{ dJointGetHingeAnchor (_id, result); }
void getAnchor2 (dVector3 result) const
{ dJointGetHingeAnchor2 (_id, result); }
void setAxis (dReal x, dReal y, dReal z)
{ dJointSetHingeAxis (_id, x, y, z); }
void getAxis (dVector3 result) const
{ dJointGetHingeAxis (_id, result); }
dReal getAngle() const
{ return dJointGetHingeAngle (_id); }
dReal getAngleRate() const
{ return dJointGetHingeAngleRate (_id); }
void setParam (int parameter, dReal value)
{ dJointSetHingeParam (_id, parameter, value); }
dReal getParam (int parameter) const
{ return dJointGetHingeParam (_id, parameter); }
void addTorque (dReal torque)
{ dJointAddHingeTorque(_id, torque); }
};
class dSliderJoint : public dJoint {
// intentionally undefined, don't use these
dSliderJoint (const dSliderJoint &);
void operator = (const dSliderJoint &);
public:
dSliderJoint() { }
dSliderJoint (dWorldID world, dJointGroupID group=0)
{ _id = dJointCreateSlider (world, group); }
void create (dWorldID world, dJointGroupID group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateSlider (world, group);
}
void setAxis (dReal x, dReal y, dReal z)
{ dJointSetSliderAxis (_id, x, y, z); }
void getAxis (dVector3 result) const
{ dJointGetSliderAxis (_id, result); }
dReal getPosition() const
{ return dJointGetSliderPosition (_id); }
dReal getPositionRate() const
{ return dJointGetSliderPositionRate (_id); }
void setParam (int parameter, dReal value)
{ dJointSetSliderParam (_id, parameter, value); }
dReal getParam (int parameter) const
{ return dJointGetSliderParam (_id, parameter); }
void addForce (dReal force)
{ dJointAddSliderForce(_id, force); }
};
class dUniversalJoint : public dJoint {
// intentionally undefined, don't use these
dUniversalJoint (const dUniversalJoint &);
void operator = (const dUniversalJoint &);
public:
dUniversalJoint() { }
dUniversalJoint (dWorldID world, dJointGroupID group=0)
{ _id = dJointCreateUniversal (world, group); }
void create (dWorldID world, dJointGroupID group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateUniversal (world, group);
}
void setAnchor (dReal x, dReal y, dReal z)
{ dJointSetUniversalAnchor (_id, x, y, z); }
void setAxis1 (dReal x, dReal y, dReal z)
{ dJointSetUniversalAxis1 (_id, x, y, z); }
void setAxis2 (dReal x, dReal y, dReal z)
{ dJointSetUniversalAxis2 (_id, x, y, z); }
void setParam (int parameter, dReal value)
{ dJointSetUniversalParam (_id, parameter, value); }
void getAnchor (dVector3 result) const
{ dJointGetUniversalAnchor (_id, result); }
void getAnchor2 (dVector3 result) const
{ dJointGetUniversalAnchor2 (_id, result); }
void getAxis1 (dVector3 result) const
{ dJointGetUniversalAxis1 (_id, result); }
void getAxis2 (dVector3 result) const
{ dJointGetUniversalAxis2 (_id, result); }
dReal getParam (int parameter) const
{ return dJointGetUniversalParam (_id, parameter); }
dReal getAngle1() const
{ return dJointGetUniversalAngle1 (_id); }
dReal getAngle1Rate() const
{ return dJointGetUniversalAngle1Rate (_id); }
dReal getAngle2() const
{ return dJointGetUniversalAngle2 (_id); }
dReal getAngle2Rate() const
{ return dJointGetUniversalAngle2Rate (_id); }
void addTorques (dReal torque1, dReal torque2)
{ dJointAddUniversalTorques(_id, torque1, torque2); }
};
class dHinge2Joint : public dJoint {
// intentionally undefined, don't use these
dHinge2Joint (const dHinge2Joint &);
void operator = (const dHinge2Joint &);
public:
dHinge2Joint() { }
dHinge2Joint (dWorldID world, dJointGroupID group=0)
{ _id = dJointCreateHinge2 (world, group); }
void create (dWorldID world, dJointGroupID group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateHinge2 (world, group);
}
void setAnchor (dReal x, dReal y, dReal z)
{ dJointSetHinge2Anchor (_id, x, y, z); }
void setAxis1 (dReal x, dReal y, dReal z)
{ dJointSetHinge2Axis1 (_id, x, y, z); }
void setAxis2 (dReal x, dReal y, dReal z)
{ dJointSetHinge2Axis2 (_id, x, y, z); }
void getAnchor (dVector3 result) const
{ dJointGetHinge2Anchor (_id, result); }
void getAnchor2 (dVector3 result) const
{ dJointGetHinge2Anchor2 (_id, result); }
void getAxis1 (dVector3 result) const
{ dJointGetHinge2Axis1 (_id, result); }
void getAxis2 (dVector3 result) const
{ dJointGetHinge2Axis2 (_id, result); }
dReal getAngle1() const
{ return dJointGetHinge2Angle1 (_id); }
dReal getAngle1Rate() const
{ return dJointGetHinge2Angle1Rate (_id); }
dReal getAngle2Rate() const
{ return dJointGetHinge2Angle2Rate (_id); }
void setParam (int parameter, dReal value)
{ dJointSetHinge2Param (_id, parameter, value); }
dReal getParam (int parameter) const
{ return dJointGetHinge2Param (_id, parameter); }
void addTorques(dReal torque1, dReal torque2)
{ dJointAddHinge2Torques(_id, torque1, torque2); }
};
class dFixedJoint : public dJoint {
// intentionally undefined, don't use these
dFixedJoint (const dFixedJoint &);
void operator = (const dFixedJoint &);
public:
dFixedJoint() { }
dFixedJoint (dWorldID world, dJointGroupID group=0)
{ _id = dJointCreateFixed (world, group); }
void create (dWorldID world, dJointGroupID group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateFixed (world, group);
}
void set()
{ dJointSetFixed (_id); }
};
class dContactJoint : public dJoint {
// intentionally undefined, don't use these
dContactJoint (const dContactJoint &);
void operator = (const dContactJoint &);
public:
dContactJoint() { }
dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
{ _id = dJointCreateContact (world, group, contact); }
void create (dWorldID world, dJointGroupID group, dContact *contact) {
if (_id) dJointDestroy (_id);
_id = dJointCreateContact (world, group, contact);
}
};
class dNullJoint : public dJoint {
// intentionally undefined, don't use these
dNullJoint (const dNullJoint &);
void operator = (const dNullJoint &);
public:
dNullJoint() { }
dNullJoint (dWorldID world, dJointGroupID group=0)
{ _id = dJointCreateNull (world, group); }
void create (dWorldID world, dJointGroupID group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateNull (world, group);
}
};
class dAMotorJoint : public dJoint {
// intentionally undefined, don't use these
dAMotorJoint (const dAMotorJoint &);
void operator = (const dAMotorJoint &);
public:
dAMotorJoint() { }
dAMotorJoint (dWorldID world, dJointGroupID group=0)
{ _id = dJointCreateAMotor (world, group); }
void create (dWorldID world, dJointGroupID group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateAMotor (world, group);
}
void setMode (int mode)
{ dJointSetAMotorMode (_id, mode); }
int getMode() const
{ return dJointGetAMotorMode (_id); }
void setNumAxes (int num)
{ dJointSetAMotorNumAxes (_id, num); }
int getNumAxes() const
{ return dJointGetAMotorNumAxes (_id); }
void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
{ dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
void getAxis (int anum, dVector3 result) const
{ dJointGetAMotorAxis (_id, anum, result); }
int getAxisRel (int anum) const
{ return dJointGetAMotorAxisRel (_id, anum); }
void setAngle (int anum, dReal angle)
{ dJointSetAMotorAngle (_id, anum, angle); }
dReal getAngle (int anum) const
{ return dJointGetAMotorAngle (_id, anum); }
dReal getAngleRate (int anum)
{ return dJointGetAMotorAngleRate (_id,anum); }
void setParam (int parameter, dReal value)
{ dJointSetAMotorParam (_id, parameter, value); }
dReal getParam (int parameter) const
{ return dJointGetAMotorParam (_id, parameter); }
void addTorques(dReal torque1, dReal torque2, dReal torque3)
{ dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
};
#endif
#endif

View File

@ -1,346 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/* C++ interface for new collision API */
#ifndef _ODE_ODECPP_COLLISION_H_
#define _ODE_ODECPP_COLLISION_H_
#ifdef __cplusplus
#include <ode/error.h>
class dGeom {
// intentionally undefined, don't use these
dGeom (dGeom &);
void operator= (dGeom &);
protected:
dGeomID _id;
public:
dGeom()
{ _id = 0; }
~dGeom()
{ if (_id) dGeomDestroy (_id); }
dGeomID id() const
{ return _id; }
operator dGeomID() const
{ return _id; }
void destroy() {
if (_id) dGeomDestroy (_id);
_id = 0;
}
int getClass() const
{ return dGeomGetClass (_id); }
dSpaceID getSpace() const
{ return dGeomGetSpace (_id); }
void setData (void *data)
{ dGeomSetData (_id,data); }
void *getData() const
{ return dGeomGetData (_id); }
void setBody (dBodyID b)
{ dGeomSetBody (_id,b); }
dBodyID getBody() const
{ return dGeomGetBody (_id); }
void setPosition (dReal x, dReal y, dReal z)
{ dGeomSetPosition (_id,x,y,z); }
const dReal * getPosition() const
{ return dGeomGetPosition (_id); }
void setRotation (const dMatrix3 R)
{ dGeomSetRotation (_id,R); }
const dReal * getRotation() const
{ return dGeomGetRotation (_id); }
void setQuaternion (const dQuaternion quat)
{ dGeomSetQuaternion (_id,quat); }
void getQuaternion (dQuaternion quat) const
{ dGeomGetQuaternion (_id,quat); }
void getAABB (dReal aabb[6]) const
{ dGeomGetAABB (_id, aabb); }
int isSpace()
{ return dGeomIsSpace (_id); }
void setCategoryBits (unsigned long bits)
{ dGeomSetCategoryBits (_id, bits); }
void setCollideBits (unsigned long bits)
{ dGeomSetCollideBits (_id, bits); }
unsigned long getCategoryBits()
{ return dGeomGetCategoryBits (_id); }
unsigned long getCollideBits()
{ return dGeomGetCollideBits (_id); }
void enable()
{ dGeomEnable (_id); }
void disable()
{ dGeomDisable (_id); }
int isEnabled()
{ return dGeomIsEnabled (_id); }
void collide2 (dGeomID g, void *data, dNearCallback *callback)
{ dSpaceCollide2 (_id,g,data,callback); }
};
class dSpace : public dGeom {
// intentionally undefined, don't use these
dSpace (dSpace &);
void operator= (dSpace &);
protected:
// the default constructor is protected so that you
// can't instance this class. you must instance one
// of its subclasses instead.
dSpace () { _id = 0; }
public:
dSpaceID id() const
{ return (dSpaceID) _id; }
operator dSpaceID() const
{ return (dSpaceID) _id; }
void setCleanup (int mode)
{ dSpaceSetCleanup (id(), mode); }
int getCleanup()
{ return dSpaceGetCleanup (id()); }
void add (dGeomID x)
{ dSpaceAdd (id(), x); }
void remove (dGeomID x)
{ dSpaceRemove (id(), x); }
int query (dGeomID x)
{ return dSpaceQuery (id(),x); }
int getNumGeoms()
{ return dSpaceGetNumGeoms (id()); }
dGeomID getGeom (int i)
{ return dSpaceGetGeom (id(),i); }
void collide (void *data, dNearCallback *callback)
{ dSpaceCollide (id(),data,callback); }
};
class dSimpleSpace : public dSpace {
// intentionally undefined, don't use these
dSimpleSpace (dSimpleSpace &);
void operator= (dSimpleSpace &);
public:
dSimpleSpace (dSpaceID space)
{ _id = (dGeomID) dSimpleSpaceCreate (space); }
};
class dHashSpace : public dSpace {
// intentionally undefined, don't use these
dHashSpace (dHashSpace &);
void operator= (dHashSpace &);
public:
dHashSpace (dSpaceID space)
{ _id = (dGeomID) dHashSpaceCreate (space); }
void setLevels (int minlevel, int maxlevel)
{ dHashSpaceSetLevels (id(),minlevel,maxlevel); }
};
class dQuadTreeSpace : public dSpace {
// intentionally undefined, don't use these
dQuadTreeSpace (dQuadTreeSpace &);
void operator= (dQuadTreeSpace &);
public:
dQuadTreeSpace (dSpaceID space, dVector3 center, dVector3 extents, int depth)
{ _id = (dGeomID) dQuadTreeSpaceCreate (space,center,extents,depth); }
};
class dSphere : public dGeom {
// intentionally undefined, don't use these
dSphere (dSphere &);
void operator= (dSphere &);
public:
dSphere () { }
dSphere (dSpaceID space, dReal radius)
{ _id = dCreateSphere (space, radius); }
void create (dSpaceID space, dReal radius) {
if (_id) dGeomDestroy (_id);
_id = dCreateSphere (space, radius);
}
void setRadius (dReal radius)
{ dGeomSphereSetRadius (_id, radius); }
dReal getRadius() const
{ return dGeomSphereGetRadius (_id); }
};
class dBox : public dGeom {
// intentionally undefined, don't use these
dBox (dBox &);
void operator= (dBox &);
public:
dBox () { }
dBox (dSpaceID space, dReal lx, dReal ly, dReal lz)
{ _id = dCreateBox (space,lx,ly,lz); }
void create (dSpaceID space, dReal lx, dReal ly, dReal lz) {
if (_id) dGeomDestroy (_id);
_id = dCreateBox (space,lx,ly,lz);
}
void setLengths (dReal lx, dReal ly, dReal lz)
{ dGeomBoxSetLengths (_id, lx, ly, lz); }
void getLengths (dVector3 result) const
{ dGeomBoxGetLengths (_id,result); }
};
class dPlane : public dGeom {
// intentionally undefined, don't use these
dPlane (dPlane &);
void operator= (dPlane &);
public:
dPlane() { }
dPlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d)
{ _id = dCreatePlane (space,a,b,c,d); }
void create (dSpaceID space, dReal a, dReal b, dReal c, dReal d) {
if (_id) dGeomDestroy (_id);
_id = dCreatePlane (space,a,b,c,d);
}
void setParams (dReal a, dReal b, dReal c, dReal d)
{ dGeomPlaneSetParams (_id, a, b, c, d); }
void getParams (dVector4 result) const
{ dGeomPlaneGetParams (_id,result); }
};
class dCCylinder : public dGeom {
// intentionally undefined, don't use these
dCCylinder (dCCylinder &);
void operator= (dCCylinder &);
public:
dCCylinder() { }
dCCylinder (dSpaceID space, dReal radius, dReal length)
{ _id = dCreateCCylinder (space,radius,length); }
void create (dSpaceID space, dReal radius, dReal length) {
if (_id) dGeomDestroy (_id);
_id = dCreateCCylinder (space,radius,length);
}
void setParams (dReal radius, dReal length)
{ dGeomCCylinderSetParams (_id, radius, length); }
void getParams (dReal *radius, dReal *length) const
{ dGeomCCylinderGetParams (_id,radius,length); }
};
class dRay : public dGeom {
// intentionally undefined, don't use these
dRay (dRay &);
void operator= (dRay &);
public:
dRay() { }
dRay (dSpaceID space, dReal length)
{ _id = dCreateRay (space,length); }
void create (dSpaceID space, dReal length) {
if (_id) dGeomDestroy (_id);
_id = dCreateRay (space,length);
}
void setLength (dReal length)
{ dGeomRaySetLength (_id, length); }
dReal getLength()
{ return dGeomRayGetLength (_id); }
void set (dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz)
{ dGeomRaySet (_id, px, py, pz, dx, dy, dz); }
void get (dVector3 start, dVector3 dir)
{ dGeomRayGet (_id, start, dir); }
void setParams (int firstContact, int backfaceCull)
{ dGeomRaySetParams (_id, firstContact, backfaceCull); }
void getParams (int *firstContact, int *backfaceCull)
{ dGeomRayGetParams (_id, firstContact, backfaceCull); }
void setClosestHit (int closestHit)
{ dGeomRaySetClosestHit (_id, closestHit); }
int getClosestHit()
{ return dGeomRayGetClosestHit (_id); }
};
class dGeomTransform : public dGeom {
// intentionally undefined, don't use these
dGeomTransform (dGeomTransform &);
void operator= (dGeomTransform &);
public:
dGeomTransform() { }
dGeomTransform (dSpaceID space)
{ _id = dCreateGeomTransform (space); }
void create (dSpaceID space=0) {
if (_id) dGeomDestroy (_id);
_id = dCreateGeomTransform (space);
}
void setGeom (dGeomID geom)
{ dGeomTransformSetGeom (_id, geom); }
dGeomID getGeom() const
{ return dGeomTransformGetGeom (_id); }
void setCleanup (int mode)
{ dGeomTransformSetCleanup (_id,mode); }
int getCleanup ()
{ return dGeomTransformGetCleanup (_id); }
void setInfo (int mode)
{ dGeomTransformSetInfo (_id,mode); }
int getInfo()
{ return dGeomTransformGetInfo (_id); }
};
#endif
#endif

View File

@ -1,316 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/* this is the old C++ interface, the new C++ interface is not quite
* compatible with this. but this file is kept around in case you were
* using the old interface.
*/
#ifndef _ODE_ODECPP_H_
#define _ODE_ODECPP_H_
#ifdef __cplusplus
#include <ode/error.h>
class dWorld {
dWorldID _id;
dWorld (dWorld &) { dDebug (0,"bad"); }
void operator= (dWorld &) { dDebug (0,"bad"); }
public:
dWorld()
{ _id = dWorldCreate(); }
~dWorld()
{ dWorldDestroy (_id); }
dWorldID id()
{ return _id; }
void setGravity (dReal x, dReal y, dReal z)
{ dWorldSetGravity (_id,x,y,z); }
void getGravity (dVector3 g)
{ dWorldGetGravity (_id,g); }
void step (dReal stepsize)
{ dWorldStep (_id,stepsize); }
};
class dBody {
dBodyID _id;
dBody (dBody &) { dDebug (0,"bad"); }
void operator= (dBody &) { dDebug (0,"bad"); }
public:
dBody()
{ _id = 0; }
dBody (dWorld &world)
{ _id = dBodyCreate (world.id()); }
~dBody()
{ dBodyDestroy (_id); }
void create (dWorld &world)
{ if (_id) dBodyDestroy (_id); _id = dBodyCreate (world.id()); }
dBodyID id()
{ return _id; }
void setData (void *data)
{ dBodySetData (_id,data); }
void *getData()
{ return dBodyGetData (_id); }
void setPosition (dReal x, dReal y, dReal z)
{ dBodySetPosition (_id,x,y,z); }
void setRotation (const dMatrix3 R)
{ dBodySetRotation (_id,R); }
void setQuaternion (const dQuaternion q)
{ dBodySetQuaternion (_id,q); }
void setLinearVel (dReal x, dReal y, dReal z)
{ dBodySetLinearVel (_id,x,y,z); }
void setAngularVel (dReal x, dReal y, dReal z)
{ dBodySetAngularVel (_id,x,y,z); }
const dReal * getPosition()
{ return dBodyGetPosition (_id); }
const dReal * getRotation()
{ return dBodyGetRotation (_id); }
const dReal * getQuaternion()
{ return dBodyGetQuaternion (_id); }
const dReal * getLinearVel()
{ return dBodyGetLinearVel (_id); }
const dReal * getAngularVel()
{ return dBodyGetAngularVel (_id); }
void setMass (const dMass *mass)
{ dBodySetMass (_id,mass); }
void getMass (dMass *mass)
{ dBodyGetMass (_id,mass); }
void addForce (dReal fx, dReal fy, dReal fz)
{ dBodyAddForce (_id, fx, fy, fz); }
void addTorque (dReal fx, dReal fy, dReal fz)
{ dBodyAddTorque (_id, fx, fy, fz); }
void addRelForce (dReal fx, dReal fy, dReal fz)
{ dBodyAddRelForce (_id, fx, fy, fz); }
void addRelTorque (dReal fx, dReal fy, dReal fz)
{ dBodyAddRelTorque (_id, fx, fy, fz); }
void addForceAtPos (dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz)
{ dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz)
{ dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz)
{ dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result)
{ dBodyGetRelPointPos (_id, px, py, pz, result); }
void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result)
{ dBodyGetRelPointVel (_id, px, py, pz, result); }
int isConnectedTo (const dBody &b)
{ return dAreConnected (_id,b._id); }
};
class dJointGroup {
dJointGroupID _id;
dJointGroup (dJointGroup &) { dDebug (0,"bad"); }
void operator= (dJointGroup &) { dDebug (0,"bad"); }
public:
dJointGroup()
{ _id = 0; }
dJointGroup (int max_size)
{ _id = dJointGroupCreate (max_size); }
~dJointGroup()
{ dJointGroupDestroy (_id); }
void create (int max_size)
{ if (_id) dJointGroupDestroy (_id); _id = dJointGroupCreate (max_size); }
dJointGroupID id()
{ return _id; }
void empty()
{ dJointGroupEmpty (_id); }
};
class dJoint {
dJointID _id;
dJoint (dJoint &) { dDebug (0,"bad"); }
void operator= (dJoint &) { dDebug (0,"bad"); }
public:
dJoint()
{ _id = 0; }
~dJoint()
{ dJointDestroy (_id); }
dJointID id()
{ return _id; }
void createBall (dWorld &world, dJointGroup *group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateBall (world.id(), group ? group->id() : 0);
}
void createHinge (dWorld &world, dJointGroup *group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateHinge (world.id(), group ? group->id() : 0);
}
void createSlider (dWorld &world, dJointGroup *group=0) {
if (_id) dJointDestroy (_id);
_id = dJointCreateSlider (world.id(), group ? group->id() : 0);
}
void createContact (dWorld &world, dJointGroup *group, dContact *contact) {
if (_id) dJointDestroy (_id);
_id = dJointCreateContact (world.id(), group ? group->id() : 0, contact);
}
void attach (dBody &body1, dBody &body2)
{ dJointAttach (_id, body1.id(), body2.id()); }
void setBallAnchor (dReal x, dReal y, dReal z)
{ dJointSetBallAnchor (_id, x, y, z); }
void setHingeAnchor (dReal x, dReal y, dReal z)
{ dJointSetHingeAnchor (_id, x, y, z); }
void setHingeAxis (dReal x, dReal y, dReal z)
{ dJointSetHingeAxis (_id, x, y, z); }
void setSliderAxis (dReal x, dReal y, dReal z)
{ dJointSetSliderAxis (_id, x, y, z); }
void getBallAnchor (dVector3 result)
{ dJointGetBallAnchor (_id, result); }
void getHingeAnchor (dVector3 result)
{ dJointGetHingeAnchor (_id, result); }
void getHingeAxis (dVector3 result)
{ dJointGetHingeAxis (_id, result); }
void getSliderAxis (dVector3 result)
{ dJointGetSliderAxis (_id, result); }
};
class dSpace {
dSpaceID _id;
dSpace (dSpace &) { dDebug (0,"bad"); }
void operator= (dSpace &) { dDebug (0,"bad"); }
public:
dSpace ()
{ _id = dHashSpaceCreate(); }
~dSpace()
{ dSpaceDestroy (_id); }
dSpaceID id()
{ return _id; }
void collide (void *data, dNearCallback *callback)
{ dSpaceCollide (_id,data,callback); }
};
class dGeom {
dGeomID _id;
dGeom (dGeom &) { dDebug (0,"bad"); }
void operator= (dGeom &) { dDebug (0,"bad"); }
public:
dGeom()
{ _id = 0; }
~dGeom()
{ dGeomDestroy (_id); }
dGeomID id()
{ return _id; }
void createSphere (dSpace &space, dReal radius) {
if (_id) dGeomDestroy (_id);
_id = dCreateSphere (space.id(),radius);
}
void createBox (dSpace &space, dReal lx, dReal ly, dReal lz) {
if (_id) dGeomDestroy (_id);
_id = dCreateBox (space.id(),lx,ly,lz);
}
void createPlane (dSpace &space, dReal a, dReal b, dReal c, dReal d) {
if (_id) dGeomDestroy (_id);
_id = dCreatePlane (space.id(),a,b,c,d);
}
void createCCylinder (dSpace &space, dReal radius, dReal length) {
if (_id) dGeomDestroy (_id);
_id = dCreateCCylinder (space.id(),radius,length);
}
void destroy() {
if (_id) dGeomDestroy (_id);
_id = 0;
}
int getClass()
{ return dGeomGetClass (_id); }
dReal sphereGetRadius()
{ return dGeomSphereGetRadius (_id); }
void boxGetLengths (dVector3 result)
{ dGeomBoxGetLengths (_id,result); }
void planeGetParams (dVector4 result)
{ dGeomPlaneGetParams (_id,result); }
void CCylinderGetParams (dReal *radius, dReal *length)
{ dGeomCCylinderGetParams (_id,radius,length); }
void setData (void *data)
{ dGeomSetData (_id,data); }
void *getData()
{ return dGeomGetData (_id); }
void setBody (dBody &b)
{ dGeomSetBody (_id,b.id()); }
void setBody (dBodyID b)
{ dGeomSetBody (_id,b); }
dBodyID getBody()
{ return dGeomGetBody (_id); }
void setPosition (dReal x, dReal y, dReal z)
{ dGeomSetPosition (_id,x,y,z); }
void setRotation (const dMatrix3 R)
{ dGeomSetRotation (_id,R); }
const dReal * getPosition()
{ return dGeomGetPosition (_id); }
const dReal * getRotation()
{ return dGeomGetRotation (_id); }
};
#endif
#endif

View File

@ -1,258 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_ODEMATH_H_
#define _ODE_ODEMATH_H_
#include <ode/common.h>
#ifdef __GNUC__
#define PURE_INLINE extern inline
#else
#define PURE_INLINE inline
#endif
/*
* macro to access elements i,j in an NxM matrix A, independent of the
* matrix storage convention.
*/
#define dACCESS33(A,i,j) ((A)[(i)*4+(j)])
/*
* 3-way dot product. dDOTpq means that elements of `a' and `b' are spaced
* p and q indexes apart respectively. dDOT() means dDOT11.
* in C++ we could use function templates to get all the versions of these
* functions - but on some compilers this will result in sub-optimal code.
*/
#define dDOTpq(a,b,p,q) ((a)[0]*(b)[0] + (a)[p]*(b)[q] + (a)[2*(p)]*(b)[2*(q)])
#ifdef __cplusplus
PURE_INLINE dReal dDOT (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,1); }
PURE_INLINE dReal dDOT13 (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,3); }
PURE_INLINE dReal dDOT31 (const dReal *a, const dReal *b) { return dDOTpq(a,b,3,1); }
PURE_INLINE dReal dDOT33 (const dReal *a, const dReal *b) { return dDOTpq(a,b,3,3); }
PURE_INLINE dReal dDOT14 (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,4); }
PURE_INLINE dReal dDOT41 (const dReal *a, const dReal *b) { return dDOTpq(a,b,4,1); }
PURE_INLINE dReal dDOT44 (const dReal *a, const dReal *b) { return dDOTpq(a,b,4,4); }
#else
#define dDOT(a,b) dDOTpq(a,b,1,1)
#define dDOT13(a,b) dDOTpq(a,b,1,3)
#define dDOT31(a,b) dDOTpq(a,b,3,1)
#define dDOT33(a,b) dDOTpq(a,b,3,3)
#define dDOT14(a,b) dDOTpq(a,b,1,4)
#define dDOT41(a,b) dDOTpq(a,b,4,1)
#define dDOT44(a,b) dDOTpq(a,b,4,4)
#endif /* __cplusplus */
/*
* cross product, set a = b x c. dCROSSpqr means that elements of `a', `b'
* and `c' are spaced p, q and r indexes apart respectively.
* dCROSS() means dCROSS111. `op' is normally `=', but you can set it to
* +=, -= etc to get other effects.
*/
#define dCROSS(a,op,b,c) \
do { \
(a)[0] op ((b)[1]*(c)[2] - (b)[2]*(c)[1]); \
(a)[1] op ((b)[2]*(c)[0] - (b)[0]*(c)[2]); \
(a)[2] op ((b)[0]*(c)[1] - (b)[1]*(c)[0]); \
} while(0)
#define dCROSSpqr(a,op,b,c,p,q,r) \
do { \
(a)[ 0] op ((b)[ q]*(c)[2*r] - (b)[2*q]*(c)[ r]); \
(a)[ p] op ((b)[2*q]*(c)[ 0] - (b)[ 0]*(c)[2*r]); \
(a)[2*p] op ((b)[ 0]*(c)[ r] - (b)[ q]*(c)[ 0]); \
} while(0)
#define dCROSS114(a,op,b,c) dCROSSpqr(a,op,b,c,1,1,4)
#define dCROSS141(a,op,b,c) dCROSSpqr(a,op,b,c,1,4,1)
#define dCROSS144(a,op,b,c) dCROSSpqr(a,op,b,c,1,4,4)
#define dCROSS411(a,op,b,c) dCROSSpqr(a,op,b,c,4,1,1)
#define dCROSS414(a,op,b,c) dCROSSpqr(a,op,b,c,4,1,4)
#define dCROSS441(a,op,b,c) dCROSSpqr(a,op,b,c,4,4,1)
#define dCROSS444(a,op,b,c) dCROSSpqr(a,op,b,c,4,4,4)
/*
* set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b.
* A is stored by rows, and has `skip' elements per row. the matrix is
* assumed to be already zero, so this does not write zero elements!
* if (plus,minus) is (+,-) then a positive version will be written.
* if (plus,minus) is (-,+) then a negative version will be written.
*/
#define dCROSSMAT(A,a,skip,plus,minus) \
do { \
(A)[1] = minus (a)[2]; \
(A)[2] = plus (a)[1]; \
(A)[(skip)+0] = plus (a)[2]; \
(A)[(skip)+2] = minus (a)[0]; \
(A)[2*(skip)+0] = minus (a)[1]; \
(A)[2*(skip)+1] = plus (a)[0]; \
} while(0)
/*
* compute the distance between two 3-vectors
*/
#ifdef __cplusplus
PURE_INLINE float dDISTANCE (const float a[3], const float b[3])
{ return (float) 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]) ); }
PURE_INLINE double dDISTANCE (const double a[3], const double b[3])
{ 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]) ); }
#else
#define dDISTANCE(a,b) \
(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]) ))
#endif
/*
* special case matrix multipication, with operator selection
*/
#define dMULTIPLYOP0_331(A,op,B,C) \
do { \
(A)[0] op dDOT((B),(C)); \
(A)[1] op dDOT((B+4),(C)); \
(A)[2] op dDOT((B+8),(C)); \
} while(0)
#define dMULTIPLYOP1_331(A,op,B,C) \
do { \
(A)[0] op dDOT41((B),(C)); \
(A)[1] op dDOT41((B+1),(C)); \
(A)[2] op dDOT41((B+2),(C)); \
} while(0)
#define dMULTIPLYOP0_133(A,op,B,C) \
do { \
(A)[0] op dDOT14((B),(C)); \
(A)[1] op dDOT14((B),(C+1)); \
(A)[2] op dDOT14((B),(C+2)); \
} while(0)
#define dMULTIPLYOP0_333(A,op,B,C) \
do { \
(A)[0] op dDOT14((B),(C)); \
(A)[1] op dDOT14((B),(C+1)); \
(A)[2] op dDOT14((B),(C+2)); \
(A)[4] op dDOT14((B+4),(C)); \
(A)[5] op dDOT14((B+4),(C+1)); \
(A)[6] op dDOT14((B+4),(C+2)); \
(A)[8] op dDOT14((B+8),(C)); \
(A)[9] op dDOT14((B+8),(C+1)); \
(A)[10] op dDOT14((B+8),(C+2)); \
} while(0)
#define dMULTIPLYOP1_333(A,op,B,C) \
do { \
(A)[0] op dDOT44((B),(C)); \
(A)[1] op dDOT44((B),(C+1)); \
(A)[2] op dDOT44((B),(C+2)); \
(A)[4] op dDOT44((B+1),(C)); \
(A)[5] op dDOT44((B+1),(C+1)); \
(A)[6] op dDOT44((B+1),(C+2)); \
(A)[8] op dDOT44((B+2),(C)); \
(A)[9] op dDOT44((B+2),(C+1)); \
(A)[10] op dDOT44((B+2),(C+2)); \
} while(0)
#define dMULTIPLYOP2_333(A,op,B,C) \
do { \
(A)[0] op dDOT((B),(C)); \
(A)[1] op dDOT((B),(C+4)); \
(A)[2] op dDOT((B),(C+8)); \
(A)[4] op dDOT((B+4),(C)); \
(A)[5] op dDOT((B+4),(C+4)); \
(A)[6] op dDOT((B+4),(C+8)); \
(A)[8] op dDOT((B+8),(C)); \
(A)[9] op dDOT((B+8),(C+4)); \
(A)[10] op dDOT((B+8),(C+8)); \
} while(0)
#ifdef __cplusplus
#define DECL template <class TA, class TB, class TC> PURE_INLINE void
DECL dMULTIPLY0_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_331(A,=,B,C); }
DECL dMULTIPLY1_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_331(A,=,B,C); }
DECL dMULTIPLY0_133(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_133(A,=,B,C); }
DECL dMULTIPLY0_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_333(A,=,B,C); }
DECL dMULTIPLY1_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_333(A,=,B,C); }
DECL dMULTIPLY2_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP2_333(A,=,B,C); }
DECL dMULTIPLYADD0_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_331(A,+=,B,C); }
DECL dMULTIPLYADD1_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_331(A,+=,B,C); }
DECL dMULTIPLYADD0_133(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_133(A,+=,B,C); }
DECL dMULTIPLYADD0_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_333(A,+=,B,C); }
DECL dMULTIPLYADD1_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_333(A,+=,B,C); }
DECL dMULTIPLYADD2_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP2_333(A,+=,B,C); }
#undef DECL
#else
#define dMULTIPLY0_331(A,B,C) dMULTIPLYOP0_331(A,=,B,C)
#define dMULTIPLY1_331(A,B,C) dMULTIPLYOP1_331(A,=,B,C)
#define dMULTIPLY0_133(A,B,C) dMULTIPLYOP0_133(A,=,B,C)
#define dMULTIPLY0_333(A,B,C) dMULTIPLYOP0_333(A,=,B,C)
#define dMULTIPLY1_333(A,B,C) dMULTIPLYOP1_333(A,=,B,C)
#define dMULTIPLY2_333(A,B,C) dMULTIPLYOP2_333(A,=,B,C)
#define dMULTIPLYADD0_331(A,B,C) dMULTIPLYOP0_331(A,+=,B,C)
#define dMULTIPLYADD1_331(A,B,C) dMULTIPLYOP1_331(A,+=,B,C)
#define dMULTIPLYADD0_133(A,B,C) dMULTIPLYOP0_133(A,+=,B,C)
#define dMULTIPLYADD0_333(A,B,C) dMULTIPLYOP0_333(A,+=,B,C)
#define dMULTIPLYADD1_333(A,B,C) dMULTIPLYOP1_333(A,+=,B,C)
#define dMULTIPLYADD2_333(A,B,C) dMULTIPLYOP2_333(A,+=,B,C)
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* normalize 3x1 and 4x1 vectors (i.e. scale them to unit length)
*/
void dNormalize3 (dVector3 a);
void dNormalize4 (dVector4 a);
/*
* given a unit length "normal" vector n, generate vectors p and q vectors
* that are an orthonormal basis for the plane space perpendicular to n.
* i.e. this makes p,q such that n,p,q are all perpendicular to each other.
* q will equal n x p. if n is not unit length then p will be unit length but
* q wont be.
*/
void dPlaneSpace (const dVector3 n, dVector3 p, dVector3 q);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,70 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_ROTATION_H_
#define _ODE_ROTATION_H_
#include <ode/common.h>
#include <ode/compatibility.h>
#ifdef __cplusplus
extern "C" {
#endif
void dRSetIdentity (dMatrix3 R);
void dRFromAxisAndAngle (dMatrix3 R, dReal ax, dReal ay, dReal az,
dReal angle);
void dRFromEulerAngles (dMatrix3 R, dReal phi, dReal theta, dReal psi);
void dRFrom2Axes (dMatrix3 R, dReal ax, dReal ay, dReal az,
dReal bx, dReal by, dReal bz);
void dRFromZAxis (dMatrix3 R, dReal ax, dReal ay, dReal az);
void dQSetIdentity (dQuaternion q);
void dQFromAxisAndAngle (dQuaternion q, dReal ax, dReal ay, dReal az,
dReal angle);
/* Quaternion multiplication, analogous to the matrix multiplication routines. */
/* qa = rotate by qc, then qb */
void dQMultiply0 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
/* qa = rotate by qc, then by inverse of qb */
void dQMultiply1 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
/* qa = rotate by inverse of qc, then by qb */
void dQMultiply2 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
/* qa = rotate by inverse of qc, then by inverse of qb */
void dQMultiply3 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
void dRfromQ (dMatrix3 R, const dQuaternion q);
void dQfromR (dQuaternion q, const dMatrix3 R);
void dDQfromW (dReal dq[4], const dVector3 w, const dQuaternion q);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,76 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_TIMER_H_
#define _ODE_TIMER_H_
#include <ode/config.h>
#ifdef __cplusplus
extern "C" {
#endif
/* stop watch objects */
typedef struct dStopwatch {
double time; /* total clock count */
unsigned long cc[2]; /* clock count since last `start' */
} dStopwatch;
void dStopwatchReset (dStopwatch *);
void dStopwatchStart (dStopwatch *);
void dStopwatchStop (dStopwatch *);
double dStopwatchTime (dStopwatch *); /* returns total time in secs */
/* code timers */
void dTimerStart (const char *description); /* pass a static string here */
void dTimerNow (const char *description); /* pass a static string here */
void dTimerEnd(void);
/* print out a timer report. if `average' is nonzero, print out the average
* time for each slot (this is only meaningful if the same start-now-end
* calls are being made repeatedly.
*/
void dTimerReport (FILE *fout, int average);
/* resolution */
/* returns the timer ticks per second implied by the timing hardware or API.
* the actual timer resolution may not be this great.
*/
double dTimerTicksPerSecond(void);
/* returns an estimate of the actual timer resolution, in seconds. this may
* be greater than 1/ticks_per_second.
*/
double dTimerResolution(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,80 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <ode/config.h>
#include <ode/memory.h>
#include <ode/error.h>
#include "array.h"
static inline int roundUpToPowerOfTwo (int x)
{
int i = 1;
while (i < x) i <<= 1;
return i;
}
void dArrayBase::_freeAll (int sizeofT)
{
if (_data) {
if (_data == this+1) return; // if constructLocalArray() was called
dFree (_data,_anum * sizeofT);
}
}
void dArrayBase::_setSize (int newsize, int sizeofT)
{
if (newsize < 0) return;
if (newsize > _anum) {
if (_data == this+1) {
// this is a no-no, because constructLocalArray() was called
dDebug (0,"setSize() out of space in LOCAL array");
}
int newanum = roundUpToPowerOfTwo (newsize);
if (_data) _data = dRealloc (_data, _anum*sizeofT, newanum*sizeofT);
else _data = dAlloc (newanum*sizeofT);
_anum = newanum;
}
_size = newsize;
}
void * dArrayBase::operator new (size_t size)
{
return dAlloc (size);
}
void dArrayBase::operator delete (void *ptr, size_t size)
{
dFree (ptr,size);
}
void dArrayBase::constructLocalArray (int __anum)
{
_size = 0;
_anum = __anum;
_data = this+1;
}

View File

@ -1,135 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/* this comes from the `reuse' library. copy any changes back to the source.
*
* Variable sized array template. The array is always stored in a contiguous
* chunk. The array can be resized. A size increase will cause more memory
* to be allocated, and may result in relocation of the array memory.
* A size decrease has no effect on the memory allocation.
*
* Array elements with constructors or destructors are not supported!
* But if you must have such elements, here's what to know/do:
* - Bitwise copy is used when copying whole arrays.
* - When copying individual items (via push(), insert() etc) the `='
* (equals) operator is used. Thus you should define this operator to do
* a bitwise copy. You should probably also define the copy constructor.
*/
#ifndef _ODE_ARRAY_H_
#define _ODE_ARRAY_H_
#include <ode/config.h>
// this base class has no constructors or destructor, for your convenience.
class dArrayBase {
protected:
int _size; // number of elements in `data'
int _anum; // allocated number of elements in `data'
void *_data; // array data
void _freeAll (int sizeofT);
void _setSize (int newsize, int sizeofT);
// set the array size to `newsize', allocating more memory if necessary.
// if newsize>_anum and is a power of two then this is guaranteed to
// set _size and _anum to newsize.
public:
// not: dArrayBase () { _size=0; _anum=0; _data=0; }
int size() const { return _size; }
int allocatedSize() const { return _anum; }
void * operator new (size_t size);
void operator delete (void *ptr, size_t size);
void constructor() { _size=0; _anum=0; _data=0; }
// if this structure is allocated with malloc() instead of new, you can
// call this to set it up.
void constructLocalArray (int __anum);
// this helper function allows non-reallocating arrays to be constructed
// on the stack (or in the heap if necessary). this is something of a
// kludge and should be used with extreme care. this function acts like
// a constructor - it is called on uninitialized memory that will hold the
// Array structure and the data. __anum is the number of elements that
// are allocated. the memory MUST be allocated with size:
// sizeof(ArrayBase) + __anum*sizeof(T)
// arrays allocated this way will never try to reallocate or free the
// memory - that's your job.
};
template <class T> class dArray : public dArrayBase {
public:
void equals (const dArray<T> &x) {
setSize (x.size());
memcpy (_data,x._data,x._size * sizeof(T));
}
dArray () { constructor(); }
dArray (const dArray<T> &x) { constructor(); equals (x); }
~dArray () { _freeAll(sizeof(T)); }
void setSize (int newsize) { _setSize (newsize,sizeof(T)); }
T *data() const { return (T*) _data; }
T & operator[] (int i) const { return ((T*)_data)[i]; }
void operator = (const dArray<T> &x) { equals (x); }
void push (const T item) {
if (_size < _anum) _size++; else _setSize (_size+1,sizeof(T));
memcpy (&(((T*)_data)[_size-1]), &item, sizeof(T));
}
void swap (dArray<T> &x) {
int tmp1;
void *tmp2;
tmp1=_size; _size=x._size; x._size=tmp1;
tmp1=_anum; _anum=x._anum; x._anum=tmp1;
tmp2=_data; _data=x._data; x._data=tmp2;
}
// insert the item at the position `i'. if i<0 then add the item to the
// start, if i >= size then add the item to the end of the array.
void insert (int i, const T item) {
if (_size < _anum) _size++; else _setSize (_size+1,sizeof(T));
if (i >= (_size-1)) i = _size-1; // add to end
else {
if (i < 0) i=0; // add to start
int n = _size-1-i;
if (n>0) memmove (((T*)_data) + i+1, ((T*)_data) + i, n*sizeof(T));
}
((T*)_data)[i] = item;
}
void remove (int i) {
if (i >= 0 && i < _size) { // passing this test guarantees size>0
int n = _size-1-i;
if (n>0) memmove (((T*)_data) + i, ((T*)_data) + i+1, n*sizeof(T));
_size--;
}
}
};
#endif

View File

@ -1,122 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// Convex collision detection (Bullet GJK) by Erwin Coumans, http://www.continuousphysics.com/Bullet/
//
// Convex Integration is work in progress, so most users can ignore this file!
// Report suggestions/bugs in Bullet forum:
// http://www.continuousphysics.com/Bullet/phpBB2/
//
#ifdef BULLET_CONVEX_SUPPORT
#include "collision_convex_internal.h"
#include <CollisionShapes/CollisionShape.h>
#include "BulletOdeTransformConvert.h"
#include "BulletOdeCollide.h"
//****************************************************************************
// convex object public API
int dCollideConvexConvex(dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip)
{
dIASSERT (skip >= (int)sizeof(dContactGeom));
contact->g1 = o1;
contact->g2 = o2;
return BulletOdeCollide(o1,o2,contact,flags & NUMC_MASK,skip);
}
dxConvex::dxConvex (dSpaceID space, class CollisionShape* shape) : dxGeom (space,1)
{
type = dConvexClass;
m_bulletCollisionShape = shape;
}
void GetAabbFromConvex(dGeomID geom,dVector3 halfExtents,dVector3 aabbCenter)
{
CollisionShape* shape = GetCollisionShapeFromConvex(geom);
SimdVector3 aabbMin,aabbMax;
SimdTransform tr;
tr.setIdentity();
shape->GetAabb(tr,aabbMin,aabbMax);
SimdVector3 aabbHalfExtents = (aabbMax-aabbMin)*0.5f;
SimdVector3 center = (aabbMax+aabbMin)*0.5f;
halfExtents[0] = aabbHalfExtents[0];
halfExtents[1] = aabbHalfExtents[1];
halfExtents[2] = aabbHalfExtents[2];
aabbCenter[0] = center [0];
aabbCenter[1] = center [1];
aabbCenter[2] = center [2];
}
void dxConvex::computeAABB()
{
dReal xrange = 1e30;
dReal yrange = 1e30f;
dReal zrange = 1e30f;
CollisionShape* shape = GetCollisionShapeFromConvex(this);
SimdVector3 aabbMin,aabbMax;
SimdTransform tr = GetTransformFromGeom(this);
shape->GetAabb(tr,aabbMin,aabbMax);
aabb[0] = aabbMin[0];
aabb[1] = aabbMax[0];
aabb[2] = aabbMin[1];
aabb[3] = aabbMax[1];
aabb[4] = aabbMin[2];
aabb[5] = aabbMax[2];
}
void dGeomConvexGetLengths(dGeomID convex, dVector3 result)
{
dUASSERT (convex && convex->type == dConvexClass,"argument not a convex");
dxConvex* cnvx = (dxConvex*) convex;
dVector3 center;
GetAabbFromConvex(convex,result,center);
result[0]*=2.f;
result[1]*=2.f;
result[2]*=2.f;
}
dGeomID dCreateConvex(dSpaceID space, class CollisionShape* shape)
{
return new dxConvex(space,shape);
}
#endif //BULLET_CONVEX_SUPPORT

View File

@ -1,48 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// Convex (Bullet) GJK code by Erwin Coumans, http://www.continuousphysics.com/Bullet/
#ifndef COLLISION_CONVEX_INTERNAL_H
#define COLLISION_CONVEX_INTERNAL_H
#include <ode/collision.h>
#include <ode/matrix.h>
#include <ode/rotation.h>
#include <ode/odemath.h>
#include "collision_util.h"
#include "collision_kernel.h"
//Bullet class
class CollisionShape;
/// General Convex shape support using Bullet GJK
struct dxConvex : public dxGeom {
class CollisionShape* m_bulletCollisionShape;
dxConvex (dSpaceID space, class CollisionShape* shape);
void computeAABB();
};
void GetAabbFromConvex(dGeomID geom,dVector3 halfExtents,dVector3 aabbCenter);
#endif //COLLISION_CONVEX_INTERNAL_H

View File

@ -1,628 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
core collision functions and data structures, plus part of the public API
for geometry objects
*/
#include <ode/common.h>
#include <ode/matrix.h>
#include <ode/rotation.h>
#include <ode/objects.h>
#include "collision_kernel.h"
#include "collision_util.h"
#include "collision_std.h"
#include "collision_transform.h"
#include "collision_trimesh_internal.h"
#ifdef _MSC_VER
#pragma warning(disable:4291) // for VC++, no complaints about "no matching operator delete found"
#endif
//****************************************************************************
// helper functions for dCollide()ing a space with another geom
// this struct records the parameters passed to dCollideSpaceGeom()
struct SpaceGeomColliderData {
int flags; // space left in contacts array
dContactGeom *contact;
int skip;
};
static void space_geom_collider (void *data, dxGeom *o1, dxGeom *o2)
{
SpaceGeomColliderData *d = (SpaceGeomColliderData*) data;
if (d->flags & NUMC_MASK) {
int n = dCollide (o1,o2,d->flags,d->contact,d->skip);
d->contact = CONTACT (d->contact,d->skip*n);
d->flags -= n;
}
}
static int dCollideSpaceGeom (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip)
{
SpaceGeomColliderData data;
data.flags = flags;
data.contact = contact;
data.skip = skip;
dSpaceCollide2 (o1,o2,&data,&space_geom_collider);
return (flags & NUMC_MASK) - (data.flags & NUMC_MASK);
}
//****************************************************************************
// dispatcher for the N^2 collider functions
// function pointers and modes for n^2 class collider functions
struct dColliderEntry {
dColliderFn *fn; // collider function, 0 = no function available
int reverse; // 1 = reverse o1 and o2
};
static dColliderEntry colliders[dGeomNumClasses][dGeomNumClasses];
static int colliders_initialized = 0;
// setCollider() will refuse to write over a collider entry once it has
// been written.
void setCollider (int i, int j, dColliderFn *fn)
{
if (colliders[i][j].fn == 0) {
colliders[i][j].fn = fn;
colliders[i][j].reverse = 0;
}
if (colliders[j][i].fn == 0) {
colliders[j][i].fn = fn;
colliders[j][i].reverse = 1;
}
}
static void setAllColliders (int i, dColliderFn *fn)
{
for (int j=0; j<dGeomNumClasses; j++) setCollider (i,j,fn);
}
static void initColliders()
{
int i,j;
if (colliders_initialized) return;
colliders_initialized = 1;
memset (colliders,0,sizeof(colliders));
// setup space colliders
for (i=dFirstSpaceClass; i <= dLastSpaceClass; i++) {
for (j=0; j < dGeomNumClasses; j++) {
setCollider (i,j,&dCollideSpaceGeom);
}
}
setCollider (dSphereClass,dSphereClass,&dCollideSphereSphere);
setCollider (dSphereClass,dBoxClass,&dCollideSphereBox);
setCollider (dSphereClass,dPlaneClass,&dCollideSpherePlane);
setCollider (dBoxClass,dBoxClass,&dCollideBoxBox);
setCollider (dBoxClass,dPlaneClass,&dCollideBoxPlane);
setCollider (dCCylinderClass,dSphereClass,&dCollideCCylinderSphere);
setCollider (dCCylinderClass,dBoxClass,&dCollideCCylinderBox);
setCollider (dCCylinderClass,dCCylinderClass,&dCollideCCylinderCCylinder);
setCollider (dCCylinderClass,dPlaneClass,&dCollideCCylinderPlane);
setCollider (dRayClass,dSphereClass,&dCollideRaySphere);
setCollider (dRayClass,dBoxClass,&dCollideRayBox);
setCollider (dRayClass,dCCylinderClass,&dCollideRayCCylinder);
setCollider (dRayClass,dPlaneClass,&dCollideRayPlane);
#ifdef dTRIMESH_ENABLED
setCollider (dTriMeshClass,dSphereClass,&dCollideSTL);
setCollider (dTriMeshClass,dBoxClass,&dCollideBTL);
setCollider (dTriMeshClass,dRayClass,&dCollideRTL);
setCollider (dTriMeshClass,dTriMeshClass,&dCollideTTL);
setCollider (dTriMeshClass,dCCylinderClass,&dCollideCCTL);
#endif
setAllColliders (dGeomTransformClass,&dCollideTransform);
}
int dCollide (dxGeom *o1, dxGeom *o2, int flags, dContactGeom *contact,
int skip)
{
dAASSERT(o1 && o2 && contact);
dUASSERT(colliders_initialized,"colliders array not initialized");
dUASSERT(o1->type >= 0 && o1->type < dGeomNumClasses,"bad o1 class number");
dUASSERT(o2->type >= 0 && o2->type < dGeomNumClasses,"bad o2 class number");
// no contacts if both geoms are the same
if (o1 == o2) return 0;
// no contacts if both geoms on the same body, and the body is not 0
if (o1->body == o2->body && o1->body) return 0;
dColliderEntry *ce = &colliders[o1->type][o2->type];
int count = 0;
if (ce->fn) {
if (ce->reverse) {
count = (*ce->fn) (o2,o1,flags,contact,skip);
for (int i=0; i<count; i++) {
dContactGeom *c = CONTACT(contact,skip*i);
c->normal[0] = -c->normal[0];
c->normal[1] = -c->normal[1];
c->normal[2] = -c->normal[2];
dxGeom *tmp = c->g1;
c->g1 = c->g2;
c->g2 = tmp;
}
}
else {
count = (*ce->fn) (o1,o2,flags,contact,skip);
}
}
return count;
}
//****************************************************************************
// dxGeom
dxGeom::dxGeom (dSpaceID _space, int is_placeable)
{
initColliders();
// setup body vars. invalid type of -1 must be changed by the constructor.
type = -1;
gflags = GEOM_DIRTY | GEOM_AABB_BAD | GEOM_ENABLED;
if (is_placeable) gflags |= GEOM_PLACEABLE;
data = 0;
body = 0;
body_next = 0;
if (is_placeable) {
dxPosR *pr = (dxPosR*) dAlloc (sizeof(dxPosR));
pos = pr->pos;
R = pr->R;
dSetZero (pos,4);
dRSetIdentity (R);
}
else {
pos = 0;
R = 0;
}
// setup space vars
next = 0;
tome = 0;
parent_space = 0;
dSetZero (aabb,6);
category_bits = ~0;
collide_bits = ~0;
// put this geom in a space if required
if (_space) dSpaceAdd (_space,this);
}
dxGeom::~dxGeom()
{
if (parent_space) dSpaceRemove (parent_space,this);
if ((gflags & GEOM_PLACEABLE) && !body) dFree (pos,sizeof(dxPosR));
bodyRemove();
}
int dxGeom::AABBTest (dxGeom *o, dReal aabb[6])
{
return 1;
}
void dxGeom::bodyRemove()
{
if (body) {
// delete this geom from body list
dxGeom **last = &body->geom, *g = body->geom;
while (g) {
if (g == this) {
*last = g->body_next;
break;
}
last = &g->body_next;
g = g->body_next;
}
body = 0;
body_next = 0;
}
}
//****************************************************************************
// misc
dxGeom *dGeomGetBodyNext (dxGeom *geom)
{
return geom->body_next;
}
//****************************************************************************
// public API for geometry objects
#define CHECK_NOT_LOCKED(space) \
dUASSERT (!(space && space->lock_count), \
"invalid operation for geom in locked space");
void dGeomDestroy (dxGeom *g)
{
dAASSERT (g);
delete g;
}
void dGeomSetData (dxGeom *g, void *data)
{
dAASSERT (g);
g->data = data;
}
void *dGeomGetData (dxGeom *g)
{
dAASSERT (g);
return g->data;
}
void dGeomSetBody (dxGeom *g, dxBody *b)
{
dAASSERT (g);
dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
CHECK_NOT_LOCKED (g->parent_space);
if (b) {
if (!g->body) dFree (g->pos,sizeof(dxPosR));
g->pos = b->pos;
g->R = b->R;
dGeomMoved (g);
if (g->body != b) {
g->bodyRemove();
g->bodyAdd (b);
}
}
else {
if (g->body) {
dxPosR *pr = (dxPosR*) dAlloc (sizeof(dxPosR));
g->pos = pr->pos;
g->R = pr->R;
memcpy (g->pos,g->body->pos,sizeof(dVector3));
memcpy (g->R,g->body->R,sizeof(dMatrix3));
g->bodyRemove();
}
// dGeomMoved() should not be called if the body is being set to 0, as the
// new position of the geom is set to the old position of the body, so the
// effective position of the geom remains unchanged.
}
}
dBodyID dGeomGetBody (dxGeom *g)
{
dAASSERT (g);
return g->body;
}
void dGeomSetPosition (dxGeom *g, dReal x, dReal y, dReal z)
{
dAASSERT (g);
dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
CHECK_NOT_LOCKED (g->parent_space);
if (g->body) {
// this will call dGeomMoved (g), so we don't have to
dBodySetPosition (g->body,x,y,z);
}
else {
g->pos[0] = x;
g->pos[1] = y;
g->pos[2] = z;
dGeomMoved (g);
}
}
void dGeomSetRotation (dxGeom *g, const dMatrix3 R)
{
dAASSERT (g && R);
dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
CHECK_NOT_LOCKED (g->parent_space);
if (g->body) {
// this will call dGeomMoved (g), so we don't have to
dBodySetRotation (g->body,R);
}
else {
memcpy (g->R,R,sizeof(dMatrix3));
dGeomMoved (g);
}
}
void dGeomSetQuaternion (dxGeom *g, const dQuaternion quat)
{
dAASSERT (g && quat);
dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
CHECK_NOT_LOCKED (g->parent_space);
if (g->body) {
// this will call dGeomMoved (g), so we don't have to
dBodySetQuaternion (g->body,quat);
}
else {
dQtoR (quat, g->R);
dGeomMoved (g);
}
}
const dReal * dGeomGetPosition (dxGeom *g)
{
dAASSERT (g);
dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
return g->pos;
}
const dReal * dGeomGetRotation (dxGeom *g)
{
dAASSERT (g);
dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
return g->R;
}
void dGeomGetQuaternion (dxGeom *g, dQuaternion quat)
{
dAASSERT (g);
dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
if (g->body) {
const dReal * body_quat = dBodyGetQuaternion (g->body);
quat[0] = body_quat[0];
quat[1] = body_quat[1];
quat[2] = body_quat[2];
quat[3] = body_quat[3];
}
else {
dRtoQ (g->R, quat);
}
}
void dGeomGetAABB (dxGeom *g, dReal aabb[6])
{
dAASSERT (g);
dAASSERT (aabb);
g->recomputeAABB();
memcpy (aabb,g->aabb,6 * sizeof(dReal));
}
int dGeomIsSpace (dxGeom *g)
{
dAASSERT (g);
return IS_SPACE(g);
}
dSpaceID dGeomGetSpace (dxGeom *g)
{
dAASSERT (g);
return g->parent_space;
}
int dGeomGetClass (dxGeom *g)
{
dAASSERT (g);
return g->type;
}
void dGeomSetCategoryBits (dxGeom *g, unsigned long bits)
{
dAASSERT (g);
CHECK_NOT_LOCKED (g->parent_space);
g->category_bits = bits;
}
void dGeomSetCollideBits (dxGeom *g, unsigned long bits)
{
dAASSERT (g);
CHECK_NOT_LOCKED (g->parent_space);
g->collide_bits = bits;
}
unsigned long dGeomGetCategoryBits (dxGeom *g)
{
dAASSERT (g);
return g->category_bits;
}
unsigned long dGeomGetCollideBits (dxGeom *g)
{
dAASSERT (g);
return g->collide_bits;
}
void dGeomEnable (dxGeom *g)
{
dAASSERT (g);
g->gflags |= GEOM_ENABLED;
}
void dGeomDisable (dxGeom *g)
{
dAASSERT (g);
g->gflags &= ~GEOM_ENABLED;
}
int dGeomIsEnabled (dxGeom *g)
{
dAASSERT (g);
return (g->gflags & GEOM_ENABLED) != 0;
}
//****************************************************************************
// C interface that lets the user make new classes. this interface is a lot
// more cumbersome than C++ subclassing, which is what is used internally
// in ODE. this API is mainly to support legacy code.
static int num_user_classes = 0;
static dGeomClass user_classes [dMaxUserClasses];
struct dxUserGeom : public dxGeom {
void *user_data;
dxUserGeom (int class_num);
~dxUserGeom();
void computeAABB();
int AABBTest (dxGeom *o, dReal aabb[6]);
};
dxUserGeom::dxUserGeom (int class_num) : dxGeom (0,1)
{
type = class_num;
int size = user_classes[type-dFirstUserClass].bytes;
user_data = dAlloc (size);
memset (user_data,0,size);
}
dxUserGeom::~dxUserGeom()
{
dGeomClass *c = &user_classes[type-dFirstUserClass];
if (c->dtor) c->dtor (this);
dFree (user_data,c->bytes);
}
void dxUserGeom::computeAABB()
{
user_classes[type-dFirstUserClass].aabb (this,aabb);
}
int dxUserGeom::AABBTest (dxGeom *o, dReal aabb[6])
{
dGeomClass *c = &user_classes[type-dFirstUserClass];
if (c->aabb_test) return c->aabb_test (this,o,aabb);
else return 1;
}
static int dCollideUserGeomWithGeom (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip)
{
// this generic collider function is called the first time that a user class
// tries to collide against something. it will find out the correct collider
// function and then set the colliders array so that the correct function is
// called directly the next time around.
int t1 = o1->type; // note that o1 is a user geom
int t2 = o2->type; // o2 *may* be a user geom
// find the collider function to use. if o1 does not know how to collide with
// o2, then o2 might know how to collide with o1 (provided that it is a user
// geom).
dColliderFn *fn = user_classes[t1-dFirstUserClass].collider (t2);
int reverse = 0;
if (!fn && t2 >= dFirstUserClass && t2 <= dLastUserClass) {
fn = user_classes[t2-dFirstUserClass].collider (t1);
reverse = 1;
}
// set the colliders array so that the correct function is called directly
// the next time around. note that fn can be 0 here if no collider was found,
// which means that dCollide() will always return 0 for this case.
colliders[t1][t2].fn = fn;
colliders[t1][t2].reverse = reverse;
colliders[t2][t1].fn = fn;
colliders[t2][t1].reverse = !reverse;
// now call the collider function indirectly through dCollide(), so that
// contact reversing is properly handled.
return dCollide (o1,o2,flags,contact,skip);
}
int dCreateGeomClass (const dGeomClass *c)
{
dUASSERT(c && c->bytes >= 0 && c->collider && c->aabb,"bad geom class");
if (num_user_classes >= dMaxUserClasses) {
dDebug (0,"too many user classes, you must increase the limit and "
"recompile ODE");
}
user_classes[num_user_classes] = *c;
int class_number = num_user_classes + dFirstUserClass;
initColliders();
setAllColliders (class_number,&dCollideUserGeomWithGeom);
num_user_classes++;
return class_number;
}
void * dGeomGetClassData (dxGeom *g)
{
dUASSERT (g && g->type >= dFirstUserClass &&
g->type <= dLastUserClass,"not a custom class");
dxUserGeom *user = (dxUserGeom*) g;
return user->user_data;
}
dGeomID dCreateGeom (int classnum)
{
dUASSERT (classnum >= dFirstUserClass &&
classnum <= dLastUserClass,"not a custom class");
return new dxUserGeom (classnum);
}
//****************************************************************************
// here is where we deallocate any memory that has been globally
// allocated, or free other global resources.
void dCloseODE()
{
colliders_initialized = 0;
num_user_classes = 0;
}

View File

@ -1,203 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
internal data structures and functions for collision detection.
*/
#ifndef _ODE_COLLISION_KERNEL_H_
#define _ODE_COLLISION_KERNEL_H_
#include <ode/common.h>
#include <ode/contact.h>
#include <ode/collision.h>
#include "objects.h"
//****************************************************************************
// constants and macros
// mask for the number-of-contacts field in the dCollide() flags parameter
#define NUMC_MASK (0xffff)
#define IS_SPACE(geom) \
((geom)->type >= dFirstSpaceClass && (geom)->type <= dLastSpaceClass)
//****************************************************************************
// geometry object base class
// position vector and rotation matrix for geometry objects that are not
// connected to bodies.
struct dxPosR {
dVector3 pos;
dMatrix3 R;
};
void setCollider (int i, int j, dColliderFn *fn);
// geom flags.
//
// GEOM_DIRTY means that the space data structures for this geom are
// potentially not up to date. NOTE THAT all space parents of a dirty geom
// are themselves dirty. this is an invariant that must be enforced.
//
// GEOM_AABB_BAD means that the cached AABB for this geom is not up to date.
// note that GEOM_DIRTY does not imply GEOM_AABB_BAD, as the geom might
// recalculate its own AABB but does not know how to update the space data
// structures for the space it is in. but GEOM_AABB_BAD implies GEOM_DIRTY.
// the valid combinations are: 0, GEOM_DIRTY, GEOM_DIRTY|GEOM_AABB_BAD.
enum {
GEOM_DIRTY = 1, // geom is 'dirty', i.e. position unknown
GEOM_AABB_BAD = 2, // geom's AABB is not valid
GEOM_PLACEABLE = 4, // geom is placeable
GEOM_ENABLED = 8, // geom is enabled
// Ray specific
RAY_FIRSTCONTACT = 0x10000,
RAY_BACKFACECULL = 0x20000,
RAY_CLOSEST_HIT = 0x40000
};
// geometry object base class. pos and R will either point to a separately
// allocated buffer (if body is 0 - pos points to the dxPosR object) or to
// the pos and R of the body (if body nonzero).
// a dGeomID is a pointer to this object.
struct dxGeom : public dBase {
int type; // geom type number, set by subclass constructor
int gflags; // flags used by geom and space
void *data; // user-defined data pointer
dBodyID body; // dynamics body associated with this object (if any)
dxGeom *body_next; // next geom in body's linked list of associated geoms
dReal *pos; // pointer to object's position vector
dReal *R; // pointer to object's rotation matrix
// information used by spaces
dxGeom *next; // next geom in linked list of geoms
dxGeom **tome; // linked list backpointer
dxSpace *parent_space;// the space this geom is contained in, 0 if none
dReal aabb[6]; // cached AABB for this space
unsigned long category_bits,collide_bits;
dxGeom (dSpaceID _space, int is_placeable);
virtual ~dxGeom();
virtual void computeAABB()=0;
// compute the AABB for this object and put it in aabb. this function
// always performs a fresh computation, it does not inspect the
// GEOM_AABB_BAD flag.
virtual int AABBTest (dxGeom *o, dReal aabb[6]);
// test whether the given AABB object intersects with this object, return
// 1=yes, 0=no. this is used as an early-exit test in the space collision
// functions. the default implementation returns 1, which is the correct
// behavior if no more detailed implementation can be provided.
// utility functions
// compute the AABB only if it is not current. this function manipulates
// the GEOM_AABB_BAD flag.
void recomputeAABB() {
if (gflags & GEOM_AABB_BAD) {
computeAABB();
gflags &= ~GEOM_AABB_BAD;
}
}
// add and remove this geom from a linked list maintained by a space.
void spaceAdd (dxGeom **first_ptr) {
next = *first_ptr;
tome = first_ptr;
if (*first_ptr) (*first_ptr)->tome = &next;
*first_ptr = this;
}
void spaceRemove() {
if (next) next->tome = tome;
*tome = next;
}
// add and remove this geom from a linked list maintained by a body.
void bodyAdd (dxBody *b) {
body = b;
body_next = b->geom;
b->geom = this;
}
void bodyRemove();
};
//****************************************************************************
// the base space class
//
// the contained geoms are divided into two kinds: clean and dirty.
// the clean geoms have not moved since they were put in the list,
// and their AABBs are valid. the dirty geoms have changed position, and
// their AABBs are may not be valid. the two types are distinguished by the
// GEOM_DIRTY flag. all dirty geoms come *before* all clean geoms in the list.
struct dxSpace : public dxGeom {
int count; // number of geoms in this space
dxGeom *first; // first geom in list
int cleanup; // cleanup mode, 1=destroy geoms on exit
// cached state for getGeom()
int current_index; // only valid if current_geom != 0
dxGeom *current_geom; // if 0 then there is no information
// locking stuff. the space is locked when it is currently traversing its
// internal data structures, e.g. in collide() and collide2(). operations
// that modify the contents of the space are not permitted when the space
// is locked.
int lock_count;
dxSpace (dSpaceID _space);
~dxSpace();
void computeAABB();
void setCleanup (int mode);
int getCleanup();
int query (dxGeom *geom);
int getNumGeoms();
virtual dxGeom *getGeom (int i);
virtual void add (dxGeom *);
virtual void remove (dxGeom *);
virtual void dirty (dxGeom *);
virtual void cleanGeoms()=0;
// turn all dirty geoms into clean geoms by computing their AABBs and any
// other space data structures that are required. this should clear the
// GEOM_DIRTY and GEOM_AABB_BAD flags of all geoms.
virtual void collide (void *data, dNearCallback *callback)=0;
virtual void collide2 (void *data, dxGeom *geom, dNearCallback *callback)=0;
};
#endif

View File

@ -1,583 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// QuadTreeSpace by Erwin de Vries.
#include <ode/common.h>
#include <ode/matrix.h>
#include <ode/collision_space.h>
#include <ode/collision.h>
#include "collision_kernel.h"
#include "collision_space_internal.h"
#define AXIS0 0
#define AXIS1 1
#define UP 2
//#define DRAWBLOCKS
const int SPLITAXIS = 2;
const int SPLITS = SPLITAXIS * SPLITAXIS;
#define GEOM_ENABLED(g) (g)->gflags & GEOM_ENABLED
class Block{
public:
dReal MinX, MaxX;
dReal MinZ, MaxZ;
dGeomID First;
int GeomCount;
Block* Parent;
Block* Children;
void Create(const dVector3 Center, const dVector3 Extents, Block* Parent, int Depth, Block*& Blocks);
void Collide(void* UserData, dNearCallback* Callback);
void Collide(dGeomID Object, dGeomID g, void* UserData, dNearCallback* Callback);
void CollideLocal(dGeomID Object, void* UserData, dNearCallback* Callback);
void AddObject(dGeomID Object);
void DelObject(dGeomID Object);
void Traverse(dGeomID Object);
bool Inside(const dReal* AABB);
Block* GetBlock(const dReal* AABB);
Block* GetBlockChild(const dReal* AABB);
};
#ifdef DRAWBLOCKS
#include "..\..\Include\drawstuff\\drawstuff.h"
static void DrawBlock(Block* Block){
dVector3 v[8];
v[0][AXIS0] = Block->MinX;
v[0][UP] = REAL(-1.0);
v[0][AXIS1] = Block->MinZ;
v[1][AXIS0] = Block->MinX;
v[1][UP] = REAL(-1.0);
v[1][AXIS1] = Block->MaxZ;
v[2][AXIS0] = Block->MaxX;
v[2][UP] = REAL(-1.0);
v[2][AXIS1] = Block->MinZ;
v[3][AXIS0] = Block->MaxX;
v[3][UP] = REAL(-1.0);
v[3][AXIS1] = Block->MaxZ;
v[4][AXIS0] = Block->MinX;
v[4][UP] = REAL(1.0);
v[4][AXIS1] = Block->MinZ;
v[5][AXIS0] = Block->MinX;
v[5][UP] = REAL(1.0);
v[5][AXIS1] = Block->MaxZ;
v[6][AXIS0] = Block->MaxX;
v[6][UP] = REAL(1.0);
v[6][AXIS1] = Block->MinZ;
v[7][AXIS0] = Block->MaxX;
v[7][UP] = REAL(1.0);
v[7][AXIS1] = Block->MaxZ;
// Bottom
dsDrawLine(v[0], v[1]);
dsDrawLine(v[1], v[3]);
dsDrawLine(v[3], v[2]);
dsDrawLine(v[2], v[0]);
// Top
dsDrawLine(v[4], v[5]);
dsDrawLine(v[5], v[7]);
dsDrawLine(v[7], v[6]);
dsDrawLine(v[6], v[4]);
// Sides
dsDrawLine(v[0], v[4]);
dsDrawLine(v[1], v[5]);
dsDrawLine(v[2], v[6]);
dsDrawLine(v[3], v[7]);
}
#endif //DRAWBLOCKS
void Block::Create(const dVector3 Center, const dVector3 Extents, Block* Parent, int Depth, Block*& Blocks){
GeomCount = 0;
First = 0;
MinX = Center[AXIS0] - Extents[AXIS0];
MaxX = Center[AXIS0] + Extents[AXIS0];
MinZ = Center[AXIS1] - Extents[AXIS1];
MaxZ = Center[AXIS1] + Extents[AXIS1];
this->Parent = Parent;
if (Depth > 0){
Children = Blocks;
Blocks += SPLITS;
dVector3 ChildExtents;
ChildExtents[AXIS0] = Extents[AXIS0] / SPLITAXIS;
ChildExtents[AXIS1] = Extents[AXIS1] / SPLITAXIS;
ChildExtents[UP] = Extents[UP];
for (int i = 0; i < SPLITAXIS; i++){
for (int j = 0; j < SPLITAXIS; j++){
int Index = i * SPLITAXIS + j;
dVector3 ChildCenter;
ChildCenter[AXIS0] = Center[AXIS0] - Extents[AXIS0] + ChildExtents[AXIS0] + i * (ChildExtents[AXIS0] * 2);
ChildCenter[AXIS1] = Center[AXIS1] - Extents[AXIS1] + ChildExtents[AXIS1] + j * (ChildExtents[AXIS1] * 2);
ChildCenter[UP] = Center[UP];
Children[Index].Create(ChildCenter, ChildExtents, this, Depth - 1, Blocks);
}
}
}
else Children = 0;
}
void Block::Collide(void* UserData, dNearCallback* Callback){
#ifdef DRAWBLOCKS
DrawBlock(this);
#endif
// Collide the local list
dxGeom* g = First;
while (g){
if (GEOM_ENABLED(g)){
Collide(g, g->next, UserData, Callback);
}
g = g->next;
}
// Recurse for children
if (Children){
for (int i = 0; i < SPLITS; i++){
if (Children[i].GeomCount <= 1){ // Early out
continue;
}
Children[i].Collide(UserData, Callback);
}
}
}
void Block::Collide(dxGeom* g1, dxGeom* g2, void* UserData, dNearCallback* Callback){
#ifdef DRAWBLOCKS
DrawBlock(this);
#endif
// Collide against local list
while (g2){
if (GEOM_ENABLED(g2)){
collideAABBs (g1, g2, UserData, Callback);
}
g2 = g2->next;
}
// Collide against children
if (Children){
for (int i = 0; i < SPLITS; i++){
// Early out for empty blocks
if (Children[i].GeomCount == 0){
continue;
}
// Does the geom's AABB collide with the block?
// Dont do AABB tests for single geom blocks.
if (Children[i].GeomCount == 1 && Children[i].First){
//
}
else if (true){
if (g1->aabb[AXIS0 * 2 + 0] > Children[i].MaxX ||
g1->aabb[AXIS0 * 2 + 1] < Children[i].MinX ||
g1->aabb[AXIS1 * 2 + 0] > Children[i].MaxZ ||
g1->aabb[AXIS1 * 2 + 1] < Children[i].MinZ) continue;
}
Children[i].Collide(g1, Children[i].First, UserData, Callback);
}
}
}
void Block::CollideLocal(dxGeom* g1, void* UserData, dNearCallback* Callback){
// Collide against local list
dxGeom* g2 = First;
while (g2){
if (GEOM_ENABLED(g2)){
collideAABBs (g1, g2, UserData, Callback);
}
g2 = g2->next;
}
}
void Block::AddObject(dGeomID Object){
// Add the geom
Object->next = First;
First = Object;
Object->tome = (dxGeom**)this;
// Now traverse upwards to tell that we have a geom
Block* Block = this;
do{
Block->GeomCount++;
Block = Block->Parent;
}
while (Block);
}
void Block::DelObject(dGeomID Object){
// Del the geom
dxGeom* g = First;
dxGeom* Last = 0;
while (g){
if (g == Object){
if (Last){
Last->next = g->next;
}
else First = g->next;
break;
}
Last = g;
g = g->next;
}
Object->tome = 0;
// Now traverse upwards to tell that we have lost a geom
Block* Block = this;
do{
Block->GeomCount--;
Block = Block->Parent;
}
while (Block);
}
void Block::Traverse(dGeomID Object){
Block* NewBlock = GetBlock(Object->aabb);
if (NewBlock != this){
// Remove the geom from the old block and add it to the new block.
// This could be more optimal, but the loss should be very small.
DelObject(Object);
NewBlock->AddObject(Object);
}
}
bool Block::Inside(const dReal* AABB){
return AABB[AXIS0 * 2 + 0] >= MinX && AABB[AXIS0 * 2 + 1] <= MaxX && AABB[AXIS1 * 2 + 0] >= MinZ && AABB[AXIS1 * 2 + 1] <= MaxZ;
}
Block* Block::GetBlock(const dReal* AABB){
if (Inside(AABB)){
return GetBlockChild(AABB); // Child or this will have a good block
}
else if (Parent){
return Parent->GetBlock(AABB); // Parent has a good block
}
else return this; // We are at the root, so we have little choice
}
Block* Block::GetBlockChild(const dReal* AABB){
if (Children){
for (int i = 0; i < SPLITS; i++){
if (Children[i].Inside(AABB)){
return Children[i].GetBlockChild(AABB); // Child will have good block
}
}
}
return this; // This is the best block
}
//****************************************************************************
// quadtree space
struct dxQuadTreeSpace : public dxSpace{
Block* Blocks; // Blocks[0] is the root
dArray<dxGeom*> DirtyList;
dxQuadTreeSpace(dSpaceID _space, dVector3 Center, dVector3 Extents, int Depth);
~dxQuadTreeSpace();
dxGeom* getGeom(int i);
void add(dxGeom* g);
void remove(dxGeom* g);
void dirty(dxGeom* g);
void computeAABB();
void cleanGeoms();
void collide(void* UserData, dNearCallback* Callback);
void collide2(void* UserData, dxGeom* g1, dNearCallback* Callback);
// Temp data
Block* CurrentBlock; // Only used while enumerating
int* CurrentChild; // Only used while enumerating
int CurrentLevel; // Only used while enumerating
dxGeom* CurrentObject; // Only used while enumerating
int CurrentIndex;
};
dxQuadTreeSpace::dxQuadTreeSpace(dSpaceID _space, dVector3 Center, dVector3 Extents, int Depth) : dxSpace(_space){
type = dQuadTreeSpaceClass;
int BlockCount = 0;
for (int i = 0; i <= Depth; i++){
BlockCount += (int)powf(SPLITS, i);
}
Blocks = (Block*)dAlloc(BlockCount * sizeof(Block));
Block* Blocks = this->Blocks + 1; // This pointer gets modified!
this->Blocks[0].Create(Center, Extents, 0, Depth, Blocks);
CurrentBlock = 0;
CurrentChild = (int*)dAlloc((Depth + 1) * sizeof(int));
CurrentLevel = 0;
CurrentObject = 0;
CurrentIndex = -1;
// Init AABB. We initialize to infinity because it is not illegal for an object to be outside of the tree. Its simply inserted in the root block
aabb[0] = -dInfinity;
aabb[1] = dInfinity;
aabb[2] = -dInfinity;
aabb[3] = dInfinity;
aabb[4] = -dInfinity;
aabb[5] = dInfinity;
}
dxQuadTreeSpace::~dxQuadTreeSpace(){
int Depth = 0;
Block* Current = &Blocks[0];
while (Current){
Depth++;
Current = Current->Children;
}
int BlockCount = 0;
for (int i = 0; i < Depth; i++){
BlockCount += (int)powf(SPLITS, i);
}
dFree(Blocks, BlockCount * sizeof(Block));
dFree(CurrentChild, (Depth + 1) * sizeof(int));
}
dxGeom* dxQuadTreeSpace::getGeom(int Index){
dUASSERT(Index >= 0 && Index < count, "index out of range");
//@@@
dDebug (0,"dxQuadTreeSpace::getGeom() not yet implemented");
return 0;
// This doesnt work
/*if (CurrentIndex == Index){
// Loop through all objects in the local list
CHILDRECURSE:
if (CurrentObject){
dGeomID g = CurrentObject;
CurrentObject = CurrentObject->next;
CurrentIndex++;
#ifdef DRAWBLOCKS
DrawBlock(CurrentBlock);
#endif //DRAWBLOCKS
return g;
}
else{
// Now lets loop through our children. Starting at index 0.
if (CurrentBlock->Children){
CurrentChild[CurrentLevel] = 0;
PARENTRECURSE:
for (int& i = CurrentChild[CurrentLevel]; i < SPLITS; i++){
if (CurrentBlock->Children[i].GeomCount == 0){
continue;
}
CurrentBlock = &CurrentBlock->Children[i];
CurrentObject = CurrentBlock->First;
i++;
CurrentLevel++;
goto CHILDRECURSE;
}
}
}
// Now lets go back to the parent so it can continue processing its other children.
if (CurrentBlock->Parent){
CurrentBlock = CurrentBlock->Parent;
CurrentLevel--;
goto PARENTRECURSE;
}
}
else{
CurrentBlock = &Blocks[0];
CurrentLevel = 0;
CurrentObject = CurrentObject;
CurrentIndex = 0;
// Other states are already set
CurrentObject = CurrentBlock->First;
}
if (current_geom && current_index == Index - 1){
//current_geom = current_geom->next; // next
current_index = Index;
return current_geom;
}
else for (int i = 0; i < Index; i++){ // this will be verrrrrrry slow
getGeom(i);
}*/
return 0;
}
void dxQuadTreeSpace::add(dxGeom* g){
CHECK_NOT_LOCKED (this);
dAASSERT(g);
dUASSERT(g->parent_space == 0 && g->next == 0, "geom is already in a space");
g->gflags |= GEOM_DIRTY | GEOM_AABB_BAD;
DirtyList.push(g);
// add
g->parent_space = this;
Blocks[0].GetBlock(g->aabb)->AddObject(g); // Add to best block
count++;
// enumerator has been invalidated
current_geom = 0;
dGeomMoved(this);
}
void dxQuadTreeSpace::remove(dxGeom* g){
CHECK_NOT_LOCKED(this);
dAASSERT(g);
dUASSERT(g->parent_space == this,"object is not in this space");
// remove
((Block*)g->tome)->DelObject(g);
count--;
for (int i = 0; i < DirtyList.size(); i++){
if (DirtyList[i] == g){
DirtyList.remove(i);
break;
}
}
// safeguard
g->next = 0;
g->tome = 0;
g->parent_space = 0;
// enumerator has been invalidated
current_geom = 0;
// the bounding box of this space (and that of all the parents) may have
// changed as a consequence of the removal.
dGeomMoved(this);
}
void dxQuadTreeSpace::dirty(dxGeom* g){
DirtyList.push(g);
}
void dxQuadTreeSpace::computeAABB(){
//
}
void dxQuadTreeSpace::cleanGeoms(){
// compute the AABBs of all dirty geoms, and clear the dirty flags
lock_count++;
for (int i = 0; i < DirtyList.size(); i++){
dxGeom* g = DirtyList[i];
if (IS_SPACE(g)){
((dxSpace*)g)->cleanGeoms();
}
g->recomputeAABB();
g->gflags &= (~(GEOM_DIRTY|GEOM_AABB_BAD));
((Block*)g->tome)->Traverse(g);
}
DirtyList.setSize(0);
lock_count--;
}
void dxQuadTreeSpace::collide(void* UserData, dNearCallback* Callback){
dAASSERT(Callback);
lock_count++;
cleanGeoms();
Blocks[0].Collide(UserData, Callback);
lock_count--;
}
void dxQuadTreeSpace::collide2(void* UserData, dxGeom* g1, dNearCallback* Callback){
dAASSERT(g1 && Callback);
lock_count++;
cleanGeoms();
g1->recomputeAABB();
if (g1->parent_space == this){
// The block the geom is in
Block* CurrentBlock = (Block*)g1->tome;
// Collide against block and its children
CurrentBlock->Collide(g1, CurrentBlock->First, UserData, Callback);
// Collide against parents
while (true){
CurrentBlock = CurrentBlock->Parent;
if (!CurrentBlock){
break;
}
CurrentBlock->CollideLocal(g1, UserData, Callback);
}
}
else Blocks[0].Collide(g1, Blocks[0].First, UserData, Callback);
lock_count--;
}
dSpaceID dQuadTreeSpaceCreate(dxSpace* space, dVector3 Center, dVector3 Extents, int Depth){
return new dxQuadTreeSpace(space, Center, Extents, Depth);
}

View File

@ -1,785 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
spaces
*/
#include <ode/common.h>
#include <ode/matrix.h>
#include <ode/collision_space.h>
#include <ode/collision.h>
#include "collision_kernel.h"
#include "collision_space_internal.h"
#ifdef _MSC_VER
#pragma warning(disable:4291) // for VC++, no complaints about "no matching operator delete found"
#endif
//****************************************************************************
// make the geom dirty by setting the GEOM_DIRTY and GEOM_BAD_AABB flags
// and moving it to the front of the space's list. all the parents of a
// dirty geom also become dirty.
void dGeomMoved (dxGeom *geom)
{
dAASSERT (geom);
// from the bottom of the space heirarchy up, process all clean geoms
// turning them into dirty geoms.
dxSpace *parent = geom->parent_space;
while (parent && (geom->gflags & GEOM_DIRTY)==0) {
CHECK_NOT_LOCKED (parent);
geom->gflags |= GEOM_DIRTY | GEOM_AABB_BAD;
parent->dirty (geom);
geom = parent;
parent = parent->parent_space;
}
// all the remaining dirty geoms must have their AABB_BAD flags set, to
// ensure that their AABBs get recomputed
while (geom) {
geom->gflags |= GEOM_DIRTY | GEOM_AABB_BAD;
CHECK_NOT_LOCKED (geom->parent_space);
geom = geom->parent_space;
}
}
#define GEOM_ENABLED(g) ((g)->gflags & GEOM_ENABLED)
//****************************************************************************
// dxSpace
dxSpace::dxSpace (dSpaceID _space) : dxGeom (_space,0)
{
count = 0;
first = 0;
cleanup = 1;
current_index = 0;
current_geom = 0;
lock_count = 0;
}
dxSpace::~dxSpace()
{
CHECK_NOT_LOCKED (this);
if (cleanup) {
// note that destroying each geom will call remove()
dxGeom *g,*n;
for (g = first; g; g=n) {
n = g->next;
dGeomDestroy (g);
}
}
else {
dxGeom *g,*n;
for (g = first; g; g=n) {
n = g->next;
remove (g);
}
}
}
void dxSpace::computeAABB()
{
if (first) {
int i;
dReal a[6];
a[0] = dInfinity;
a[1] = -dInfinity;
a[2] = dInfinity;
a[3] = -dInfinity;
a[4] = dInfinity;
a[5] = -dInfinity;
for (dxGeom *g=first; g; g=g->next) {
g->recomputeAABB();
for (i=0; i<6; i += 2) if (g->aabb[i] < a[i]) a[i] = g->aabb[i];
for (i=1; i<6; i += 2) if (g->aabb[i] > a[i]) a[i] = g->aabb[i];
}
memcpy(aabb,a,6*sizeof(dReal));
}
else {
dSetZero (aabb,6);
}
}
void dxSpace::setCleanup (int mode)
{
cleanup = (mode != 0);
}
int dxSpace::getCleanup()
{
return cleanup;
}
int dxSpace::query (dxGeom *geom)
{
dAASSERT (geom);
return (geom->parent_space == this);
}
int dxSpace::getNumGeoms()
{
return count;
}
// the dirty geoms are numbered 0..k, the clean geoms are numbered k+1..count-1
dxGeom *dxSpace::getGeom (int i)
{
dUASSERT (i >= 0 && i < count,"index out of range");
if (current_geom && current_index == i-1) {
current_geom = current_geom->next;
current_index = i;
return current_geom;
}
else {
dxGeom *g=first;
for (int j=0; j<i; j++) {
if (g) g = g->next; else return 0;
}
current_geom = g;
current_index = i;
return g;
}
}
void dxSpace::add (dxGeom *geom)
{
CHECK_NOT_LOCKED (this);
dAASSERT (geom);
dUASSERT (geom->parent_space == 0 && geom->next == 0,
"geom is already in a space");
// add
geom->parent_space = this;
geom->spaceAdd (&first);
count++;
// enumerator has been invalidated
current_geom = 0;
// new geoms are added to the front of the list and are always
// considered to be dirty. as a consequence, this space and all its
// parents are dirty too.
geom->gflags |= GEOM_DIRTY | GEOM_AABB_BAD;
dGeomMoved (this);
}
void dxSpace::remove (dxGeom *geom)
{
CHECK_NOT_LOCKED (this);
dAASSERT (geom);
dUASSERT (geom->parent_space == this,"object is not in this space");
// remove
geom->spaceRemove();
count--;
// safeguard
geom->next = 0;
geom->tome = 0;
geom->parent_space = 0;
// enumerator has been invalidated
current_geom = 0;
// the bounding box of this space (and that of all the parents) may have
// changed as a consequence of the removal.
dGeomMoved (this);
}
void dxSpace::dirty (dxGeom *geom)
{
geom->spaceRemove();
geom->spaceAdd (&first);
}
//****************************************************************************
// simple space - reports all n^2 object intersections
struct dxSimpleSpace : public dxSpace {
dxSimpleSpace (dSpaceID _space);
void cleanGeoms();
void collide (void *data, dNearCallback *callback);
void collide2 (void *data, dxGeom *geom, dNearCallback *callback);
};
dxSimpleSpace::dxSimpleSpace (dSpaceID _space) : dxSpace (_space)
{
type = dSimpleSpaceClass;
}
void dxSimpleSpace::cleanGeoms()
{
// compute the AABBs of all dirty geoms, and clear the dirty flags
lock_count++;
for (dxGeom *g=first; g && (g->gflags & GEOM_DIRTY); g=g->next) {
if (IS_SPACE(g)) {
((dxSpace*)g)->cleanGeoms();
}
g->recomputeAABB();
g->gflags &= (~(GEOM_DIRTY|GEOM_AABB_BAD));
}
lock_count--;
}
void dxSimpleSpace::collide (void *data, dNearCallback *callback)
{
dAASSERT (callback);
lock_count++;
cleanGeoms();
// intersect all bounding boxes
for (dxGeom *g1=first; g1; g1=g1->next) {
if (GEOM_ENABLED(g1)){
for (dxGeom *g2=g1->next; g2; g2=g2->next) {
if (GEOM_ENABLED(g2)){
collideAABBs (g1,g2,data,callback);
}
}
}
}
lock_count--;
}
void dxSimpleSpace::collide2 (void *data, dxGeom *geom,
dNearCallback *callback)
{
dAASSERT (geom && callback);
lock_count++;
cleanGeoms();
geom->recomputeAABB();
// intersect bounding boxes
for (dxGeom *g=first; g; g=g->next) {
if (GEOM_ENABLED(g)){
collideAABBs (g,geom,data,callback);
}
}
lock_count--;
}
//****************************************************************************
// utility stuff for hash table space
// kind of silly, but oh well...
#ifndef MAXINT
#define MAXINT ((int)((((unsigned int)(-1)) << 1) >> 1))
#endif
// prime[i] is the largest prime smaller than 2^i
#define NUM_PRIMES 31
static long int prime[NUM_PRIMES] = {1L,2L,3L,7L,13L,31L,61L,127L,251L,509L,
1021L,2039L,4093L,8191L,16381L,32749L,65521L,131071L,262139L,
524287L,1048573L,2097143L,4194301L,8388593L,16777213L,33554393L,
67108859L,134217689L,268435399L,536870909L,1073741789L};
// an axis aligned bounding box in the hash table
struct dxAABB {
dxAABB *next; // next in the list of all AABBs
int level; // the level this is stored in (cell size = 2^level)
int dbounds[6]; // AABB bounds, discretized to cell size
dxGeom *geom; // corresponding geometry object (AABB stored here)
int index; // index of this AABB, starting from 0
};
// a hash table node that represents an AABB that intersects a particular cell
// at a particular level
struct Node {
Node *next; // next node in hash table collision list, 0 if none
int x,y,z; // cell position in space, discretized to cell size
dxAABB *aabb; // axis aligned bounding box that intersects this cell
};
// return the `level' of an AABB. the AABB will be put into cells at this
// level - the cell size will be 2^level. the level is chosen to be the
// smallest value such that the AABB occupies no more than 8 cells, regardless
// of its placement. this means that:
// size/2 < q <= size
// where q is the maximum AABB dimension.
static int findLevel (dReal bounds[6])
{
if (bounds[0] <= -dInfinity || bounds[1] >= dInfinity ||
bounds[2] <= -dInfinity || bounds[3] >= dInfinity ||
bounds[4] <= -dInfinity || bounds[5] >= dInfinity) {
return MAXINT;
}
// compute q
dReal q,q2;
q = bounds[1] - bounds[0]; // x bounds
q2 = bounds[3] - bounds[2]; // y bounds
if (q2 > q) q = q2;
q2 = bounds[5] - bounds[4]; // z bounds
if (q2 > q) q = q2;
// find level such that 0.5 * 2^level < q <= 2^level
int level;
frexp (q,&level); // q = (0.5 .. 1.0) * 2^level (definition of frexp)
return level;
}
// find a virtual memory address for a cell at the given level and x,y,z
// position.
// @@@ currently this is not very sophisticated, e.g. the scaling
// factors could be better designed to avoid collisions, and they should
// probably depend on the hash table physical size.
static unsigned long getVirtualAddress (int level, int x, int y, int z)
{
return level*1000 + x*100 + y*10 + z;
}
//****************************************************************************
// hash space
struct dxHashSpace : public dxSpace {
int global_minlevel; // smallest hash table level to put AABBs in
int global_maxlevel; // objects that need a level larger than this will be
// put in a "big objects" list instead of a hash table
dxHashSpace (dSpaceID _space);
void setLevels (int minlevel, int maxlevel);
void getLevels (int *minlevel, int *maxlevel);
void cleanGeoms();
void collide (void *data, dNearCallback *callback);
void collide2 (void *data, dxGeom *geom, dNearCallback *callback);
};
dxHashSpace::dxHashSpace (dSpaceID _space) : dxSpace (_space)
{
type = dHashSpaceClass;
global_minlevel = -3;
global_maxlevel = 10;
}
void dxHashSpace::setLevels (int minlevel, int maxlevel)
{
dAASSERT (minlevel <= maxlevel);
global_minlevel = minlevel;
global_maxlevel = maxlevel;
}
void dxHashSpace::getLevels (int *minlevel, int *maxlevel)
{
if (minlevel) *minlevel = global_minlevel;
if (maxlevel) *maxlevel = global_maxlevel;
}
void dxHashSpace::cleanGeoms()
{
// compute the AABBs of all dirty geoms, and clear the dirty flags
lock_count++;
for (dxGeom *g=first; g && (g->gflags & GEOM_DIRTY); g=g->next) {
if (IS_SPACE(g)) {
((dxSpace*)g)->cleanGeoms();
}
g->recomputeAABB();
g->gflags &= (~(GEOM_DIRTY|GEOM_AABB_BAD));
}
lock_count--;
}
void dxHashSpace::collide (void *data, dNearCallback *callback)
{
dAASSERT(this && callback);
dxGeom *geom;
dxAABB *aabb;
int i,maxlevel;
// 0 or 1 geoms can't collide with anything
if (count < 2) return;
lock_count++;
cleanGeoms();
// create a list of auxiliary information for all geom axis aligned bounding
// boxes. set the level for all AABBs. put AABBs larger than the space's
// global_maxlevel in the big_boxes list, check everything else against
// that list at the end. for AABBs that are not too big, record the maximum
// level that we need.
int n = 0; // number of AABBs in main list
dxAABB *first_aabb = 0; // list of AABBs in hash table
dxAABB *big_boxes = 0; // list of AABBs too big for hash table
maxlevel = global_minlevel - 1;
for (geom = first; geom; geom=geom->next) {
if (!GEOM_ENABLED(geom)){
continue;
}
dxAABB *aabb = (dxAABB*) ALLOCA (sizeof(dxAABB));
aabb->geom = geom;
// compute level, but prevent cells from getting too small
int level = findLevel (geom->aabb);
if (level < global_minlevel) level = global_minlevel;
if (level <= global_maxlevel) {
// aabb goes in main list
aabb->next = first_aabb;
first_aabb = aabb;
aabb->level = level;
if (level > maxlevel) maxlevel = level;
// cellsize = 2^level
dReal cellsize = (dReal) ldexp (1.0,level);
// discretize AABB position to cell size
for (i=0; i < 6; i++) aabb->dbounds[i] = (int)
floor (geom->aabb[i]/cellsize);
// set AABB index
aabb->index = n;
n++;
}
else {
// aabb is too big, put it in the big_boxes list. we don't care about
// setting level, dbounds, index, or the maxlevel
aabb->next = big_boxes;
big_boxes = aabb;
}
}
// for `n' objects, an n*n array of bits is used to record if those objects
// have been intersection-tested against each other yet. this array can
// grow large with high n, but oh well...
int tested_rowsize = (n+7) >> 3; // number of bytes needed for n bits
unsigned char *tested = (unsigned char *) alloca (n * tested_rowsize);
memset (tested,0,n * tested_rowsize);
// create a hash table to store all AABBs. each AABB may take up to 8 cells.
// we use chaining to resolve collisions, but we use a relatively large table
// to reduce the chance of collisions.
// compute hash table size sz to be a prime > 8*n
for (i=0; i<NUM_PRIMES; i++) {
if (prime[i] >= (8*n)) break;
}
if (i >= NUM_PRIMES) i = NUM_PRIMES-1; // probably pointless
int sz = prime[i];
// allocate and initialize hash table node pointers
Node **table = (Node **) ALLOCA (sizeof(Node*) * sz);
for (i=0; i<sz; i++) table[i] = 0;
// add each AABB to the hash table (may need to add it to up to 8 cells)
for (aabb=first_aabb; aabb; aabb=aabb->next) {
int *dbounds = aabb->dbounds;
for (int xi = dbounds[0]; xi <= dbounds[1]; xi++) {
for (int yi = dbounds[2]; yi <= dbounds[3]; yi++) {
for (int zi = dbounds[4]; zi <= dbounds[5]; zi++) {
// get the hash index
unsigned long hi = getVirtualAddress (aabb->level,xi,yi,zi) % sz;
// add a new node to the hash table
Node *node = (Node*) alloca (sizeof (Node));
node->x = xi;
node->y = yi;
node->z = zi;
node->aabb = aabb;
node->next = table[hi];
table[hi] = node;
}
}
}
}
// now that all AABBs are loaded into the hash table, we do the actual
// collision detection. for all AABBs, check for other AABBs in the
// same cells for collisions, and then check for other AABBs in all
// intersecting higher level cells.
int db[6]; // discrete bounds at current level
for (aabb=first_aabb; aabb; aabb=aabb->next) {
// we are searching for collisions with aabb
for (i=0; i<6; i++) db[i] = aabb->dbounds[i];
for (int level = aabb->level; level <= maxlevel; level++) {
for (int xi = db[0]; xi <= db[1]; xi++) {
for (int yi = db[2]; yi <= db[3]; yi++) {
for (int zi = db[4]; zi <= db[5]; zi++) {
// get the hash index
unsigned long hi = getVirtualAddress (level,xi,yi,zi) % sz;
// search all nodes at this index
Node *node;
for (node = table[hi]; node; node=node->next) {
// node points to an AABB that may intersect aabb
if (node->aabb == aabb) continue;
if (node->aabb->level == level &&
node->x == xi && node->y == yi && node->z == zi) {
// see if aabb and node->aabb have already been tested
// against each other
unsigned char mask;
if (aabb->index <= node->aabb->index) {
i = (aabb->index * tested_rowsize)+(node->aabb->index >> 3);
mask = 1 << (node->aabb->index & 7);
}
else {
i = (node->aabb->index * tested_rowsize)+(aabb->index >> 3);
mask = 1 << (aabb->index & 7);
}
dIASSERT (i >= 0 && i < (tested_rowsize*n));
if ((tested[i] & mask)==0) {
collideAABBs (aabb->geom,node->aabb->geom,data,callback);
}
tested[i] |= mask;
}
}
}
}
}
// get the discrete bounds for the next level up
for (i=0; i<6; i++) db[i] >>= 1;
}
}
// every AABB in the normal list must now be intersected against every
// AABB in the big_boxes list. so let's hope there are not too many objects
// in the big_boxes list.
for (aabb=first_aabb; aabb; aabb=aabb->next) {
for (dxAABB *aabb2=big_boxes; aabb2; aabb2=aabb2->next) {
collideAABBs (aabb->geom,aabb2->geom,data,callback);
}
}
// intersected all AABBs in the big_boxes list together
for (aabb=big_boxes; aabb; aabb=aabb->next) {
for (dxAABB *aabb2=aabb->next; aabb2; aabb2=aabb2->next) {
collideAABBs (aabb->geom,aabb2->geom,data,callback);
}
}
lock_count--;
}
void dxHashSpace::collide2 (void *data, dxGeom *geom,
dNearCallback *callback)
{
dAASSERT (geom && callback);
// this could take advantage of the hash structure to avoid
// O(n2) complexity, but it does not yet.
lock_count++;
cleanGeoms();
geom->recomputeAABB();
// intersect bounding boxes
for (dxGeom *g=first; g; g=g->next) {
collideAABBs (g,geom,data,callback);
}
lock_count--;
}
//****************************************************************************
// space functions
dxSpace *dSimpleSpaceCreate (dxSpace *space)
{
return new dxSimpleSpace (space);
}
dxSpace *dHashSpaceCreate (dxSpace *space)
{
return new dxHashSpace (space);
}
void dHashSpaceSetLevels (dxSpace *space, int minlevel, int maxlevel)
{
dAASSERT (space);
dUASSERT (minlevel <= maxlevel,"must have minlevel <= maxlevel");
dUASSERT (space->type == dHashSpaceClass,"argument must be a hash space");
dxHashSpace *hspace = (dxHashSpace*) space;
hspace->setLevels (minlevel,maxlevel);
}
void dHashSpaceGetLevels (dxSpace *space, int *minlevel, int *maxlevel)
{
dAASSERT (space);
dUASSERT (space->type == dHashSpaceClass,"argument must be a hash space");
dxHashSpace *hspace = (dxHashSpace*) space;
hspace->getLevels (minlevel,maxlevel);
}
void dSpaceDestroy (dxSpace *space)
{
dAASSERT (space);
dUASSERT (dGeomIsSpace(space),"argument not a space");
dGeomDestroy (space);
}
void dSpaceSetCleanup (dxSpace *space, int mode)
{
dAASSERT (space);
dUASSERT (dGeomIsSpace(space),"argument not a space");
space->setCleanup (mode);
}
int dSpaceGetCleanup (dxSpace *space)
{
dAASSERT (space);
dUASSERT (dGeomIsSpace(space),"argument not a space");
return space->getCleanup();
}
void dSpaceAdd (dxSpace *space, dxGeom *g)
{
dAASSERT (space);
dUASSERT (dGeomIsSpace(space),"argument not a space");
CHECK_NOT_LOCKED (space);
space->add (g);
}
void dSpaceRemove (dxSpace *space, dxGeom *g)
{
dAASSERT (space);
dUASSERT (dGeomIsSpace(space),"argument not a space");
CHECK_NOT_LOCKED (space);
space->remove (g);
}
int dSpaceQuery (dxSpace *space, dxGeom *g)
{
dAASSERT (space);
dUASSERT (dGeomIsSpace(space),"argument not a space");
return space->query (g);
}
void dSpaceClean (dxSpace *space){
dAASSERT (space);
dUASSERT (dGeomIsSpace(space),"argument not a space");
space->cleanGeoms();
}
int dSpaceGetNumGeoms (dxSpace *space)
{
dAASSERT (space);
dUASSERT (dGeomIsSpace(space),"argument not a space");
return space->getNumGeoms();
}
dGeomID dSpaceGetGeom (dxSpace *space, int i)
{
dAASSERT (space);
dUASSERT (dGeomIsSpace(space),"argument not a space");
return space->getGeom (i);
}
void dSpaceCollide (dxSpace *space, void *data, dNearCallback *callback)
{
dAASSERT (space && callback);
dUASSERT (dGeomIsSpace(space),"argument not a space");
space->collide (data,callback);
}
void dSpaceCollide2 (dxGeom *g1, dxGeom *g2, void *data,
dNearCallback *callback)
{
dAASSERT (g1 && g2 && callback);
dxSpace *s1,*s2;
// see if either geom is a space
if (IS_SPACE(g1)) s1 = (dxSpace*) g1; else s1 = 0;
if (IS_SPACE(g2)) s2 = (dxSpace*) g2; else s2 = 0;
// handle the four space/geom cases
if (s1) {
if (s2) {
// g1 and g2 are spaces.
if (s1==s2) {
// collide a space with itself --> interior collision
s1->collide (data,callback);
}
else {
// iterate through the space that has the fewest geoms, calling
// collide2 in the other space for each one.
if (s1->count < s2->count) {
for (dxGeom *g = s1->first; g; g=g->next) {
s2->collide2 (data,g,callback);
}
}
else {
for (dxGeom *g = s2->first; g; g=g->next) {
s1->collide2 (data,g,callback);
}
}
}
}
else {
// g1 is a space, g2 is a geom
s1->collide2 (data,g2,callback);
}
}
else {
if (s2) {
// g1 is a geom, g2 is a space
s2->collide2 (data,g1,callback);
}
else {
// g1 and g2 are geoms, call the callback directly
callback (data,g1,g2);
}
}
}

View File

@ -1,84 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
stuff common to all spaces
*/
#ifndef _ODE_COLLISION_SPACE_INTERNAL_H_
#define _ODE_COLLISION_SPACE_INTERNAL_H_
#define ALLOCA(x) dALLOCA16(x)
#define CHECK_NOT_LOCKED(space) \
dUASSERT ((space)==0 || (space)->lock_count==0, \
"invalid operation for locked space");
// collide two geoms together. for the hash table space, this is
// called if the two AABBs inhabit the same hash table cells.
// this only calls the callback function if the AABBs actually
// intersect. if a geom has an AABB test function, that is called to
// provide a further refinement of the intersection.
//
// NOTE: this assumes that the geom AABBs are valid on entry
// and that both geoms are enabled.
static void collideAABBs (dxGeom *g1, dxGeom *g2,
void *data, dNearCallback *callback)
{
dIASSERT((g1->gflags & GEOM_AABB_BAD)==0);
dIASSERT((g2->gflags & GEOM_AABB_BAD)==0);
// no contacts if both geoms on the same body, and the body is not 0
if (g1->body == g2->body && g1->body) return;
// test if the category and collide bitfields match
if ( ((g1->category_bits & g2->collide_bits) ||
(g2->category_bits & g1->collide_bits)) == 0) {
return;
}
// if the bounding boxes are disjoint then don't do anything
dReal *bounds1 = g1->aabb;
dReal *bounds2 = g2->aabb;
if (bounds1[0] > bounds2[1] ||
bounds1[1] < bounds2[0] ||
bounds1[2] > bounds2[3] ||
bounds1[3] < bounds2[2] ||
bounds1[4] > bounds2[5] ||
bounds1[5] < bounds2[4]) {
return;
}
// check if either object is able to prove that it doesn't intersect the
// AABB of the other
if (g1->AABBTest (g2,bounds2) == 0) return;
if (g2->AABBTest (g1,bounds1) == 0) return;
// the objects might actually intersect - call the space callback function
callback (data,g1,g2);
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
the standard ODE geometry primitives.
*/
#ifndef _ODE_COLLISION_STD_H_
#define _ODE_COLLISION_STD_H_
#include <ode/common.h>
#include "collision_kernel.h"
// primitive collision functions - these have the dColliderFn interface, i.e.
// the same interface as dCollide(). the first and second geom arguments must
// have the specified types.
int dCollideSphereSphere (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
int dCollideSphereBox (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
int dCollideSpherePlane (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
int dCollideBoxBox (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
int dCollideBoxPlane (dxGeom *o1, dxGeom *o2,
int flags, dContactGeom *contact, int skip);
int dCollideCCylinderSphere (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
int dCollideCCylinderBox (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
int dCollideCCylinderCCylinder (dxGeom *o1, dxGeom *o2,
int flags, dContactGeom *contact, int skip);
int dCollideCCylinderPlane (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
int dCollideRaySphere (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
int dCollideRayBox (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
int dCollideRayCCylinder (dxGeom *o1, dxGeom *o2,
int flags, dContactGeom *contact, int skip);
int dCollideRayPlane (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
///dCollideConvexConvex: see collision_convex.cpp for details
int dCollideConvexConvex(dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
#endif

View File

@ -1,231 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
geom transform
*/
#include <ode/collision.h>
#include <ode/matrix.h>
#include <ode/rotation.h>
#include <ode/odemath.h>
#include "collision_transform.h"
#include "collision_util.h"
#ifdef _MSC_VER
#pragma warning(disable:4291) // for VC++, no complaints about "no matching operator delete found"
#endif
//****************************************************************************
// dxGeomTransform class
struct dxGeomTransform : public dxGeom {
dxGeom *obj; // object that is being transformed
int cleanup; // 1 to destroy obj when destroyed
int infomode; // 1 to put Tx geom in dContactGeom g1
// cached final object transform (body tx + relative tx). this is set by
// computeAABB(), and it is valid while the AABB is valid.
dVector3 final_pos;
dMatrix3 final_R;
dxGeomTransform (dSpaceID space);
~dxGeomTransform();
void computeAABB();
void computeFinalTx();
};
dxGeomTransform::dxGeomTransform (dSpaceID space) : dxGeom (space,1)
{
type = dGeomTransformClass;
obj = 0;
cleanup = 0;
infomode = 0;
dSetZero (final_pos,4);
dRSetIdentity (final_R);
}
dxGeomTransform::~dxGeomTransform()
{
if (obj && cleanup) delete obj;
}
void dxGeomTransform::computeAABB()
{
if (!obj) {
dSetZero (aabb,6);
return;
}
// backup the relative pos and R pointers of the encapsulated geom object
dReal *posbak = obj->pos;
dReal *Rbak = obj->R;
// compute temporary pos and R for the encapsulated geom object
computeFinalTx();
obj->pos = final_pos;
obj->R = final_R;
// compute the AABB
obj->computeAABB();
memcpy (aabb,obj->aabb,6*sizeof(dReal));
// restore the pos and R
obj->pos = posbak;
obj->R = Rbak;
}
// utility function for dCollideTransform() : compute final pos and R
// for the encapsulated geom object
void dxGeomTransform::computeFinalTx()
{
dMULTIPLY0_331 (final_pos,R,obj->pos);
final_pos[0] += pos[0];
final_pos[1] += pos[1];
final_pos[2] += pos[2];
dMULTIPLY0_333 (final_R,R,obj->R);
}
//****************************************************************************
// collider function:
// this collides a transformed geom with another geom. the other geom can
// also be a transformed geom, but this case is not handled specially.
int dCollideTransform (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip)
{
dIASSERT (skip >= (int)sizeof(dContactGeom));
dIASSERT (o1->type == dGeomTransformClass);
dxGeomTransform *tr = (dxGeomTransform*) o1;
if (!tr->obj) return 0;
dUASSERT (tr->obj->parent_space==0,
"GeomTransform encapsulated object must not be in a space");
dUASSERT (tr->obj->body==0,
"GeomTransform encapsulated object must not be attached "
"to a body");
// backup the relative pos and R pointers of the encapsulated geom object,
// and the body pointer
dReal *posbak = tr->obj->pos;
dReal *Rbak = tr->obj->R;
dxBody *bodybak = tr->obj->body;
// compute temporary pos and R for the encapsulated geom object.
// note that final_pos and final_R are valid if no GEOM_AABB_BAD flag,
// because computeFinalTx() will have already been called in
// dxGeomTransform::computeAABB()
if (tr->gflags & GEOM_AABB_BAD) tr->computeFinalTx();
tr->obj->pos = tr->final_pos;
tr->obj->R = tr->final_R;
tr->obj->body = o1->body;
// do the collision
int n = dCollide (tr->obj,o2,flags,contact,skip);
// if required, adjust the 'g1' values in the generated contacts so that
// thay indicated the GeomTransform object instead of the encapsulated
// object.
if (tr->infomode) {
for (int i=0; i<n; i++) {
dContactGeom *c = CONTACT(contact,skip*i);
c->g1 = o1;
}
}
// restore the pos, R and body
tr->obj->pos = posbak;
tr->obj->R = Rbak;
tr->obj->body = bodybak;
return n;
}
//****************************************************************************
// public API
dGeomID dCreateGeomTransform (dSpaceID space)
{
return new dxGeomTransform (space);
}
void dGeomTransformSetGeom (dGeomID g, dGeomID obj)
{
dUASSERT (g && g->type == dGeomTransformClass,
"argument not a geom transform");
dxGeomTransform *tr = (dxGeomTransform*) g;
if (tr->obj && tr->cleanup) delete tr->obj;
tr->obj = obj;
}
dGeomID dGeomTransformGetGeom (dGeomID g)
{
dUASSERT (g && g->type == dGeomTransformClass,
"argument not a geom transform");
dxGeomTransform *tr = (dxGeomTransform*) g;
return tr->obj;
}
void dGeomTransformSetCleanup (dGeomID g, int mode)
{
dUASSERT (g && g->type == dGeomTransformClass,
"argument not a geom transform");
dxGeomTransform *tr = (dxGeomTransform*) g;
tr->cleanup = mode;
}
int dGeomTransformGetCleanup (dGeomID g)
{
dUASSERT (g && g->type == dGeomTransformClass,
"argument not a geom transform");
dxGeomTransform *tr = (dxGeomTransform*) g;
return tr->cleanup;
}
void dGeomTransformSetInfo (dGeomID g, int mode)
{
dUASSERT (g && g->type == dGeomTransformClass,
"argument not a geom transform");
dxGeomTransform *tr = (dxGeomTransform*) g;
tr->infomode = mode;
}
int dGeomTransformGetInfo (dGeomID g)
{
dUASSERT (g && g->type == dGeomTransformClass,
"argument not a geom transform");
dxGeomTransform *tr = (dxGeomTransform*) g;
return tr->infomode;
}

View File

@ -1,40 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
geom transform
*/
#ifndef _ODE_COLLISION_TRANSFORM_H_
#define _ODE_COLLISION_TRANSFORM_H_
#include <ode/common.h>
#include "collision_kernel.h"
int dCollideTransform (dxGeom *o1, dxGeom *o2, int flags,
dContactGeom *contact, int skip);
#endif

View File

@ -1,530 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// TriMesh code by Erwin de Vries.
#include <ode/collision.h>
#include <ode/matrix.h>
#include <ode/rotation.h>
#include <ode/odemath.h>
#include "collision_util.h"
#define TRIMESH_INTERNAL
#include "collision_trimesh_internal.h"
// Trimesh data
dxTriMeshData::dxTriMeshData(){
#ifndef dTRIMESH_ENABLED
dUASSERT(g, "dTRIMESH_ENABLED is not defined. Trimesh geoms will not work");
#endif
}
dxTriMeshData::~dxTriMeshData(){
//
}
void
dxTriMeshData::Build(const void* Vertices, int VertexStide, int VertexCount,
const void* Indices, int IndexCount, int TriStride,
const void* in_Normals,
bool Single){
Mesh.SetNbTriangles(IndexCount / 3);
Mesh.SetNbVertices(VertexCount);
Mesh.SetPointers((IndexedTriangle*)Indices, (Point*)Vertices);
Mesh.SetStrides(TriStride, VertexStide);
Mesh.Single = Single;
// Build tree
BuildSettings Settings;
// recommended in Opcode User Manual
//Settings.mRules = SPLIT_COMPLETE | SPLIT_SPLATTERPOINTS | SPLIT_GEOMCENTER;
// used in ODE, why?
//Settings.mRules = SPLIT_BEST_AXIS;
// best compromise?
Settings.mRules = SPLIT_BEST_AXIS | SPLIT_SPLATTER_POINTS | SPLIT_GEOM_CENTER;
OPCODECREATE TreeBuilder;
TreeBuilder.mIMesh = &Mesh;
TreeBuilder.mSettings = Settings;
TreeBuilder.mNoLeaf = true;
TreeBuilder.mQuantized = false;
TreeBuilder.mKeepOriginal = false;
TreeBuilder.mCanRemap = false;
BVTree.Build(TreeBuilder);
// compute model space AABB
dVector3 AABBMax, AABBMin;
AABBMax[0] = AABBMax[1] = AABBMax[2] = (dReal) -dInfinity;
AABBMin[0] = AABBMin[1] = AABBMin[2] = (dReal) dInfinity;
if( Single ) {
const char* verts = (const char*)Vertices;
for( int i = 0; i < VertexCount; ++i ) {
const float* v = (const float*)verts;
if( v[0] > AABBMax[0] ) AABBMax[0] = v[0];
if( v[1] > AABBMax[1] ) AABBMax[1] = v[1];
if( v[2] > AABBMax[2] ) AABBMax[2] = v[2];
if( v[0] < AABBMin[0] ) AABBMin[0] = v[0];
if( v[1] < AABBMin[1] ) AABBMin[1] = v[1];
if( v[2] < AABBMin[2] ) AABBMin[2] = v[2];
verts += VertexStide;
}
} else {
const char* verts = (const char*)Vertices;
for( int i = 0; i < VertexCount; ++i ) {
const double* v = (const double*)verts;
if( v[0] > AABBMax[0] ) AABBMax[0] = (dReal) v[0];
if( v[1] > AABBMax[1] ) AABBMax[1] = (dReal) v[1];
if( v[2] > AABBMax[2] ) AABBMax[2] = (dReal) v[2];
if( v[0] < AABBMin[0] ) AABBMin[0] = (dReal) v[0];
if( v[1] < AABBMin[1] ) AABBMin[1] = (dReal) v[1];
if( v[2] < AABBMin[2] ) AABBMin[2] = (dReal) v[2];
verts += VertexStide;
}
}
AABBCenter[0] = (AABBMin[0] + AABBMax[0]) * REAL(0.5);
AABBCenter[1] = (AABBMin[1] + AABBMax[1]) * REAL(0.5);
AABBCenter[2] = (AABBMin[2] + AABBMax[2]) * REAL(0.5);
AABBExtents[0] = AABBMax[0] - AABBCenter[0];
AABBExtents[1] = AABBMax[1] - AABBCenter[1];
AABBExtents[2] = AABBMax[2] - AABBCenter[2];
// user data (not used by OPCODE)
for (int i=0; i<16; i++)
last_trans[i] = 0.0;
Normals = (dReal *) in_Normals;
}
dTriMeshDataID dGeomTriMeshDataCreate(){
return new dxTriMeshData();
}
void dGeomTriMeshDataDestroy(dTriMeshDataID g){
delete g;
}
void dGeomTriMeshDataSet(dTriMeshDataID g, int data_id, void* in_data)
{
dUASSERT(g, "argument not trimesh data");
double *elem;
switch (data_id) {
case TRIMESH_FACE_NORMALS:
g->Normals = (dReal *) in_data;
break;
case TRIMESH_LAST_TRANSFORMATION:
elem = (double *) in_data;
for (int i=0; i<16; i++)
g->last_trans[i] = (dReal) elem[i];
break;
default:
dUASSERT(data_id, "invalid data type");
break;
}
return;
}
void* dGeomTriMeshDataGet(dTriMeshDataID g, int data_id)
{
dUASSERT(g, "argument not trimesh data");
switch (data_id) {
case TRIMESH_FACE_NORMALS:
return (void *) g->Normals;
break;
case TRIMESH_LAST_TRANSFORMATION:
return (void *) g->last_trans;
break;
default:
dUASSERT(data_id, "invalid data type");
break;
}
return NULL;
}
void dGeomTriMeshDataBuildSingle1(dTriMeshDataID g,
const void* Vertices, int VertexStride, int VertexCount,
const void* Indices, int IndexCount, int TriStride,
const void* Normals)
{
dUASSERT(g, "argument not trimesh data");
g->Build(Vertices, VertexStride, VertexCount,
Indices, IndexCount, TriStride,
Normals,
true);
}
void dGeomTriMeshDataBuildSingle(dTriMeshDataID g,
const void* Vertices, int VertexStride, int VertexCount,
const void* Indices, int IndexCount, int TriStride)
{
dGeomTriMeshDataBuildSingle1(g, Vertices, VertexStride, VertexCount,
Indices, IndexCount, TriStride, (void*)NULL);
}
void dGeomTriMeshDataBuildDouble1(dTriMeshDataID g,
const void* Vertices, int VertexStride, int VertexCount,
const void* Indices, int IndexCount, int TriStride,
const void* Normals)
{
dUASSERT(g, "argument not trimesh data");
g->Build(Vertices, VertexStride, VertexCount,
Indices, IndexCount, TriStride,
Normals,
false);
}
void dGeomTriMeshDataBuildDouble(dTriMeshDataID g,
const void* Vertices, int VertexStride, int VertexCount,
const void* Indices, int IndexCount, int TriStride) {
dGeomTriMeshDataBuildDouble1(g, Vertices, VertexStride, VertexCount,
Indices, IndexCount, TriStride, NULL);
}
void dGeomTriMeshDataBuildSimple1(dTriMeshDataID g,
const dReal* Vertices, int VertexCount,
const int* Indices, int IndexCount,
const int* Normals){
#ifdef dSINGLE
dGeomTriMeshDataBuildSingle1(g,
Vertices, 4 * sizeof(dReal), VertexCount,
Indices, IndexCount, 3 * sizeof(unsigned int),
Normals);
#else
dGeomTriMeshDataBuildDouble1(g, Vertices, 4 * sizeof(dReal), VertexCount,
Indices, IndexCount, 3 * sizeof(unsigned int),
Normals);
#endif
}
void dGeomTriMeshDataBuildSimple(dTriMeshDataID g,
const dReal* Vertices, int VertexCount,
const int* Indices, int IndexCount) {
dGeomTriMeshDataBuildSimple1(g,
Vertices, VertexCount, Indices, IndexCount,
(const int*)NULL);
}
// Trimesh
PlanesCollider dxTriMesh::_PlanesCollider;
SphereCollider dxTriMesh::_SphereCollider;
OBBCollider dxTriMesh::_OBBCollider;
RayCollider dxTriMesh::_RayCollider;
AABBTreeCollider dxTriMesh::_AABBTreeCollider;
LSSCollider dxTriMesh::_LSSCollider;
SphereCache dxTriMesh::defaultSphereCache;
OBBCache dxTriMesh::defaultBoxCache;
LSSCache dxTriMesh::defaultCCylinderCache;
CollisionFaces dxTriMesh::Faces;
dxTriMesh::dxTriMesh(dSpaceID Space, dTriMeshDataID Data) : dxGeom(Space, 1){
type = dTriMeshClass;
this->Data = Data;
_RayCollider.SetDestination(&Faces);
_PlanesCollider.SetTemporalCoherence(true);
_SphereCollider.SetTemporalCoherence(true);
_SphereCollider.SetPrimitiveTests(false);
_OBBCollider.SetTemporalCoherence(true);
// no first-contact test (i.e. return full contact info)
_AABBTreeCollider.SetFirstContact( false );
// temporal coherence only works with "first conact" tests
_AABBTreeCollider.SetTemporalCoherence(false);
// Perform full BV-BV tests (true) or SAT-lite tests (false)
_AABBTreeCollider.SetFullBoxBoxTest( true );
// Perform full Primitive-BV tests (true) or SAT-lite tests (false)
_AABBTreeCollider.SetFullPrimBoxTest( true );
_LSSCollider.SetTemporalCoherence(false);
/* TC has speed/space 'issues' that don't make it a clear
win by default on spheres/boxes. */
this->doSphereTC = false;
this->doBoxTC = false;
this->doCCylinderTC = false;
const char* msg;
if ((msg =_AABBTreeCollider.ValidateSettings()))
dDebug (d_ERR_UASSERT, msg, " (%s:%d)", __FILE__,__LINE__);
_LSSCollider.SetPrimitiveTests(false);
_LSSCollider.SetFirstContact(false);
}
dxTriMesh::~dxTriMesh(){
//
}
void dxTriMesh::ClearTCCache(){
/* dxTriMesh::ClearTCCache uses dArray's setSize(0) to clear the caches -
but the destructor isn't called when doing this, so we would leak.
So, call the previous caches' containers' destructors by hand first. */
int i, n;
n = SphereTCCache.size();
for( i = 0; i < n; ++i ) {
SphereTCCache[i].~SphereTC();
}
SphereTCCache.setSize(0);
n = BoxTCCache.size();
for( i = 0; i < n; ++i ) {
BoxTCCache[i].~BoxTC();
}
BoxTCCache.setSize(0);
n = CCylinderTCCache.size();
for( i = 0; i < n; ++i ) {
CCylinderTCCache[i].~CCylinderTC();
}
CCylinderTCCache.setSize(0);
}
int dxTriMesh::AABBTest(dxGeom* g, dReal aabb[6]){
return 1;
}
void dxTriMesh::computeAABB() {
const dxTriMeshData* d = Data;
dVector3 c;
dMULTIPLY0_331( c, R, d->AABBCenter );
dReal xrange = dFabs(R[0] * Data->AABBExtents[0]) +
dFabs(R[1] * Data->AABBExtents[1]) +
dFabs(R[2] * Data->AABBExtents[2]);
dReal yrange = dFabs(R[4] * Data->AABBExtents[0]) +
dFabs(R[5] * Data->AABBExtents[1]) +
dFabs(R[6] * Data->AABBExtents[2]);
dReal zrange = dFabs(R[8] * Data->AABBExtents[0]) +
dFabs(R[9] * Data->AABBExtents[1]) +
dFabs(R[10] * Data->AABBExtents[2]);
aabb[0] = c[0] + pos[0] - xrange;
aabb[1] = c[0] + pos[0] + xrange;
aabb[2] = c[1] + pos[1] - yrange;
aabb[3] = c[1] + pos[1] + yrange;
aabb[4] = c[2] + pos[2] - zrange;
aabb[5] = c[2] + pos[2] + zrange;
}
dGeomID dCreateTriMesh(dSpaceID space,
dTriMeshDataID Data,
dTriCallback* Callback,
dTriArrayCallback* ArrayCallback,
dTriRayCallback* RayCallback)
{
dxTriMesh* Geom = new dxTriMesh(space, Data);
Geom->Callback = Callback;
Geom->ArrayCallback = ArrayCallback;
Geom->RayCallback = RayCallback;
return Geom;
}
void dGeomTriMeshSetCallback(dGeomID g, dTriCallback* Callback)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
((dxTriMesh*)g)->Callback = Callback;
}
dTriCallback* dGeomTriMeshGetCallback(dGeomID g)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
return ((dxTriMesh*)g)->Callback;
}
void dGeomTriMeshSetArrayCallback(dGeomID g, dTriArrayCallback* ArrayCallback)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
((dxTriMesh*)g)->ArrayCallback = ArrayCallback;
}
dTriArrayCallback* dGeomTriMeshGetArrayCallback(dGeomID g)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
return ((dxTriMesh*)g)->ArrayCallback;
}
void dGeomTriMeshSetRayCallback(dGeomID g, dTriRayCallback* Callback)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
((dxTriMesh*)g)->RayCallback = Callback;
}
dTriRayCallback* dGeomTriMeshGetRayCallback(dGeomID g)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
return ((dxTriMesh*)g)->RayCallback;
}
void dGeomTriMeshSetData(dGeomID g, dTriMeshDataID Data)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
((dxTriMesh*)g)->Data = Data;
}
dTriMeshDataID dGeomTriMeshGetData(dGeomID g)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
return ((dxTriMesh*)g)->Data;
}
void dGeomTriMeshEnableTC(dGeomID g, int geomClass, int enable)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
switch (geomClass)
{
case dSphereClass:
((dxTriMesh*)g)->doSphereTC = (1 == enable);
break;
case dBoxClass:
((dxTriMesh*)g)->doBoxTC = (1 == enable);
break;
case dCCylinderClass:
((dxTriMesh*)g)->doCCylinderTC = (1 == enable);
break;
}
}
int dGeomTriMeshIsTCEnabled(dGeomID g, int geomClass)
{
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
switch (geomClass)
{
case dSphereClass:
if (((dxTriMesh*)g)->doSphereTC)
return 1;
break;
case dBoxClass:
if (((dxTriMesh*)g)->doBoxTC)
return 1;
break;
case dCCylinderClass:
if (((dxTriMesh*)g)->doCCylinderTC)
return 1;
break;
}
return 0;
}
void dGeomTriMeshClearTCCache(dGeomID g){
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
dxTriMesh* Geom = (dxTriMesh*)g;
Geom->ClearTCCache();
}
/*
* returns the TriMeshDataID
*/
dTriMeshDataID
dGeomTriMeshGetTriMeshDataID(dGeomID g)
{
dxTriMesh* Geom = (dxTriMesh*) g;
return Geom->Data;
}
// Getting data
void dGeomTriMeshGetTriangle(dGeomID g, int Index, dVector3* v0, dVector3* v1, dVector3* v2){
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
dxTriMesh* Geom = (dxTriMesh*)g;
const dVector3& Position = *(const dVector3*)dGeomGetPosition(g);
const dMatrix3& Rotation = *(const dMatrix3*)dGeomGetRotation(g);
dVector3 v[3];
FetchTriangle(Geom, Index, Position, Rotation, v);
if (v0){
(*v0)[0] = v[0][0];
(*v0)[1] = v[0][1];
(*v0)[2] = v[0][2];
(*v0)[3] = v[0][3];
}
if (v1){
(*v1)[0] = v[1][0];
(*v1)[1] = v[1][1];
(*v1)[2] = v[1][2];
(*v1)[3] = v[1][3];
}
if (v2){
(*v2)[0] = v[2][0];
(*v2)[1] = v[2][1];
(*v2)[2] = v[2][2];
(*v2)[3] = v[2][3];
}
}
void dGeomTriMeshGetPoint(dGeomID g, int Index, dReal u, dReal v, dVector3 Out){
dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
dxTriMesh* Geom = (dxTriMesh*)g;
const dVector3& Position = *(const dVector3*)dGeomGetPosition(g);
const dMatrix3& Rotation = *(const dMatrix3*)dGeomGetRotation(g);
dVector3 dv[3];
FetchTriangle(Geom, Index, Position, Rotation, dv);
GetPointFromBarycentric(dv, u, v, Out);
}
int dGeomTriMeshGetTriangleCount (dGeomID g)
{
dxTriMesh* Geom = (dxTriMesh*)g;
return Geom->Data->Mesh.GetNbTriangles();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,347 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// TriMesh code by Erwin de Vries.
#ifndef _ODE_COLLISION_TRIMESH_INTERNAL_H_
#define _ODE_COLLISION_TRIMESH_INTERNAL_H_
int dCollideTrimeshConvex(dxGeom* g1, dxGeom* cnvx, int Flags, dContactGeom* Contacts, int Stride);
int dCollideSTL(dxGeom *o1, dxGeom *o2, int flags, dContactGeom *contact, int skip);
int dCollideBTL(dxGeom *o1, dxGeom *o2, int flags, dContactGeom *contact, int skip);
int dCollideRTL(dxGeom *o1, dxGeom *o2, int flags, dContactGeom *contact, int skip);
int dCollideTTL(dxGeom *o1, dxGeom *o2, int flags, dContactGeom *contact, int skip);
int dCollideCCTL(dxGeom *o1, dxGeom *o2, int flags, dContactGeom *contact, int skip);
//****************************************************************************
// dxTriMesh class
#ifdef TRIMESH_INTERNAL
#include "collision_kernel.h"
#include <ode/collision_trimesh.h>
#define BAN_OPCODE_AUTOLINK
#include "Opcode.h"
using namespace Opcode;
struct dxTriMeshData : public dBase {
Model BVTree;
MeshInterface Mesh;
dxTriMeshData();
~dxTriMeshData();
void Build(const void* Vertices, int VertexStide, int VertexCount,
const void* Indices, int IndexCount, int TriStride,
const void* Normals,
bool Single);
/* aabb in model space */
dVector3 AABBCenter;
dVector3 AABBExtents;
/* data for use in collison resolution */
const void* Normals;
//Matrix4x4 last_trans;
dMatrix4 last_trans;
};
struct dxTriMesh : public dxGeom{
// Callbacks
dTriCallback* Callback;
dTriArrayCallback* ArrayCallback;
dTriRayCallback* RayCallback;
// Data types
dxTriMeshData* Data;
// Colliders
static PlanesCollider _PlanesCollider;
static SphereCollider _SphereCollider;
static OBBCollider _OBBCollider;
static RayCollider _RayCollider;
static AABBTreeCollider _AABBTreeCollider;
static LSSCollider _LSSCollider;
// Some constants
static CollisionFaces Faces;
// Temporal coherence
struct SphereTC : public SphereCache{
dxGeom* Geom;
};
dArray<SphereTC> SphereTCCache;
static SphereCache defaultSphereCache;
struct BoxTC : public OBBCache{
dxGeom* Geom;
};
dArray<BoxTC> BoxTCCache;
static OBBCache defaultBoxCache;
struct CCylinderTC : public LSSCache{
dxGeom* Geom;
};
dArray<CCylinderTC> CCylinderTCCache;
static LSSCache defaultCCylinderCache;
bool doSphereTC;
bool doBoxTC;
bool doCCylinderTC;
// Functions
dxTriMesh(dSpaceID Space, dTriMeshDataID Data);
~dxTriMesh();
void ClearTCCache();
int AABBTest(dxGeom* g, dReal aabb[6]);
void computeAABB();
};
// Fetches a contact
inline dContactGeom* SAFECONTACT(int Flags, dContactGeom* Contacts, int Index, int Stride){
dIASSERT(Index >= 0 && Index < (Flags & 0x0ffff));
return ((dContactGeom*)(((char*)Contacts) + (Index * Stride)));
}
// Fetches a triangle
inline void FetchTriangle(dxTriMesh* TriMesh, int Index, dVector3 Out[3]){
VertexPointers VP;
TriMesh->Data->Mesh.GetTriangle(VP, Index);
for (int i = 0; i < 3; i++){
Out[i][0] = VP.Vertex[i]->x;
Out[i][1] = VP.Vertex[i]->y;
Out[i][2] = VP.Vertex[i]->z;
Out[i][3] = 0;
}
}
// Fetches a triangle
inline void FetchTriangle(dxTriMesh* TriMesh, int Index, const dVector3 Position, const dMatrix3 Rotation, dVector3 Out[3]){
VertexPointers VP;
TriMesh->Data->Mesh.GetTriangle(VP, Index);
for (int i = 0; i < 3; i++){
dVector3 v;
v[0] = VP.Vertex[i]->x;
v[1] = VP.Vertex[i]->y;
v[2] = VP.Vertex[i]->z;
v[3] = 0;
dMULTIPLY0_331(Out[i], Rotation, v);
Out[i][0] += Position[0];
Out[i][1] += Position[1];
Out[i][2] += Position[2];
Out[i][3] = 0;
}
}
// Creates an OPCODE matrix from an ODE matrix
inline Matrix4x4& MakeMatrix(const dVector3 Position, const dMatrix3 Rotation, Matrix4x4& Out){
Out.m[0][0] = (float) Rotation[0];
Out.m[1][0] = (float) Rotation[1];
Out.m[2][0] = (float) Rotation[2];
Out.m[0][1] = (float) Rotation[4];
Out.m[1][1] = (float) Rotation[5];
Out.m[2][1] = (float) Rotation[6];
Out.m[0][2] = (float) Rotation[8];
Out.m[1][2] = (float) Rotation[9];
Out.m[2][2] = (float) Rotation[10];
Out.m[3][0] = (float) Position[0];
Out.m[3][1] = (float) Position[1];
Out.m[3][2] = (float) Position[2];
Out.m[0][3] = 0.0f;
Out.m[1][3] = 0.0f;
Out.m[2][3] = 0.0f;
Out.m[3][3] = 1.0f;
return Out;
}
// Outputs a matrix to 3 vectors
inline void Decompose(const dMatrix3 Matrix, dVector3 Right, dVector3 Up, dVector3 Direction){
Right[0] = Matrix[0 * 4 + 0];
Right[1] = Matrix[1 * 4 + 0];
Right[2] = Matrix[2 * 4 + 0];
Right[3] = REAL(0.0);
Up[0] = Matrix[0 * 4 + 1];
Up[1] = Matrix[1 * 4 + 1];
Up[2] = Matrix[2 * 4 + 1];
Up[3] = REAL(0.0);
Direction[0] = Matrix[0 * 4 + 2];
Direction[1] = Matrix[1 * 4 + 2];
Direction[2] = Matrix[2 * 4 + 2];
Direction[3] = REAL(0.0);
}
// Outputs a matrix to 3 vectors
inline void Decompose(const dMatrix3 Matrix, dVector3 Vectors[3]){
Decompose(Matrix, Vectors[0], Vectors[1], Vectors[2]);
}
// Creates an OPCODE matrix from an ODE matrix
inline Matrix4x4& MakeMatrix(dxGeom* g, Matrix4x4& Out){
const dVector3& Position = *(const dVector3*)dGeomGetPosition(g);
const dMatrix3& Rotation = *(const dMatrix3*)dGeomGetRotation(g);
return MakeMatrix(Position, Rotation, Out);
}
// Finds barycentric
inline void GetPointFromBarycentric(const dVector3 dv[3], dReal u, dReal v, dVector3 Out){
dReal w = REAL(1.0) - u - v;
Out[0] = (dv[0][0] * w) + (dv[1][0] * u) + (dv[2][0] * v);
Out[1] = (dv[0][1] * w) + (dv[1][1] * u) + (dv[2][1] * v);
Out[2] = (dv[0][2] * w) + (dv[1][2] * u) + (dv[2][2] * v);
Out[3] = (dv[0][3] * w) + (dv[1][3] * u) + (dv[2][3] * v);
}
// Performs a callback
inline bool Callback(dxTriMesh* TriMesh, dxGeom* Object, int TriIndex){
if (TriMesh->Callback != null){
return TriMesh->Callback(TriMesh, Object, TriIndex);
}
else return true;
}
// Some utilities
template<class T> const T& dcMAX(const T& x, const T& y){
return x > y ? x : y;
}
template<class T> const T& dcMIN(const T& x, const T& y){
return x < y ? x : y;
}
dReal SqrDistancePointTri( const dVector3 p, const dVector3 triOrigin,
const dVector3 triEdge1, const dVector3 triEdge2,
dReal* pfSParam = 0, dReal* pfTParam = 0 );
dReal SqrDistanceSegments( const dVector3 seg1Origin, const dVector3 seg1Direction,
const dVector3 seg2Origin, const dVector3 seg2Direction,
dReal* pfSegP0 = 0, dReal* pfSegP1 = 0 );
dReal SqrDistanceSegTri( const dVector3 segOrigin, const dVector3 segEnd,
const dVector3 triOrigin,
const dVector3 triEdge1, const dVector3 triEdge2,
dReal* t = 0, dReal* u = 0, dReal* v = 0 );
inline
void Vector3Subtract( const dVector3 left, const dVector3 right, dVector3 result )
{
result[0] = left[0] - right[0];
result[1] = left[1] - right[1];
result[2] = left[2] - right[2];
result[3] = REAL(0.0);
}
inline
void Vector3Add( const dVector3 left, const dVector3 right, dVector3 result )
{
result[0] = left[0] + right[0];
result[1] = left[1] + right[1];
result[2] = left[2] + right[2];
result[3] = REAL(0.0);
}
inline
void Vector3Negate( const dVector3 in, dVector3 out )
{
out[0] = -in[0];
out[1] = -in[1];
out[2] = -in[2];
out[3] = REAL(0.0);
}
inline
void Vector3Copy( const dVector3 in, dVector3 out )
{
out[0] = in[0];
out[1] = in[1];
out[2] = in[2];
out[3] = REAL(0.0);
}
inline
void Vector3Multiply( const dVector3 in, dReal scalar, dVector3 out )
{
out[0] = in[0] * scalar;
out[1] = in[1] * scalar;
out[2] = in[2] * scalar;
out[3] = REAL(0.0);
}
inline
void TransformVector3( const dVector3 in,
const dMatrix3 orientation, const dVector3 position,
dVector3 out )
{
dMULTIPLY0_331( out, orientation, in );
out[0] += position[0];
out[1] += position[1];
out[2] += position[2];
}
//------------------------------------------------------------------------------
/**
@brief Check for intersection between triangle and capsule.
@param dist [out] Shortest distance squared between the triangle and
the capsule segment (central axis).
@param t [out] t value of point on segment that's the shortest distance
away from the triangle, the coordinates of this point
can be found by (cap.seg.end - cap.seg.start) * t,
or cap.seg.ipol(t).
@param u [out] Barycentric coord on triangle.
@param v [out] Barycentric coord on triangle.
@return True if intersection exists.
The third Barycentric coord is implicit, ie. w = 1.0 - u - v
The Barycentric coords give the location of the point on the triangle
closest to the capsule (where the distance between the two shapes
is the shortest).
*/
inline
bool IntersectCapsuleTri( const dVector3 segOrigin, const dVector3 segEnd,
const dReal radius, const dVector3 triOrigin,
const dVector3 triEdge0, const dVector3 triEdge1,
dReal* dist, dReal* t, dReal* u, dReal* v )
{
dReal sqrDist = SqrDistanceSegTri( segOrigin, segEnd, triOrigin, triEdge0, triEdge1,
t, u, v );
if ( dist )
*dist = sqrDist;
return ( sqrDist <= (radius * radius) );
}
#endif //TRIMESH_INTERNAL
#endif //_ODE_COLLISION_TRIMESH_INTERNAL_H_

View File

@ -1,126 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// TriMesh code by Erwin de Vries.
#include <ode/collision.h>
#include <ode/matrix.h>
#include <ode/rotation.h>
#include <ode/odemath.h>
#include "collision_util.h"
#define TRIMESH_INTERNAL
#include "collision_trimesh_internal.h"
int dCollideRTL(dxGeom* g1, dxGeom* RayGeom, int Flags, dContactGeom* Contacts, int Stride){
dxTriMesh* TriMesh = (dxTriMesh*)g1;
const dVector3& TLPosition = *(const dVector3*)dGeomGetPosition(TriMesh);
const dMatrix3& TLRotation = *(const dMatrix3*)dGeomGetRotation(TriMesh);
RayCollider& Collider = TriMesh->_RayCollider;
dReal Length = dGeomRayGetLength(RayGeom);
int FirstContact, BackfaceCull;
dGeomRayGetParams(RayGeom, &FirstContact, &BackfaceCull);
int ClosestHit = dGeomRayGetClosestHit(RayGeom);
Collider.SetFirstContact(FirstContact != 0);
Collider.SetClosestHit(ClosestHit != 0);
Collider.SetCulling(BackfaceCull != 0);
Collider.SetMaxDist(Length);
dVector3 Origin, Direction;
dGeomRayGet(RayGeom, Origin, Direction);
/* Make Ray */
Ray WorldRay;
WorldRay.mOrig.x = Origin[0];
WorldRay.mOrig.y = Origin[1];
WorldRay.mOrig.z = Origin[2];
WorldRay.mDir.x = Direction[0];
WorldRay.mDir.y = Direction[1];
WorldRay.mDir.z = Direction[2];
/* Intersect */
Matrix4x4 amatrix;
int TriCount = 0;
if (Collider.Collide(WorldRay, TriMesh->Data->BVTree, &MakeMatrix(TLPosition, TLRotation, amatrix))) {
TriCount = TriMesh->Faces.GetNbFaces();
}
if (TriCount == 0) {
return 0;
}
const CollisionFace* Faces = TriMesh->Faces.GetFaces();
int OutTriCount = 0;
for (int i = 0; i < TriCount; i++) {
if (OutTriCount == (Flags & 0xffff)) {
break;
}
if (TriMesh->RayCallback == null ||
TriMesh->RayCallback(TriMesh, RayGeom, Faces[i].mFaceID,
Faces[i].mU, Faces[i].mV)) {
const int& TriIndex = Faces[i].mFaceID;
if (!Callback(TriMesh, RayGeom, TriIndex)) {
continue;
}
dContactGeom* Contact = SAFECONTACT(Flags, Contacts, OutTriCount, Stride);
dVector3 dv[3];
FetchTriangle(TriMesh, TriIndex, TLPosition, TLRotation, dv);
float T = Faces[i].mDistance;
Contact->pos[0] = Origin[0] + (Direction[0] * T);
Contact->pos[1] = Origin[1] + (Direction[1] * T);
Contact->pos[2] = Origin[2] + (Direction[2] * T);
Contact->pos[3] = REAL(0.0);
dVector3 vu;
vu[0] = dv[1][0] - dv[0][0];
vu[1] = dv[1][1] - dv[0][1];
vu[2] = dv[1][2] - dv[0][2];
vu[3] = REAL(0.0);
dVector3 vv;
vv[0] = dv[2][0] - dv[0][0];
vv[1] = dv[2][1] - dv[0][1];
vv[2] = dv[2][2] - dv[0][2];
vv[3] = REAL(0.0);
dCROSS(Contact->normal, =, vv, vu); // Reversed
dNormalize3(Contact->normal);
Contact->depth = T;
Contact->g1 = TriMesh;
Contact->g2 = RayGeom;
OutTriCount++;
}
}
return OutTriCount;
}

View File

@ -1,488 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// TriMesh code by Erwin de Vries.
#include <ode/collision.h>
#include <ode/matrix.h>
#include <ode/rotation.h>
#include <ode/odemath.h>
#include "collision_util.h"
#define TRIMESH_INTERNAL
#include "collision_trimesh_internal.h"
#define MERGECONTACTS
// Ripped from Opcode 1.1.
static bool GetContactData(const dVector3& Center, dReal Radius, const dVector3 Origin, const dVector3 Edge0, const dVector3 Edge1, dReal& Dist, float& u, float& v){
//calculate plane of triangle
dVector4 Plane;
dCROSS(Plane, =, Edge0, Edge1);
Plane[3] = dDOT(Plane, Origin);
//normalize
dNormalize4(Plane);
/* If the center of the sphere is within the positive halfspace of the
* triangle's plane, allow a contact to be generated.
* If the center of the sphere made it into the positive halfspace of a
* back-facing triangle, then the physics update and/or velocity needs
* to be adjusted (penetration has occured anyway).
*/
float side = dDOT(Plane,Center) - Plane[3];
if(side < 0.0f) {
return false;
}
// now onto the bulk of the collision...
dVector3 Diff;
Diff[0] = Origin[0] - Center[0];
Diff[1] = Origin[1] - Center[1];
Diff[2] = Origin[2] - Center[2];
Diff[3] = Origin[3] - Center[3];
float A00 = dDOT(Edge0, Edge0);
float A01 = dDOT(Edge0, Edge1);
float A11 = dDOT(Edge1, Edge1);
float B0 = dDOT(Diff, Edge0);
float B1 = dDOT(Diff, Edge1);
float C = dDOT(Diff, Diff);
float Det = dFabs(A00 * A11 - A01 * A01);
u = A01 * B1 - A11 * B0;
v = A01 * B0 - A00 * B1;
float DistSq;
if (u + v <= Det){
if(u < REAL(0.0)){
if(v < REAL(0.0)){ // region 4
if(B0 < REAL(0.0)){
v = REAL(0.0);
if (-B0 >= A00){
u = REAL(1.0);
DistSq = A00 + REAL(2.0) * B0 + C;
}
else{
u = -B0 / A00;
DistSq = B0 * u + C;
}
}
else{
u = REAL(0.0);
if(B1 >= REAL(0.0)){
v = REAL(0.0);
DistSq = C;
}
else if(-B1 >= A11){
v = REAL(1.0);
DistSq = A11 + REAL(2.0) * B1 + C;
}
else{
v = -B1 / A11;
DistSq = B1 * v + C;
}
}
}
else{ // region 3
u = REAL(0.0);
if(B1 >= REAL(0.0)){
v = REAL(0.0);
DistSq = C;
}
else if(-B1 >= A11){
v = REAL(1.0);
DistSq = A11 + REAL(2.0) * B1 + C;
}
else{
v = -B1 / A11;
DistSq = B1 * v + C;
}
}
}
else if(v < REAL(0.0)){ // region 5
v = REAL(0.0);
if (B0 >= REAL(0.0)){
u = REAL(0.0);
DistSq = C;
}
else if (-B0 >= A00){
u = REAL(1.0);
DistSq = A00 + REAL(2.0) * B0 + C;
}
else{
u = -B0 / A00;
DistSq = B0 * u + C;
}
}
else{ // region 0
// minimum at interior point
if (Det == REAL(0.0)){
u = REAL(0.0);
v = REAL(0.0);
DistSq = FLT_MAX;
}
else{
float InvDet = REAL(1.0) / Det;
u *= InvDet;
v *= InvDet;
DistSq = u * (A00 * u + A01 * v + REAL(2.0) * B0) + v * (A01 * u + A11 * v + REAL(2.0) * B1) + C;
}
}
}
else{
float Tmp0, Tmp1, Numer, Denom;
if(u < REAL(0.0)){ // region 2
Tmp0 = A01 + B0;
Tmp1 = A11 + B1;
if (Tmp1 > Tmp0){
Numer = Tmp1 - Tmp0;
Denom = A00 - REAL(2.0) * A01 + A11;
if (Numer >= Denom){
u = REAL(1.0);
v = REAL(0.0);
DistSq = A00 + REAL(2.0) * B0 + C;
}
else{
u = Numer / Denom;
v = REAL(1.0) - u;
DistSq = u * (A00 * u + A01 * v + REAL(2.0) * B0) + v * (A01 * u + A11 * v + REAL(2.0) * B1) + C;
}
}
else{
u = REAL(0.0);
if(Tmp1 <= REAL(0.0)){
v = REAL(1.0);
DistSq = A11 + REAL(2.0) * B1 + C;
}
else if(B1 >= REAL(0.0)){
v = REAL(0.0);
DistSq = C;
}
else{
v = -B1 / A11;
DistSq = B1 * v + C;
}
}
}
else if(v < REAL(0.0)){ // region 6
Tmp0 = A01 + B1;
Tmp1 = A00 + B0;
if (Tmp1 > Tmp0){
Numer = Tmp1 - Tmp0;
Denom = A00 - REAL(2.0) * A01 + A11;
if (Numer >= Denom){
v = REAL(1.0);
u = REAL(0.0);
DistSq = A11 + REAL(2.0) * B1 + C;
}
else{
v = Numer / Denom;
u = REAL(1.0) - v;
DistSq = u * (A00 * u + A01 * v + REAL(2.0) * B0) + v * (A01 * u + A11 * v + REAL(2.0) * B1) + C;
}
}
else{
v = REAL(0.0);
if (Tmp1 <= REAL(0.0)){
u = REAL(1.0);
DistSq = A00 + REAL(2.0) * B0 + C;
}
else if(B0 >= REAL(0.0)){
u = REAL(0.0);
DistSq = C;
}
else{
u = -B0 / A00;
DistSq = B0 * u + C;
}
}
}
else{ // region 1
Numer = A11 + B1 - A01 - B0;
if (Numer <= REAL(0.0)){
u = REAL(0.0);
v = REAL(1.0);
DistSq = A11 + REAL(2.0) * B1 + C;
}
else{
Denom = A00 - REAL(2.0) * A01 + A11;
if (Numer >= Denom){
u = REAL(1.0);
v = REAL(0.0);
DistSq = A00 + REAL(2.0) * B0 + C;
}
else{
u = Numer / Denom;
v = REAL(1.0) - u;
DistSq = u * (A00 * u + A01 * v + REAL(2.0) * B0) + v * (A01 * u + A11 * v + REAL(2.0) * B1) + C;
}
}
}
}
Dist = dSqrt(dFabs(DistSq));
if (Dist <= Radius){
Dist = Radius - Dist;
return true;
}
else return false;
}
int dCollideSTL(dxGeom* g1, dxGeom* SphereGeom, int Flags, dContactGeom* Contacts, int Stride){
dxTriMesh* TriMesh = (dxTriMesh*)g1;
// Init
const dVector3& TLPosition = *(const dVector3*)dGeomGetPosition(TriMesh);
const dMatrix3& TLRotation = *(const dMatrix3*)dGeomGetRotation(TriMesh);
SphereCollider& Collider = TriMesh->_SphereCollider;
const dVector3& Position = *(const dVector3*)dGeomGetPosition(SphereGeom);
dReal Radius = dGeomSphereGetRadius(SphereGeom);
// Sphere
Sphere Sphere;
Sphere.mCenter.x = Position[0];
Sphere.mCenter.y = Position[1];
Sphere.mCenter.z = Position[2];
Sphere.mRadius = Radius;
Matrix4x4 amatrix;
// TC results
if (TriMesh->doSphereTC) {
dxTriMesh::SphereTC* sphereTC = 0;
for (int i = 0; i < TriMesh->SphereTCCache.size(); i++){
if (TriMesh->SphereTCCache[i].Geom == SphereGeom){
sphereTC = &TriMesh->SphereTCCache[i];
break;
}
}
if (!sphereTC){
TriMesh->SphereTCCache.push(dxTriMesh::SphereTC());
sphereTC = &TriMesh->SphereTCCache[TriMesh->SphereTCCache.size() - 1];
sphereTC->Geom = SphereGeom;
}
// Intersect
Collider.SetTemporalCoherence(true);
Collider.Collide(*sphereTC, Sphere, TriMesh->Data->BVTree, null,
&MakeMatrix(TLPosition, TLRotation, amatrix));
}
else {
Collider.SetTemporalCoherence(false);
Collider.Collide(dxTriMesh::defaultSphereCache, Sphere, TriMesh->Data->BVTree, null,
&MakeMatrix(TLPosition, TLRotation, amatrix));
}
if (!Collider.GetContactStatus()) {
/* no collision occurred */
return 0;
}
// get results
int TriCount = Collider.GetNbTouchedPrimitives();
const int* Triangles = (const int*)Collider.GetTouchedPrimitives();
if (TriCount != 0){
if (TriMesh->ArrayCallback != null){
TriMesh->ArrayCallback(TriMesh, SphereGeom, Triangles, TriCount);
}
int OutTriCount = 0;
for (int i = 0; i < TriCount; i++){
if (OutTriCount == (Flags & 0xffff)){
break;
}
const int& TriIndex = Triangles[i];
dVector3 dv[3];
FetchTriangle(TriMesh, TriIndex, TLPosition, TLRotation, dv);
dVector3& v0 = dv[0];
dVector3& v1 = dv[1];
dVector3& v2 = dv[2];
dVector3 vu;
vu[0] = v1[0] - v0[0];
vu[1] = v1[1] - v0[1];
vu[2] = v1[2] - v0[2];
vu[3] = REAL(0.0);
dVector3 vv;
vv[0] = v2[0] - v0[0];
vv[1] = v2[1] - v0[1];
vv[2] = v2[2] - v0[2];
vv[3] = REAL(0.0);
dReal Depth;
float u, v;
if (!GetContactData(Position, Radius, v0, vu, vv, Depth, u, v)){
continue; // Sphere doesnt hit triangle
}
dReal w = REAL(1.0) - u - v;
if (Depth < REAL(0.0)){
Depth = REAL(0.0);
}
dContactGeom* Contact = SAFECONTACT(Flags, Contacts, OutTriCount, Stride);
Contact->pos[0] = (v0[0] * w) + (v1[0] * u) + (v2[0] * v);
Contact->pos[1] = (v0[1] * w) + (v1[1] * u) + (v2[1] * v);
Contact->pos[2] = (v0[2] * w) + (v1[2] * u) + (v2[2] * v);
Contact->pos[3] = REAL(0.0);
dVector4 Plane;
dCROSS(Plane, =, vv, vu); // Reversed
Plane[3] = dDOT(Plane, v0); // Using normal as plane.
dReal Area = dSqrt(dDOT(Plane, Plane)); // We can use this later
Plane[0] /= Area;
Plane[1] /= Area;
Plane[2] /= Area;
Plane[3] /= Area;
Contact->normal[0] = Plane[0];
Contact->normal[1] = Plane[1];
Contact->normal[2] = Plane[2];
Contact->normal[3] = REAL(0.0);
Contact->depth = Depth;
//Contact->g1 = TriMesh;
//Contact->g2 = SphereGeom;
OutTriCount++;
}
#ifdef MERGECONTACTS // Merge all contacts into 1
if (OutTriCount != 0){
dContactGeom* Contact = SAFECONTACT(Flags, Contacts, 0, Stride);
if (OutTriCount != 1){
Contact->normal[0] *= Contact->depth;
Contact->normal[1] *= Contact->depth;
Contact->normal[2] *= Contact->depth;
Contact->normal[3] *= Contact->depth;
for (int i = 1; i < OutTriCount; i++){
dContactGeom* TempContact = SAFECONTACT(Flags, Contacts, i, Stride);
Contact->pos[0] += TempContact->pos[0];
Contact->pos[1] += TempContact->pos[1];
Contact->pos[2] += TempContact->pos[2];
Contact->pos[3] += TempContact->pos[3];
Contact->normal[0] += TempContact->normal[0] * TempContact->depth;
Contact->normal[1] += TempContact->normal[1] * TempContact->depth;
Contact->normal[2] += TempContact->normal[2] * TempContact->depth;
Contact->normal[3] += TempContact->normal[3] * TempContact->depth;
}
Contact->pos[0] /= OutTriCount;
Contact->pos[1] /= OutTriCount;
Contact->pos[2] /= OutTriCount;
Contact->pos[3] /= OutTriCount;
// Remember to divide in square space.
Contact->depth = dSqrt(dDOT(Contact->normal, Contact->normal) / OutTriCount);
dNormalize3(Contact->normal);
}
Contact->g1 = TriMesh;
Contact->g2 = SphereGeom;
return 1;
}
else return 0;
#elif defined MERGECONTACTNORMALS // Merge all normals, and distribute between all contacts
if (OutTriCount != 0){
if (OutTriCount != 1){
dVector3& Normal = SAFECONTACT(Flags, Contacts, 0, Stride)->normal;
Normal[0] *= SAFECONTACT(Flags, Contacts, 0, Stride)->depth;
Normal[1] *= SAFECONTACT(Flags, Contacts, 0, Stride)->depth;
Normal[2] *= SAFECONTACT(Flags, Contacts, 0, Stride)->depth;
Normal[3] *= SAFECONTACT(Flags, Contacts, 0, Stride)->depth;
for (int i = 1; i < OutTriCount; i++){
dContactGeom* Contact = SAFECONTACT(Flags, Contacts, i, Stride);
Normal[0] += Contact->normal[0] * Contact->depth;
Normal[1] += Contact->normal[1] * Contact->depth;
Normal[2] += Contact->normal[2] * Contact->depth;
Normal[3] += Contact->normal[3] * Contact->depth;
}
dNormalize3(Normal);
for (int i = 1; i < OutTriCount; i++){
dContactGeom* Contact = SAFECONTACT(Flags, Contacts, i, Stride);
Contact->normal[0] = Normal[0];
Contact->normal[1] = Normal[1];
Contact->normal[2] = Normal[2];
Contact->normal[3] = Normal[3];
Contact->g1 = TriMesh;
Contact->g2 = SphereGeom;
}
}
else{
SAFECONTACT(Flags, Contacts, 0, Stride)->g1 = TriMesh;
SAFECONTACT(Flags, Contacts, 0, Stride)->g2 = SphereGeom;
}
return OutTriCount;
}
else return 0;
#else //MERGECONTACTNORMALS // Just gather penetration depths and return
for (int i = 0; i < OutTriCount; i++){
dContactGeom* Contact = SAFECONTACT(Flags, Contacts, i, Stride);
//Contact->depth = dSqrt(dDOT(Contact->normal, Contact->normal));
/*Contact->normal[0] /= Contact->depth;
Contact->normal[1] /= Contact->depth;
Contact->normal[2] /= Contact->depth;
Contact->normal[3] /= Contact->depth;*/
Contact->g1 = TriMesh;
Contact->g2 = SphereGeom;
}
return OutTriCount;
#endif // MERGECONTACTS
}
else return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,447 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
some useful collision utility stuff. this includes some API utility
functions that are defined in the public header files.
*/
#include <ode/common.h>
#include <ode/collision.h>
#include <ode/odemath.h>
#include "collision_util.h"
//****************************************************************************
int dCollideSpheres (dVector3 p1, dReal r1,
dVector3 p2, dReal r2, dContactGeom *c)
{
// printf ("d=%.2f (%.2f %.2f %.2f) (%.2f %.2f %.2f) r1=%.2f r2=%.2f\n",
// d,p1[0],p1[1],p1[2],p2[0],p2[1],p2[2],r1,r2);
dReal d = dDISTANCE (p1,p2);
if (d > (r1 + r2)) return 0;
if (d <= 0) {
c->pos[0] = p1[0];
c->pos[1] = p1[1];
c->pos[2] = p1[2];
c->normal[0] = 1;
c->normal[1] = 0;
c->normal[2] = 0;
c->depth = r1 + r2;
}
else {
dReal d1 = dRecip (d);
c->normal[0] = (p1[0]-p2[0])*d1;
c->normal[1] = (p1[1]-p2[1])*d1;
c->normal[2] = (p1[2]-p2[2])*d1;
dReal k = REAL(0.5) * (r2 - r1 - d);
c->pos[0] = p1[0] + c->normal[0]*k;
c->pos[1] = p1[1] + c->normal[1]*k;
c->pos[2] = p1[2] + c->normal[2]*k;
c->depth = r1 + r2 - d;
}
return 1;
}
void dLineClosestApproach (const dVector3 pa, const dVector3 ua,
const dVector3 pb, const dVector3 ub,
dReal *alpha, dReal *beta)
{
dVector3 p;
p[0] = pb[0] - pa[0];
p[1] = pb[1] - pa[1];
p[2] = pb[2] - pa[2];
dReal uaub = dDOT(ua,ub);
dReal q1 = dDOT(ua,p);
dReal q2 = -dDOT(ub,p);
dReal d = 1-uaub*uaub;
if (d <= REAL(0.0001)) {
// @@@ this needs to be made more robust
*alpha = 0;
*beta = 0;
}
else {
d = dRecip(d);
*alpha = (q1 + uaub*q2)*d;
*beta = (uaub*q1 + q2)*d;
}
}
// given two line segments A and B with endpoints a1-a2 and b1-b2, return the
// points on A and B that are closest to each other (in cp1 and cp2).
// in the case of parallel lines where there are multiple solutions, a
// solution involving the endpoint of at least one line will be returned.
// this will work correctly for zero length lines, e.g. if a1==a2 and/or
// b1==b2.
//
// the algorithm works by applying the voronoi clipping rule to the features
// of the line segments. the three features of each line segment are the two
// endpoints and the line between them. the voronoi clipping rule states that,
// for feature X on line A and feature Y on line B, the closest points PA and
// PB between X and Y are globally the closest points if PA is in V(Y) and
// PB is in V(X), where V(X) is the voronoi region of X.
void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a2,
const dVector3 b1, const dVector3 b2,
dVector3 cp1, dVector3 cp2)
{
dVector3 a1a2,b1b2,a1b1,a1b2,a2b1,a2b2,n;
dReal la,lb,k,da1,da2,da3,da4,db1,db2,db3,db4,det;
#define SET2(a,b) a[0]=b[0]; a[1]=b[1]; a[2]=b[2];
#define SET3(a,b,op,c) a[0]=b[0] op c[0]; a[1]=b[1] op c[1]; a[2]=b[2] op c[2];
// check vertex-vertex features
SET3 (a1a2,a2,-,a1);
SET3 (b1b2,b2,-,b1);
SET3 (a1b1,b1,-,a1);
da1 = dDOT(a1a2,a1b1);
db1 = dDOT(b1b2,a1b1);
if (da1 <= 0 && db1 >= 0) {
SET2 (cp1,a1);
SET2 (cp2,b1);
return;
}
SET3 (a1b2,b2,-,a1);
da2 = dDOT(a1a2,a1b2);
db2 = dDOT(b1b2,a1b2);
if (da2 <= 0 && db2 <= 0) {
SET2 (cp1,a1);
SET2 (cp2,b2);
return;
}
SET3 (a2b1,b1,-,a2);
da3 = dDOT(a1a2,a2b1);
db3 = dDOT(b1b2,a2b1);
if (da3 >= 0 && db3 >= 0) {
SET2 (cp1,a2);
SET2 (cp2,b1);
return;
}
SET3 (a2b2,b2,-,a2);
da4 = dDOT(a1a2,a2b2);
db4 = dDOT(b1b2,a2b2);
if (da4 >= 0 && db4 <= 0) {
SET2 (cp1,a2);
SET2 (cp2,b2);
return;
}
// check edge-vertex features.
// if one or both of the lines has zero length, we will never get to here,
// so we do not have to worry about the following divisions by zero.
la = dDOT(a1a2,a1a2);
if (da1 >= 0 && da3 <= 0) {
k = da1 / la;
SET3 (n,a1b1,-,k*a1a2);
if (dDOT(b1b2,n) >= 0) {
SET3 (cp1,a1,+,k*a1a2);
SET2 (cp2,b1);
return;
}
}
if (da2 >= 0 && da4 <= 0) {
k = da2 / la;
SET3 (n,a1b2,-,k*a1a2);
if (dDOT(b1b2,n) <= 0) {
SET3 (cp1,a1,+,k*a1a2);
SET2 (cp2,b2);
return;
}
}
lb = dDOT(b1b2,b1b2);
if (db1 <= 0 && db2 >= 0) {
k = -db1 / lb;
SET3 (n,-a1b1,-,k*b1b2);
if (dDOT(a1a2,n) >= 0) {
SET2 (cp1,a1);
SET3 (cp2,b1,+,k*b1b2);
return;
}
}
if (db3 <= 0 && db4 >= 0) {
k = -db3 / lb;
SET3 (n,-a2b1,-,k*b1b2);
if (dDOT(a1a2,n) <= 0) {
SET2 (cp1,a2);
SET3 (cp2,b1,+,k*b1b2);
return;
}
}
// it must be edge-edge
k = dDOT(a1a2,b1b2);
det = la*lb - k*k;
if (det <= 0) {
// this should never happen, but just in case...
SET2(cp1,a1);
SET2(cp2,b1);
return;
}
det = dRecip (det);
dReal alpha = (lb*da1 - k*db1) * det;
dReal beta = ( k*da1 - la*db1) * det;
SET3 (cp1,a1,+,alpha*a1a2);
SET3 (cp2,b1,+,beta*b1b2);
# undef SET2
# undef SET3
}
// a simple root finding algorithm is used to find the value of 't' that
// satisfies:
// d|D(t)|^2/dt = 0
// where:
// |D(t)| = |p(t)-b(t)|
// where p(t) is a point on the line parameterized by t:
// p(t) = p1 + t*(p2-p1)
// and b(t) is that same point clipped to the boundary of the box. in box-
// relative coordinates d|D(t)|^2/dt is the sum of three x,y,z components
// each of which looks like this:
//
// t_lo /
// ______/ -->t
// / t_hi
// /
//
// t_lo and t_hi are the t values where the line passes through the planes
// corresponding to the sides of the box. the algorithm computes d|D(t)|^2/dt
// in a piecewise fashion from t=0 to t=1, stopping at the point where
// d|D(t)|^2/dt crosses from negative to positive.
void dClosestLineBoxPoints (const dVector3 p1, const dVector3 p2,
const dVector3 c, const dMatrix3 R,
const dVector3 side,
dVector3 lret, dVector3 bret)
{
int i;
// compute the start and delta of the line p1-p2 relative to the box.
// we will do all subsequent computations in this box-relative coordinate
// system. we have to do a translation and rotation for each point.
dVector3 tmp,s,v;
tmp[0] = p1[0] - c[0];
tmp[1] = p1[1] - c[1];
tmp[2] = p1[2] - c[2];
dMULTIPLY1_331 (s,R,tmp);
tmp[0] = p2[0] - p1[0];
tmp[1] = p2[1] - p1[1];
tmp[2] = p2[2] - p1[2];
dMULTIPLY1_331 (v,R,tmp);
// mirror the line so that v has all components >= 0
dVector3 sign;
for (i=0; i<3; i++) {
if (v[i] < 0) {
s[i] = -s[i];
v[i] = -v[i];
sign[i] = -1;
}
else sign[i] = 1;
}
// compute v^2
dVector3 v2;
v2[0] = v[0]*v[0];
v2[1] = v[1]*v[1];
v2[2] = v[2]*v[2];
// compute the half-sides of the box
dReal h[3];
h[0] = REAL(0.5) * side[0];
h[1] = REAL(0.5) * side[1];
h[2] = REAL(0.5) * side[2];
// region is -1,0,+1 depending on which side of the box planes each
// coordinate is on. tanchor is the next t value at which there is a
// transition, or the last one if there are no more.
int region[3];
dReal tanchor[3];
// find the region and tanchor values for p1
for (i=0; i<3; i++) {
if (v[i] > 0) {
if (s[i] < -h[i]) {
region[i] = -1;
tanchor[i] = (-h[i]-s[i])/v[i];
}
else {
region[i] = (s[i] > h[i]);
tanchor[i] = (h[i]-s[i])/v[i];
}
}
else {
region[i] = 0;
tanchor[i] = 2; // this will never be a valid tanchor
}
}
// compute d|d|^2/dt for t=0. if it's >= 0 then p1 is the closest point
dReal t=0;
dReal dd2dt = 0;
for (i=0; i<3; i++) dd2dt -= (region[i] ? v2[i] : 0) * tanchor[i];
if (dd2dt >= 0) goto got_answer;
do {
// find the point on the line that is at the next clip plane boundary
dReal next_t = 1;
for (i=0; i<3; i++) {
if (tanchor[i] > t && tanchor[i] < 1 && tanchor[i] < next_t)
next_t = tanchor[i];
}
// compute d|d|^2/dt for the next t
dReal next_dd2dt = 0;
for (i=0; i<3; i++) {
next_dd2dt += (region[i] ? v2[i] : 0) * (next_t - tanchor[i]);
}
// if the sign of d|d|^2/dt has changed, solution = the crossover point
if (next_dd2dt >= 0) {
dReal m = (next_dd2dt-dd2dt)/(next_t - t);
t -= dd2dt/m;
goto got_answer;
}
// advance to the next anchor point / region
for (i=0; i<3; i++) {
if (tanchor[i] == next_t) {
tanchor[i] = (h[i]-s[i])/v[i];
region[i]++;
}
}
t = next_t;
dd2dt = next_dd2dt;
}
while (t < 1);
t = 1;
got_answer:
// compute closest point on the line
for (i=0; i<3; i++) lret[i] = p1[i] + t*tmp[i]; // note: tmp=p2-p1
// compute closest point on the box
for (i=0; i<3; i++) {
tmp[i] = sign[i] * (s[i] + t*v[i]);
if (tmp[i] < -h[i]) tmp[i] = -h[i];
else if (tmp[i] > h[i]) tmp[i] = h[i];
}
dMULTIPLY0_331 (s,R,tmp);
for (i=0; i<3; i++) bret[i] = s[i] + c[i];
}
// given boxes (p1,R1,side1) and (p1,R1,side1), return 1 if they intersect
// or 0 if not.
int dBoxTouchesBox (const dVector3 p1, const dMatrix3 R1,
const dVector3 side1, const dVector3 p2,
const dMatrix3 R2, const dVector3 side2)
{
// two boxes are disjoint if (and only if) there is a separating axis
// perpendicular to a face from one box or perpendicular to an edge from
// either box. the following tests are derived from:
// "OBB Tree: A Hierarchical Structure for Rapid Interference Detection",
// S.Gottschalk, M.C.Lin, D.Manocha., Proc of ACM Siggraph 1996.
// Rij is R1'*R2, i.e. the relative rotation between R1 and R2.
// Qij is abs(Rij)
dVector3 p,pp;
dReal A1,A2,A3,B1,B2,B3,R11,R12,R13,R21,R22,R23,R31,R32,R33,
Q11,Q12,Q13,Q21,Q22,Q23,Q31,Q32,Q33;
// get vector from centers of box 1 to box 2, relative to box 1
p[0] = p2[0] - p1[0];
p[1] = p2[1] - p1[1];
p[2] = p2[2] - p1[2];
dMULTIPLY1_331 (pp,R1,p); // get pp = p relative to body 1
// get side lengths / 2
A1 = side1[0]*REAL(0.5); A2 = side1[1]*REAL(0.5); A3 = side1[2]*REAL(0.5);
B1 = side2[0]*REAL(0.5); B2 = side2[1]*REAL(0.5); B3 = side2[2]*REAL(0.5);
// for the following tests, excluding computation of Rij, in the worst case,
// 15 compares, 60 adds, 81 multiplies, and 24 absolutes.
// notation: R1=[u1 u2 u3], R2=[v1 v2 v3]
// separating axis = u1,u2,u3
R11 = dDOT44(R1+0,R2+0); R12 = dDOT44(R1+0,R2+1); R13 = dDOT44(R1+0,R2+2);
Q11 = dFabs(R11); Q12 = dFabs(R12); Q13 = dFabs(R13);
if (dFabs(pp[0]) > (A1 + B1*Q11 + B2*Q12 + B3*Q13)) return 0;
R21 = dDOT44(R1+1,R2+0); R22 = dDOT44(R1+1,R2+1); R23 = dDOT44(R1+1,R2+2);
Q21 = dFabs(R21); Q22 = dFabs(R22); Q23 = dFabs(R23);
if (dFabs(pp[1]) > (A2 + B1*Q21 + B2*Q22 + B3*Q23)) return 0;
R31 = dDOT44(R1+2,R2+0); R32 = dDOT44(R1+2,R2+1); R33 = dDOT44(R1+2,R2+2);
Q31 = dFabs(R31); Q32 = dFabs(R32); Q33 = dFabs(R33);
if (dFabs(pp[2]) > (A3 + B1*Q31 + B2*Q32 + B3*Q33)) return 0;
// separating axis = v1,v2,v3
if (dFabs(dDOT41(R2+0,p)) > (A1*Q11 + A2*Q21 + A3*Q31 + B1)) return 0;
if (dFabs(dDOT41(R2+1,p)) > (A1*Q12 + A2*Q22 + A3*Q32 + B2)) return 0;
if (dFabs(dDOT41(R2+2,p)) > (A1*Q13 + A2*Q23 + A3*Q33 + B3)) return 0;
// separating axis = u1 x (v1,v2,v3)
if (dFabs(pp[2]*R21-pp[1]*R31) > A2*Q31 + A3*Q21 + B2*Q13 + B3*Q12) return 0;
if (dFabs(pp[2]*R22-pp[1]*R32) > A2*Q32 + A3*Q22 + B1*Q13 + B3*Q11) return 0;
if (dFabs(pp[2]*R23-pp[1]*R33) > A2*Q33 + A3*Q23 + B1*Q12 + B2*Q11) return 0;
// separating axis = u2 x (v1,v2,v3)
if (dFabs(pp[0]*R31-pp[2]*R11) > A1*Q31 + A3*Q11 + B2*Q23 + B3*Q22) return 0;
if (dFabs(pp[0]*R32-pp[2]*R12) > A1*Q32 + A3*Q12 + B1*Q23 + B3*Q21) return 0;
if (dFabs(pp[0]*R33-pp[2]*R13) > A1*Q33 + A3*Q13 + B1*Q22 + B2*Q21) return 0;
// separating axis = u3 x (v1,v2,v3)
if (dFabs(pp[1]*R11-pp[0]*R21) > A1*Q21 + A2*Q11 + B2*Q33 + B3*Q32) return 0;
if (dFabs(pp[1]*R12-pp[0]*R22) > A1*Q22 + A2*Q12 + B1*Q33 + B3*Q31) return 0;
if (dFabs(pp[1]*R13-pp[0]*R23) > A1*Q23 + A2*Q13 + B1*Q32 + B2*Q31) return 0;
return 1;
}
//****************************************************************************
// other utility functions
void dInfiniteAABB (dxGeom *geom, dReal aabb[6])
{
aabb[0] = -dInfinity;
aabb[1] = dInfinity;
aabb[2] = -dInfinity;
aabb[3] = dInfinity;
aabb[4] = -dInfinity;
aabb[5] = dInfinity;
}

View File

@ -1,72 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
some useful collision utility stuff.
*/
#ifndef _ODE_COLLISION_UTIL_H_
#define _ODE_COLLISION_UTIL_H_
#include <ode/common.h>
#include <ode/contact.h>
// given a pointer `p' to a dContactGeom, return the dContactGeom at
// p + skip bytes.
#define CONTACT(p,skip) ((dContactGeom*) (((char*)p) + (skip)))
// if the spheres (p1,r1) and (p2,r2) collide, set the contact `c' and
// return 1, else return 0.
int dCollideSpheres (dVector3 p1, dReal r1,
dVector3 p2, dReal r2, dContactGeom *c);
// given two lines
// qa = pa + alpha* ua
// qb = pb + beta * ub
// where pa,pb are two points, ua,ub are two unit length vectors, and alpha,
// beta go from [-inf,inf], return alpha and beta such that qa and qb are
// as close as possible
void dLineClosestApproach (const dVector3 pa, const dVector3 ua,
const dVector3 pb, const dVector3 ub,
dReal *alpha, dReal *beta);
// given a line segment p1-p2 and a box (center 'c', rotation 'R', side length
// vector 'side'), compute the points of closest approach between the box
// and the line. return these points in 'lret' (the point on the line) and
// 'bret' (the point on the box). if the line actually penetrates the box
// then the solution is not unique, but only one solution will be returned.
// in this case the solution points will coincide.
void dClosestLineBoxPoints (const dVector3 p1, const dVector3 p2,
const dVector3 c, const dMatrix3 R,
const dVector3 side,
dVector3 lret, dVector3 bret);
#endif

View File

@ -1,172 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <ode/config.h>
#include <ode/error.h>
static dMessageFunction *error_function = 0;
static dMessageFunction *debug_function = 0;
static dMessageFunction *message_function = 0;
extern "C" void dSetErrorHandler (dMessageFunction *fn)
{
error_function = fn;
}
extern "C" void dSetDebugHandler (dMessageFunction *fn)
{
debug_function = fn;
}
extern "C" void dSetMessageHandler (dMessageFunction *fn)
{
message_function = fn;
}
extern "C" dMessageFunction *dGetErrorHandler()
{
return error_function;
}
extern "C" dMessageFunction *dGetDebugHandler()
{
return debug_function;
}
extern "C" dMessageFunction *dGetMessageHandler()
{
return message_function;
}
static void printMessage (int num, const char *msg1, const char *msg2,
va_list ap)
{
fflush (stderr);
fflush (stdout);
if (num) fprintf (stderr,"\n%s %d: ",msg1,num);
else fprintf (stderr,"\n%s: ",msg1);
vfprintf (stderr,msg2,ap);
fprintf (stderr,"\n");
fflush (stderr);
}
//****************************************************************************
// unix
#ifndef WIN32
extern "C" void dError (int num, const char *msg, ...)
{
va_list ap;
va_start (ap,msg);
if (error_function) error_function (num,msg,ap);
else printMessage (num,"ODE Error",msg,ap);
exit (1);
}
extern "C" void dDebug (int num, const char *msg, ...)
{
va_list ap;
va_start (ap,msg);
if (debug_function) debug_function (num,msg,ap);
else printMessage (num,"ODE INTERNAL ERROR",msg,ap);
// *((char *)0) = 0; ... commit SEGVicide
abort();
}
extern "C" void dMessage (int num, const char *msg, ...)
{
va_list ap;
va_start (ap,msg);
if (message_function) message_function (num,msg,ap);
else printMessage (num,"ODE Message",msg,ap);
}
#endif
//****************************************************************************
// windows
#ifdef WIN32
// isn't cygwin annoying!
#ifdef CYGWIN
#define _snprintf snprintf
#define _vsnprintf vsnprintf
#endif
#include "windows.h"
extern "C" void dError (int num, const char *msg, ...)
{
va_list ap;
va_start (ap,msg);
if (error_function) error_function (num,msg,ap);
else {
char s[1000],title[100];
_snprintf (title,sizeof(title),"ODE Error %d",num);
_vsnprintf (s,sizeof(s),msg,ap);
s[sizeof(s)-1] = 0;
MessageBox(0,s,title,MB_OK | MB_ICONWARNING);
}
exit (1);
}
extern "C" void dDebug (int num, const char *msg, ...)
{
va_list ap;
va_start (ap,msg);
if (debug_function) debug_function (num,msg,ap);
else {
char s[1000],title[100];
_snprintf (title,sizeof(title),"ODE INTERNAL ERROR %d",num);
_vsnprintf (s,sizeof(s),msg,ap);
s[sizeof(s)-1] = 0;
MessageBox(0,s,title,MB_OK | MB_ICONSTOP);
}
abort();
}
extern "C" void dMessage (int num, const char *msg, ...)
{
va_list ap;
va_start (ap,msg);
if (message_function) message_function (num,msg,ap);
else printMessage (num,"ODE Message",msg,ap);
}
#endif

View File

@ -1,533 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
* Export a DIF (Dynamics Interchange Format) file.
*/
// @@@ TODO:
// * export all spaces, and geoms in spaces, not just ones attached to bodies
// (separate export function?)
// * say the space each geom is in, so reader can construct space heirarchy
// * limot --> separate out into limits and motors?
// * make sure ODE-specific parameters divided out
#include "ode/ode.h"
#include "objects.h"
#include "joint.h"
#include "collision_kernel.h"
//***************************************************************************
// utility
struct PrintingContext {
FILE *file; // file to write to
int precision; // digits of precision to print
int indent; // number of levels of indent
void printIndent();
void printReal (dReal x);
void print (const char *name, int x);
void print (const char *name, dReal x);
void print (const char *name, const dReal *x, int n=3);
void print (const char *name, const char *x=0);
void printNonzero (const char *name, dReal x);
void printNonzero (const char *name, const dReal x[3]);
};
void PrintingContext::printIndent()
{
for (int i=0; i<indent; i++) fputc ('\t',file);
}
void PrintingContext::print (const char *name, int x)
{
printIndent();
fprintf (file,"%s = %d,\n",name,x);
}
void PrintingContext::printReal (dReal x)
{
if (x==dInfinity) {
fprintf (file,"inf");
}
else if (x==-dInfinity) {
fprintf (file,"-inf");
}
else {
fprintf (file,"%.*g",precision,x);
}
}
void PrintingContext::print (const char *name, dReal x)
{
printIndent();
fprintf (file,"%s = ",name);
printReal (x);
fprintf (file,",\n");
}
void PrintingContext::print (const char *name, const dReal *x, int n)
{
printIndent();
fprintf (file,"%s = {",name);
for (int i=0; i<n; i++) {
printReal (x[i]);
if (i < n-1) fputc (',',file);
}
fprintf (file,"},\n");
}
void PrintingContext::print (const char *name, const char *x)
{
printIndent();
if (x) {
fprintf (file,"%s = \"%s\",\n",name,x);
}
else {
fprintf (file,"%s\n",name);
}
}
void PrintingContext::printNonzero (const char *name, dReal x)
{
if (x != 0) print (name,x);
}
void PrintingContext::printNonzero (const char *name, const dReal x[3])
{
if (x[0] != 0 && x[1] != 0 && x[2] != 0) print (name,x);
}
//***************************************************************************
// joints
static void printLimot (PrintingContext &c, dxJointLimitMotor &limot, int num)
{
if (num >= 0) {
c.printIndent();
fprintf (c.file,"limit%d = {\n",num);
}
else {
c.print ("limit = {");
}
c.indent++;
c.print ("low_stop",limot.lostop);
c.print ("high_stop",limot.histop);
c.printNonzero ("bounce",limot.bounce);
c.print ("ODE = {");
c.indent++;
c.printNonzero ("stop_erp",limot.stop_erp);
c.printNonzero ("stop_cfm",limot.stop_cfm);
c.indent--;
c.print ("},");
c.indent--;
c.print ("},");
if (num >= 0) {
c.printIndent();
fprintf (c.file,"motor%d = {\n",num);
}
else {
c.print ("motor = {");
}
c.indent++;
c.printNonzero ("vel",limot.vel);
c.printNonzero ("fmax",limot.fmax);
c.print ("ODE = {");
c.indent++;
c.printNonzero ("fudge_factor",limot.fudge_factor);
c.printNonzero ("normal_cfm",limot.normal_cfm);
c.indent--;
c.print ("},");
c.indent--;
c.print ("},");
}
static const char *getJointName (dxJoint *j)
{
switch (j->vtable->typenum) {
case dJointTypeBall: return "ball";
case dJointTypeHinge: return "hinge";
case dJointTypeSlider: return "slider";
case dJointTypeContact: return "contact";
case dJointTypeUniversal: return "universal";
case dJointTypeHinge2: return "ODE_hinge2";
case dJointTypeFixed: return "fixed";
case dJointTypeNull: return "null";
case dJointTypeAMotor: return "ODE_angular_motor";
}
return "unknown";
}
static void printBall (PrintingContext &c, dxJoint *j)
{
dxJointBall *b = (dxJointBall*) j;
c.print ("anchor1",b->anchor1);
c.print ("anchor2",b->anchor2);
}
static void printHinge (PrintingContext &c, dxJoint *j)
{
dxJointHinge *h = (dxJointHinge*) j;
c.print ("anchor1",h->anchor1);
c.print ("anchor2",h->anchor2);
c.print ("axis1",h->axis1);
c.print ("axis2",h->axis2);
c.print ("qrel",h->qrel,4);
printLimot (c,h->limot,-1);
}
static void printSlider (PrintingContext &c, dxJoint *j)
{
dxJointSlider *s = (dxJointSlider*) j;
c.print ("axis1",s->axis1);
c.print ("qrel",s->qrel,4);
c.print ("offset",s->offset);
printLimot (c,s->limot,-1);
}
static void printContact (PrintingContext &c, dxJoint *j)
{
dxJointContact *ct = (dxJointContact*) j;
int mode = ct->contact.surface.mode;
c.print ("pos",ct->contact.geom.pos);
c.print ("normal",ct->contact.geom.normal);
c.print ("depth",ct->contact.geom.depth);
//@@@ may want to write the geoms g1 and g2 that are involved, for debugging.
// to do this we must have written out all geoms in all spaces, not just
// geoms that are attached to bodies.
c.print ("mu",ct->contact.surface.mu);
if (mode & dContactMu2) c.print ("mu2",ct->contact.surface.mu2);
if (mode & dContactBounce) c.print ("bounce",ct->contact.surface.bounce);
if (mode & dContactBounce) c.print ("bounce_vel",ct->contact.surface.bounce_vel);
if (mode & dContactSoftERP) c.print ("soft_ERP",ct->contact.surface.soft_erp);
if (mode & dContactSoftCFM) c.print ("soft_CFM",ct->contact.surface.soft_cfm);
if (mode & dContactMotion1) c.print ("motion1",ct->contact.surface.motion1);
if (mode & dContactMotion2) c.print ("motion2",ct->contact.surface.motion2);
if (mode & dContactSlip1) c.print ("slip1",ct->contact.surface.slip1);
if (mode & dContactSlip2) c.print ("slip2",ct->contact.surface.slip2);
int fa = 0; // friction approximation code
if (mode & dContactApprox1_1) fa |= 1;
if (mode & dContactApprox1_2) fa |= 2;
if (fa) c.print ("friction_approximation",fa);
if (mode & dContactFDir1) c.print ("fdir1",ct->contact.fdir1);
}
static void printUniversal (PrintingContext &c, dxJoint *j)
{
dxJointUniversal *u = (dxJointUniversal*) j;
c.print ("anchor1",u->anchor1);
c.print ("anchor2",u->anchor2);
c.print ("axis1",u->axis1);
c.print ("axis2",u->axis2);
c.print ("qrel1",u->qrel1,4);
c.print ("qrel2",u->qrel2,4);
printLimot (c,u->limot1,1);
printLimot (c,u->limot2,2);
}
static void printHinge2 (PrintingContext &c, dxJoint *j)
{
dxJointHinge2 *h = (dxJointHinge2*) j;
c.print ("anchor1",h->anchor1);
c.print ("anchor2",h->anchor2);
c.print ("axis1",h->axis1);
c.print ("axis2",h->axis2);
c.print ("v1",h->v1); //@@@ much better to write out 'qrel' here, if it's available
c.print ("v2",h->v2);
c.print ("susp_erp",h->susp_erp);
c.print ("susp_cfm",h->susp_cfm);
printLimot (c,h->limot1,1);
printLimot (c,h->limot2,2);
}
static void printFixed (PrintingContext &c, dxJoint *j)
{
dxJointFixed *f = (dxJointFixed*) j;
c.print ("qrel",f->qrel);
c.print ("offset",f->offset);
}
static void printAMotor (PrintingContext &c, dxJoint *j)
{
dxJointAMotor *a = (dxJointAMotor*) j;
c.print ("num",a->num);
c.print ("mode",a->mode);
c.printIndent();
fprintf (c.file,"rel = {%d,%d,%d},\n",a->rel[0],a->rel[1],a->rel[2]);
c.print ("axis1",a->axis[0]);
c.print ("axis2",a->axis[1]);
c.print ("axis3",a->axis[2]);
for (int i=0; i<3; i++) printLimot (c,a->limot[i],i+1);
c.print ("angle1",a->angle[0]);
c.print ("angle2",a->angle[1]);
c.print ("angle3",a->angle[2]);
}
//***************************************************************************
// geometry
static void printGeom (PrintingContext &c, dxGeom *g);
static void printSphere (PrintingContext &c, dxGeom *g)
{
c.print ("type","sphere");
c.print ("radius",dGeomSphereGetRadius (g));
}
static void printBox (PrintingContext &c, dxGeom *g)
{
dVector3 sides;
dGeomBoxGetLengths (g,sides);
c.print ("type","box");
c.print ("sides",sides);
}
static void printCCylinder (PrintingContext &c, dxGeom *g)
{
dReal radius,length;
dGeomCCylinderGetParams (g,&radius,&length);
c.print ("type","capsule");
c.print ("radius",radius);
c.print ("length",length);
}
static void printPlane (PrintingContext &c, dxGeom *g)
{
dVector4 e;
dGeomPlaneGetParams (g,e);
c.print ("type","plane");
c.print ("normal",e);
c.print ("d",e[3]);
}
static void printRay (PrintingContext &c, dxGeom *g)
{
dReal length = dGeomRayGetLength (g);
c.print ("type","ray");
c.print ("length",length);
}
static void printGeomTransform (PrintingContext &c, dxGeom *g)
{
dxGeom *g2 = dGeomTransformGetGeom (g);
const dReal *pos = dGeomGetPosition (g2);
dQuaternion q;
dGeomGetQuaternion (g2,q);
c.print ("type","transform");
c.print ("pos",pos);
c.print ("q",q,4);
c.print ("geometry = {");
c.indent++;
printGeom (c,g2);
c.indent--;
c.print ("}");
}
static void printTriMesh (PrintingContext &c, dxGeom *g)
{
c.print ("type","trimesh");
//@@@ i don't think that the trimesh accessor functions are really
// sufficient to read out all the triangle data, and anyway we
// should have a method of not duplicating trimesh data that is
// shared.
}
static void printGeom (PrintingContext &c, dxGeom *g)
{
unsigned long category = dGeomGetCategoryBits (g);
if (category != (unsigned long)(~0)) {
c.printIndent();
fprintf (c.file,"category_bits = %lu\n",category);
}
unsigned long collide = dGeomGetCollideBits (g);
if (collide != (unsigned long)(~0)) {
c.printIndent();
fprintf (c.file,"collide_bits = %lu\n",collide);
}
if (!dGeomIsEnabled (g)) {
c.print ("disabled",1);
}
switch (g->type) {
case dSphereClass: printSphere (c,g); break;
case dBoxClass: printBox (c,g); break;
case dCCylinderClass: printCCylinder (c,g); break;
case dPlaneClass: printPlane (c,g); break;
case dRayClass: printRay (c,g); break;
case dGeomTransformClass: printGeomTransform (c,g); break;
case dTriMeshClass: printTriMesh (c,g); break;
}
}
//***************************************************************************
// world
void dWorldExportDIF (dWorldID w, FILE *file, const char *prefix)
{
PrintingContext c;
c.file = file;
#if defined(dSINGLE)
c.precision = 7;
#else
c.precision = 15;
#endif
c.indent = 1;
fprintf (file,"-- Dynamics Interchange Format v0.1\n\n%sworld = dynamics.world {\n",prefix);
c.print ("gravity",w->gravity);
c.print ("ODE = {");
c.indent++;
c.print ("ERP",w->global_erp);
c.print ("CFM",w->global_cfm);
c.print ("auto_disable = {");
c.indent++;
c.print ("linear_threshold",w->adis.linear_threshold);
c.print ("angular_threshold",w->adis.angular_threshold);
c.print ("idle_time",w->adis.idle_time);
c.print ("idle_steps",w->adis.idle_steps);
fprintf (file,"\t\t},\n\t},\n}\n");
c.indent -= 3;
// bodies
int num = 0;
fprintf (file,"%sbody = {}\n",prefix);
for (dxBody *b=w->firstbody; b; b=(dxBody*)b->next) {
b->tag = num;
fprintf (file,"%sbody[%d] = dynamics.body {\n\tworld = %sworld,\n",prefix,num,prefix);
c.indent++;
c.print ("pos",b->pos);
c.print ("q",b->q,4);
c.print ("lvel",b->lvel);
c.print ("avel",b->avel);
c.print ("mass",b->mass.mass);
fprintf (file,"\tI = {{");
for (int i=0; i<3; i++) {
for (int j=0; j<3; j++) {
c.printReal (b->mass.I[i*4+j]);
if (j < 2) fputc (',',file);
}
if (i < 2) fprintf (file,"},{");
}
fprintf (file,"}},\n");
c.printNonzero ("com",b->mass.c);
c.print ("ODE = {");
c.indent++;
if (b->flags & dxBodyFlagFiniteRotation) c.print ("finite_rotation",1);
if (b->flags & dxBodyDisabled) c.print ("disabled",1);
if (b->flags & dxBodyNoGravity) c.print ("no_gravity",1);
if (b->flags & dxBodyAutoDisable) {
c.print ("auto_disable = {");
c.indent++;
c.print ("linear_threshold",b->adis.linear_threshold);
c.print ("angular_threshold",b->adis.angular_threshold);
c.print ("idle_time",b->adis.idle_time);
c.print ("idle_steps",b->adis.idle_steps);
c.print ("time_left",b->adis_timeleft);
c.print ("steps_left",b->adis_stepsleft);
c.indent--;
c.print ("},");
}
c.printNonzero ("facc",b->facc);
c.printNonzero ("tacc",b->tacc);
if (b->flags & dxBodyFlagFiniteRotationAxis) {
c.print ("finite_rotation_axis",b->finite_rot_axis);
}
c.indent--;
c.print ("},");
if (b->geom) {
c.print ("geometry = {");
c.indent++;
for (dxGeom *g=b->geom; g; g=g->body_next) {
c.print ("{");
c.indent++;
printGeom (c,g);
c.indent--;
c.print ("},");
}
c.indent--;
c.print ("},");
}
c.indent--;
c.print ("}");
num++;
}
// joints
num = 0;
fprintf (file,"%sjoint = {}\n",prefix);
for (dxJoint *j=w->firstjoint; j; j=(dxJoint*)j->next) {
c.indent++;
const char *name = getJointName (j);
fprintf (file,
"%sjoint[%d] = dynamics.%s_joint {\n"
"\tworld = %sworld,\n"
"\tbody = {%sbody[%d]"
,prefix,num,name,prefix,prefix,j->node[0].body->tag);
if (j->node[1].body) fprintf (file,",%sbody[%d]",prefix,j->node[1].body->tag);
fprintf (file,"},\n");
switch (j->vtable->typenum) {
case dJointTypeBall: printBall (c,j); break;
case dJointTypeHinge: printHinge (c,j); break;
case dJointTypeSlider: printSlider (c,j); break;
case dJointTypeContact: printContact (c,j); break;
case dJointTypeUniversal: printUniversal (c,j); break;
case dJointTypeHinge2: printHinge2 (c,j); break;
case dJointTypeFixed: printFixed (c,j); break;
case dJointTypeAMotor: printAMotor (c,j); break;
}
c.indent--;
c.print ("}");
num++;
}
}

View File

@ -1,30 +0,0 @@
/* generated code, do not edit. */
#include "ode/matrix.h"
dReal dDot (const dReal *a, const dReal *b, int n)
{
dReal p0,q0,m0,p1,q1,m1,sum;
sum = 0;
n -= 2;
while (n >= 0) {
p0 = a[0]; q0 = b[0];
m0 = p0 * q0;
p1 = a[1]; q1 = b[1];
m1 = p1 * q1;
sum += m0;
sum += m1;
a += 2;
b += 2;
n -= 2;
}
n += 2;
while (n > 0) {
sum += (*a) * (*b);
a++;
b++;
n--;
}
return sum;
}

View File

@ -1,381 +0,0 @@
/* generated code, do not edit. */
#include "ode/matrix.h"
/* solve L*X=B, with B containing 1 right hand sides.
* L is an n*n lower triangular matrix with ones on the diagonal.
* L is stored by rows and its leading dimension is lskip.
* B is an n*1 matrix that contains the right hand sides.
* B is stored by columns and its leading dimension is also lskip.
* B is overwritten with X.
* this processes blocks of 2*2.
* if this is in the factorizer source file, n must be a multiple of 2.
*/
static void dSolveL1_1 (const dReal *L, dReal *B, int n, int lskip1)
{
/* declare variables - Z matrix, p and q vectors, etc */
dReal Z11,m11,Z21,m21,p1,q1,p2,*ex;
const dReal *ell;
int i,j;
/* compute all 2 x 1 blocks of X */
for (i=0; i < n; i+=2) {
/* compute all 2 x 1 block of X, from rows i..i+2-1 */
/* set the Z matrix to 0 */
Z11=0;
Z21=0;
ell = L + i*lskip1;
ex = B;
/* the inner loop that computes outer products and adds them to Z */
for (j=i-2; j >= 0; j -= 2) {
/* compute outer product and add it to the Z matrix */
p1=ell[0];
q1=ex[0];
m11 = p1 * q1;
p2=ell[lskip1];
m21 = p2 * q1;
Z11 += m11;
Z21 += m21;
/* compute outer product and add it to the Z matrix */
p1=ell[1];
q1=ex[1];
m11 = p1 * q1;
p2=ell[1+lskip1];
m21 = p2 * q1;
/* advance pointers */
ell += 2;
ex += 2;
Z11 += m11;
Z21 += m21;
/* end of inner loop */
}
/* compute left-over iterations */
j += 2;
for (; j > 0; j--) {
/* compute outer product and add it to the Z matrix */
p1=ell[0];
q1=ex[0];
m11 = p1 * q1;
p2=ell[lskip1];
m21 = p2 * q1;
/* advance pointers */
ell += 1;
ex += 1;
Z11 += m11;
Z21 += m21;
}
/* finish computing the X(i) block */
Z11 = ex[0] - Z11;
ex[0] = Z11;
p1 = ell[lskip1];
Z21 = ex[1] - Z21 - p1*Z11;
ex[1] = Z21;
/* end of outer loop */
}
}
/* solve L*X=B, with B containing 2 right hand sides.
* L is an n*n lower triangular matrix with ones on the diagonal.
* L is stored by rows and its leading dimension is lskip.
* B is an n*2 matrix that contains the right hand sides.
* B is stored by columns and its leading dimension is also lskip.
* B is overwritten with X.
* this processes blocks of 2*2.
* if this is in the factorizer source file, n must be a multiple of 2.
*/
static void dSolveL1_2 (const dReal *L, dReal *B, int n, int lskip1)
{
/* declare variables - Z matrix, p and q vectors, etc */
dReal Z11,m11,Z12,m12,Z21,m21,Z22,m22,p1,q1,p2,q2,*ex;
const dReal *ell;
int i,j;
/* compute all 2 x 2 blocks of X */
for (i=0; i < n; i+=2) {
/* compute all 2 x 2 block of X, from rows i..i+2-1 */
/* set the Z matrix to 0 */
Z11=0;
Z12=0;
Z21=0;
Z22=0;
ell = L + i*lskip1;
ex = B;
/* the inner loop that computes outer products and adds them to Z */
for (j=i-2; j >= 0; j -= 2) {
/* compute outer product and add it to the Z matrix */
p1=ell[0];
q1=ex[0];
m11 = p1 * q1;
q2=ex[lskip1];
m12 = p1 * q2;
p2=ell[lskip1];
m21 = p2 * q1;
m22 = p2 * q2;
Z11 += m11;
Z12 += m12;
Z21 += m21;
Z22 += m22;
/* compute outer product and add it to the Z matrix */
p1=ell[1];
q1=ex[1];
m11 = p1 * q1;
q2=ex[1+lskip1];
m12 = p1 * q2;
p2=ell[1+lskip1];
m21 = p2 * q1;
m22 = p2 * q2;
/* advance pointers */
ell += 2;
ex += 2;
Z11 += m11;
Z12 += m12;
Z21 += m21;
Z22 += m22;
/* end of inner loop */
}
/* compute left-over iterations */
j += 2;
for (; j > 0; j--) {
/* compute outer product and add it to the Z matrix */
p1=ell[0];
q1=ex[0];
m11 = p1 * q1;
q2=ex[lskip1];
m12 = p1 * q2;
p2=ell[lskip1];
m21 = p2 * q1;
m22 = p2 * q2;
/* advance pointers */
ell += 1;
ex += 1;
Z11 += m11;
Z12 += m12;
Z21 += m21;
Z22 += m22;
}
/* finish computing the X(i) block */
Z11 = ex[0] - Z11;
ex[0] = Z11;
Z12 = ex[lskip1] - Z12;
ex[lskip1] = Z12;
p1 = ell[lskip1];
Z21 = ex[1] - Z21 - p1*Z11;
ex[1] = Z21;
Z22 = ex[1+lskip1] - Z22 - p1*Z12;
ex[1+lskip1] = Z22;
/* end of outer loop */
}
}
void dFactorLDLT (dReal *A, dReal *d, int n, int nskip1)
{
int i,j;
dReal sum,*ell,*dee,dd,p1,p2,q1,q2,Z11,m11,Z21,m21,Z22,m22;
if (n < 1) return;
for (i=0; i<=n-2; i += 2) {
/* solve L*(D*l)=a, l is scaled elements in 2 x i block at A(i,0) */
dSolveL1_2 (A,A+i*nskip1,i,nskip1);
/* scale the elements in a 2 x i block at A(i,0), and also */
/* compute Z = the outer product matrix that we'll need. */
Z11 = 0;
Z21 = 0;
Z22 = 0;
ell = A+i*nskip1;
dee = d;
for (j=i-6; j >= 0; j -= 6) {
p1 = ell[0];
p2 = ell[nskip1];
dd = dee[0];
q1 = p1*dd;
q2 = p2*dd;
ell[0] = q1;
ell[nskip1] = q2;
m11 = p1*q1;
m21 = p2*q1;
m22 = p2*q2;
Z11 += m11;
Z21 += m21;
Z22 += m22;
p1 = ell[1];
p2 = ell[1+nskip1];
dd = dee[1];
q1 = p1*dd;
q2 = p2*dd;
ell[1] = q1;
ell[1+nskip1] = q2;
m11 = p1*q1;
m21 = p2*q1;
m22 = p2*q2;
Z11 += m11;
Z21 += m21;
Z22 += m22;
p1 = ell[2];
p2 = ell[2+nskip1];
dd = dee[2];
q1 = p1*dd;
q2 = p2*dd;
ell[2] = q1;
ell[2+nskip1] = q2;
m11 = p1*q1;
m21 = p2*q1;
m22 = p2*q2;
Z11 += m11;
Z21 += m21;
Z22 += m22;
p1 = ell[3];
p2 = ell[3+nskip1];
dd = dee[3];
q1 = p1*dd;
q2 = p2*dd;
ell[3] = q1;
ell[3+nskip1] = q2;
m11 = p1*q1;
m21 = p2*q1;
m22 = p2*q2;
Z11 += m11;
Z21 += m21;
Z22 += m22;
p1 = ell[4];
p2 = ell[4+nskip1];
dd = dee[4];
q1 = p1*dd;
q2 = p2*dd;
ell[4] = q1;
ell[4+nskip1] = q2;
m11 = p1*q1;
m21 = p2*q1;
m22 = p2*q2;
Z11 += m11;
Z21 += m21;
Z22 += m22;
p1 = ell[5];
p2 = ell[5+nskip1];
dd = dee[5];
q1 = p1*dd;
q2 = p2*dd;
ell[5] = q1;
ell[5+nskip1] = q2;
m11 = p1*q1;
m21 = p2*q1;
m22 = p2*q2;
Z11 += m11;
Z21 += m21;
Z22 += m22;
ell += 6;
dee += 6;
}
/* compute left-over iterations */
j += 6;
for (; j > 0; j--) {
p1 = ell[0];
p2 = ell[nskip1];
dd = dee[0];
q1 = p1*dd;
q2 = p2*dd;
ell[0] = q1;
ell[nskip1] = q2;
m11 = p1*q1;
m21 = p2*q1;
m22 = p2*q2;
Z11 += m11;
Z21 += m21;
Z22 += m22;
ell++;
dee++;
}
/* solve for diagonal 2 x 2 block at A(i,i) */
Z11 = ell[0] - Z11;
Z21 = ell[nskip1] - Z21;
Z22 = ell[1+nskip1] - Z22;
dee = d + i;
/* factorize 2 x 2 block Z,dee */
/* factorize row 1 */
dee[0] = dRecip(Z11);
/* factorize row 2 */
sum = 0;
q1 = Z21;
q2 = q1 * dee[0];
Z21 = q2;
sum += q1*q2;
dee[1] = dRecip(Z22 - sum);
/* done factorizing 2 x 2 block */
ell[nskip1] = Z21;
}
/* compute the (less than 2) rows at the bottom */
switch (n-i) {
case 0:
break;
case 1:
dSolveL1_1 (A,A+i*nskip1,i,nskip1);
/* scale the elements in a 1 x i block at A(i,0), and also */
/* compute Z = the outer product matrix that we'll need. */
Z11 = 0;
ell = A+i*nskip1;
dee = d;
for (j=i-6; j >= 0; j -= 6) {
p1 = ell[0];
dd = dee[0];
q1 = p1*dd;
ell[0] = q1;
m11 = p1*q1;
Z11 += m11;
p1 = ell[1];
dd = dee[1];
q1 = p1*dd;
ell[1] = q1;
m11 = p1*q1;
Z11 += m11;
p1 = ell[2];
dd = dee[2];
q1 = p1*dd;
ell[2] = q1;
m11 = p1*q1;
Z11 += m11;
p1 = ell[3];
dd = dee[3];
q1 = p1*dd;
ell[3] = q1;
m11 = p1*q1;
Z11 += m11;
p1 = ell[4];
dd = dee[4];
q1 = p1*dd;
ell[4] = q1;
m11 = p1*q1;
Z11 += m11;
p1 = ell[5];
dd = dee[5];
q1 = p1*dd;
ell[5] = q1;
m11 = p1*q1;
Z11 += m11;
ell += 6;
dee += 6;
}
/* compute left-over iterations */
j += 6;
for (; j > 0; j--) {
p1 = ell[0];
dd = dee[0];
q1 = p1*dd;
ell[0] = q1;
m11 = p1*q1;
Z11 += m11;
ell++;
dee++;
}
/* solve for diagonal 1 x 1 block at A(i,i) */
Z11 = ell[0] - Z11;
dee = d + i;
/* factorize 1 x 1 block Z,dee */
/* factorize row 1 */
dee[0] = dRecip(Z11);
/* done factorizing 1 x 1 block */
break;
default: *((char*)0)=0; /* this should never happen! */
}
}

View File

@ -1,298 +0,0 @@
/* generated code, do not edit. */
#include "ode/matrix.h"
/* solve L*X=B, with B containing 1 right hand sides.
* L is an n*n lower triangular matrix with ones on the diagonal.
* L is stored by rows and its leading dimension is lskip.
* B is an n*1 matrix that contains the right hand sides.
* B is stored by columns and its leading dimension is also lskip.
* B is overwritten with X.
* this processes blocks of 4*4.
* if this is in the factorizer source file, n must be a multiple of 4.
*/
void dSolveL1 (const dReal *L, dReal *B, int n, int lskip1)
{
/* declare variables - Z matrix, p and q vectors, etc */
dReal Z11,Z21,Z31,Z41,p1,q1,p2,p3,p4,*ex;
const dReal *ell;
int lskip2,lskip3,i,j;
/* compute lskip values */
lskip2 = 2*lskip1;
lskip3 = 3*lskip1;
/* compute all 4 x 1 blocks of X */
for (i=0; i <= n-4; i+=4) {
/* compute all 4 x 1 block of X, from rows i..i+4-1 */
/* set the Z matrix to 0 */
Z11=0;
Z21=0;
Z31=0;
Z41=0;
ell = L + i*lskip1;
ex = B;
/* the inner loop that computes outer products and adds them to Z */
for (j=i-12; j >= 0; j -= 12) {
/* load p and q values */
p1=ell[0];
q1=ex[0];
p2=ell[lskip1];
p3=ell[lskip2];
p4=ell[lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[1];
q1=ex[1];
p2=ell[1+lskip1];
p3=ell[1+lskip2];
p4=ell[1+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[2];
q1=ex[2];
p2=ell[2+lskip1];
p3=ell[2+lskip2];
p4=ell[2+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[3];
q1=ex[3];
p2=ell[3+lskip1];
p3=ell[3+lskip2];
p4=ell[3+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[4];
q1=ex[4];
p2=ell[4+lskip1];
p3=ell[4+lskip2];
p4=ell[4+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[5];
q1=ex[5];
p2=ell[5+lskip1];
p3=ell[5+lskip2];
p4=ell[5+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[6];
q1=ex[6];
p2=ell[6+lskip1];
p3=ell[6+lskip2];
p4=ell[6+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[7];
q1=ex[7];
p2=ell[7+lskip1];
p3=ell[7+lskip2];
p4=ell[7+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[8];
q1=ex[8];
p2=ell[8+lskip1];
p3=ell[8+lskip2];
p4=ell[8+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[9];
q1=ex[9];
p2=ell[9+lskip1];
p3=ell[9+lskip2];
p4=ell[9+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[10];
q1=ex[10];
p2=ell[10+lskip1];
p3=ell[10+lskip2];
p4=ell[10+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* load p and q values */
p1=ell[11];
q1=ex[11];
p2=ell[11+lskip1];
p3=ell[11+lskip2];
p4=ell[11+lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* advance pointers */
ell += 12;
ex += 12;
/* end of inner loop */
}
/* compute left-over iterations */
j += 12;
for (; j > 0; j--) {
/* load p and q values */
p1=ell[0];
q1=ex[0];
p2=ell[lskip1];
p3=ell[lskip2];
p4=ell[lskip3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
Z21 += p2 * q1;
Z31 += p3 * q1;
Z41 += p4 * q1;
/* advance pointers */
ell += 1;
ex += 1;
}
/* finish computing the X(i) block */
Z11 = ex[0] - Z11;
ex[0] = Z11;
p1 = ell[lskip1];
Z21 = ex[1] - Z21 - p1*Z11;
ex[1] = Z21;
p1 = ell[lskip2];
p2 = ell[1+lskip2];
Z31 = ex[2] - Z31 - p1*Z11 - p2*Z21;
ex[2] = Z31;
p1 = ell[lskip3];
p2 = ell[1+lskip3];
p3 = ell[2+lskip3];
Z41 = ex[3] - Z41 - p1*Z11 - p2*Z21 - p3*Z31;
ex[3] = Z41;
/* end of outer loop */
}
/* compute rows at end that are not a multiple of block size */
for (; i < n; i++) {
/* compute all 1 x 1 block of X, from rows i..i+1-1 */
/* set the Z matrix to 0 */
Z11=0;
ell = L + i*lskip1;
ex = B;
/* the inner loop that computes outer products and adds them to Z */
for (j=i-12; j >= 0; j -= 12) {
/* load p and q values */
p1=ell[0];
q1=ex[0];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[1];
q1=ex[1];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[2];
q1=ex[2];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[3];
q1=ex[3];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[4];
q1=ex[4];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[5];
q1=ex[5];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[6];
q1=ex[6];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[7];
q1=ex[7];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[8];
q1=ex[8];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[9];
q1=ex[9];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[10];
q1=ex[10];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* load p and q values */
p1=ell[11];
q1=ex[11];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* advance pointers */
ell += 12;
ex += 12;
/* end of inner loop */
}
/* compute left-over iterations */
j += 12;
for (; j > 0; j--) {
/* load p and q values */
p1=ell[0];
q1=ex[0];
/* compute outer product and add it to the Z matrix */
Z11 += p1 * q1;
/* advance pointers */
ell += 1;
ex += 1;
}
/* finish computing the X(i) block */
Z11 = ex[0] - Z11;
ex[0] = Z11;
}
}

View File

@ -1,199 +0,0 @@
/* generated code, do not edit. */
#include "ode/matrix.h"
/* solve L^T * x=b, with b containing 1 right hand side.
* L is an n*n lower triangular matrix with ones on the diagonal.
* L is stored by rows and its leading dimension is lskip.
* b is an n*1 matrix that contains the right hand side.
* b is overwritten with x.
* this processes blocks of 4.
*/
void dSolveL1T (const dReal *L, dReal *B, int n, int lskip1)
{
/* declare variables - Z matrix, p and q vectors, etc */
dReal Z11,m11,Z21,m21,Z31,m31,Z41,m41,p1,q1,p2,p3,p4,*ex;
const dReal *ell;
int lskip2,lskip3,i,j;
/* special handling for L and B because we're solving L1 *transpose* */
L = L + (n-1)*(lskip1+1);
B = B + n-1;
lskip1 = -lskip1;
/* compute lskip values */
lskip2 = 2*lskip1;
lskip3 = 3*lskip1;
/* compute all 4 x 1 blocks of X */
for (i=0; i <= n-4; i+=4) {
/* compute all 4 x 1 block of X, from rows i..i+4-1 */
/* set the Z matrix to 0 */
Z11=0;
Z21=0;
Z31=0;
Z41=0;
ell = L - i;
ex = B;
/* the inner loop that computes outer products and adds them to Z */
for (j=i-4; j >= 0; j -= 4) {
/* load p and q values */
p1=ell[0];
q1=ex[0];
p2=ell[-1];
p3=ell[-2];
p4=ell[-3];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
m21 = p2 * q1;
m31 = p3 * q1;
m41 = p4 * q1;
ell += lskip1;
Z11 += m11;
Z21 += m21;
Z31 += m31;
Z41 += m41;
/* load p and q values */
p1=ell[0];
q1=ex[-1];
p2=ell[-1];
p3=ell[-2];
p4=ell[-3];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
m21 = p2 * q1;
m31 = p3 * q1;
m41 = p4 * q1;
ell += lskip1;
Z11 += m11;
Z21 += m21;
Z31 += m31;
Z41 += m41;
/* load p and q values */
p1=ell[0];
q1=ex[-2];
p2=ell[-1];
p3=ell[-2];
p4=ell[-3];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
m21 = p2 * q1;
m31 = p3 * q1;
m41 = p4 * q1;
ell += lskip1;
Z11 += m11;
Z21 += m21;
Z31 += m31;
Z41 += m41;
/* load p and q values */
p1=ell[0];
q1=ex[-3];
p2=ell[-1];
p3=ell[-2];
p4=ell[-3];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
m21 = p2 * q1;
m31 = p3 * q1;
m41 = p4 * q1;
ell += lskip1;
ex -= 4;
Z11 += m11;
Z21 += m21;
Z31 += m31;
Z41 += m41;
/* end of inner loop */
}
/* compute left-over iterations */
j += 4;
for (; j > 0; j--) {
/* load p and q values */
p1=ell[0];
q1=ex[0];
p2=ell[-1];
p3=ell[-2];
p4=ell[-3];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
m21 = p2 * q1;
m31 = p3 * q1;
m41 = p4 * q1;
ell += lskip1;
ex -= 1;
Z11 += m11;
Z21 += m21;
Z31 += m31;
Z41 += m41;
}
/* finish computing the X(i) block */
Z11 = ex[0] - Z11;
ex[0] = Z11;
p1 = ell[-1];
Z21 = ex[-1] - Z21 - p1*Z11;
ex[-1] = Z21;
p1 = ell[-2];
p2 = ell[-2+lskip1];
Z31 = ex[-2] - Z31 - p1*Z11 - p2*Z21;
ex[-2] = Z31;
p1 = ell[-3];
p2 = ell[-3+lskip1];
p3 = ell[-3+lskip2];
Z41 = ex[-3] - Z41 - p1*Z11 - p2*Z21 - p3*Z31;
ex[-3] = Z41;
/* end of outer loop */
}
/* compute rows at end that are not a multiple of block size */
for (; i < n; i++) {
/* compute all 1 x 1 block of X, from rows i..i+1-1 */
/* set the Z matrix to 0 */
Z11=0;
ell = L - i;
ex = B;
/* the inner loop that computes outer products and adds them to Z */
for (j=i-4; j >= 0; j -= 4) {
/* load p and q values */
p1=ell[0];
q1=ex[0];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
ell += lskip1;
Z11 += m11;
/* load p and q values */
p1=ell[0];
q1=ex[-1];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
ell += lskip1;
Z11 += m11;
/* load p and q values */
p1=ell[0];
q1=ex[-2];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
ell += lskip1;
Z11 += m11;
/* load p and q values */
p1=ell[0];
q1=ex[-3];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
ell += lskip1;
ex -= 4;
Z11 += m11;
/* end of inner loop */
}
/* compute left-over iterations */
j += 4;
for (; j > 0; j--) {
/* load p and q values */
p1=ell[0];
q1=ex[0];
/* compute outer product and add it to the Z matrix */
m11 = p1 * q1;
ell += lskip1;
ex -= 1;
Z11 += m11;
}
/* finish computing the X(i) block */
Z11 = ex[0] - Z11;
ex[0] = Z11;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,267 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#ifndef _ODE_JOINT_H_
#define _ODE_JOINT_H_
#include "objects.h"
#include <ode/contact.h>
#include "obstack.h"
// joint flags
enum {
// if this flag is set, the joint was allocated in a joint group
dJOINT_INGROUP = 1,
// if this flag is set, the joint was attached with arguments (0,body).
// our convention is to treat all attaches as (body,0), i.e. so node[0].body
// is always nonzero, so this flag records the fact that the arguments were
// swapped.
dJOINT_REVERSE = 2,
// if this flag is set, the joint can not have just one body attached to it,
// it must have either zero or two bodies attached.
dJOINT_TWOBODIES = 4
};
// there are two of these nodes in the joint, one for each connection to a
// body. these are node of a linked list kept by each body of it's connecting
// joints. but note that the body pointer in each node points to the body that
// makes use of the *other* node, not this node. this trick makes it a bit
// easier to traverse the body/joint graph.
struct dxJointNode {
dxJoint *joint; // pointer to enclosing dxJoint object
dxBody *body; // *other* body this joint is connected to
dxJointNode *next; // next node in body's list of connected joints
};
struct dxJoint : public dObject {
// naming convention: the "first" body this is connected to is node[0].body,
// and the "second" body is node[1].body. if this joint is only connected
// to one body then the second body is 0.
// info returned by getInfo1 function. the constraint dimension is m (<=6).
// i.e. that is the total number of rows in the jacobian. `nub' is the
// number of unbounded variables (which have lo,hi = -/+ infinity).
struct Info1 {
int m,nub;
};
// info returned by getInfo2 function
struct Info2 {
// integrator parameters: frames per second (1/stepsize), default error
// reduction parameter (0..1).
dReal fps,erp;
// for the first and second body, pointers to two (linear and angular)
// n*3 jacobian sub matrices, stored by rows. these matrices will have
// been initialized to 0 on entry. if the second body is zero then the
// J2xx pointers may be 0.
dReal *J1l,*J1a,*J2l,*J2a;
// elements to jump from one row to the next in J's
int rowskip;
// right hand sides of the equation J*v = c + cfm * lambda. cfm is the
// "constraint force mixing" vector. c is set to zero on entry, cfm is
// set to a constant value (typically very small or zero) value on entry.
dReal *c,*cfm;
// lo and hi limits for variables (set to -/+ infinity on entry).
dReal *lo,*hi;
// findex vector for variables. see the LCP solver interface for a
// description of what this does. this is set to -1 on entry.
// note that the returned indexes are relative to the first index of
// the constraint.
int *findex;
};
// virtual function table: size of the joint structure, function pointers.
// we do it this way instead of using C++ virtual functions because
// sometimes we need to allocate joints ourself within a memory pool.
typedef void init_fn (dxJoint *joint);
typedef void getInfo1_fn (dxJoint *joint, Info1 *info);
typedef void getInfo2_fn (dxJoint *joint, Info2 *info);
struct Vtable {
int size;
init_fn *init;
getInfo1_fn *getInfo1;
getInfo2_fn *getInfo2;
int typenum; // a dJointTypeXXX type number
};
Vtable *vtable; // virtual function table
int flags; // dJOINT_xxx flags
dxJointNode node[2]; // connections to bodies. node[1].body can be 0
dJointFeedback *feedback; // optional feedback structure
dReal lambda[6]; // lambda generated by last step
};
// joint group. NOTE: any joints in the group that have their world destroyed
// will have their world pointer set to 0.
struct dxJointGroup : public dBase {
int num; // number of joints on the stack
dObStack stack; // a stack of (possibly differently sized) dxJoint
}; // objects.
// common limit and motor information for a single joint axis of movement
struct dxJointLimitMotor {
dReal vel,fmax; // powered joint: velocity, max force
dReal lostop,histop; // joint limits, relative to initial position
dReal fudge_factor; // when powering away from joint limits
dReal normal_cfm; // cfm to use when not at a stop
dReal stop_erp,stop_cfm; // erp and cfm for when at joint limit
dReal bounce; // restitution factor
// variables used between getInfo1() and getInfo2()
int limit; // 0=free, 1=at lo limit, 2=at hi limit
dReal limit_err; // if at limit, amount over limit
void init (dxWorld *);
void set (int num, dReal value);
dReal get (int num);
int testRotationalLimit (dReal angle);
int addLimot (dxJoint *joint, dxJoint::Info2 *info, int row,
dVector3 ax1, int rotational);
};
// ball and socket
struct dxJointBall : public dxJoint {
dVector3 anchor1; // anchor w.r.t first body
dVector3 anchor2; // anchor w.r.t second body
};
extern struct dxJoint::Vtable __dball_vtable;
// hinge
struct dxJointHinge : public dxJoint {
dVector3 anchor1; // anchor w.r.t first body
dVector3 anchor2; // anchor w.r.t second body
dVector3 axis1; // axis w.r.t first body
dVector3 axis2; // axis w.r.t second body
dQuaternion qrel; // initial relative rotation body1 -> body2
dxJointLimitMotor limot; // limit and motor information
};
extern struct dxJoint::Vtable __dhinge_vtable;
// universal
struct dxJointUniversal : public dxJoint {
dVector3 anchor1; // anchor w.r.t first body
dVector3 anchor2; // anchor w.r.t second body
dVector3 axis1; // axis w.r.t first body
dVector3 axis2; // axis w.r.t second body
dQuaternion qrel1; // initial relative rotation body1 -> virtual cross piece
dQuaternion qrel2; // initial relative rotation virtual cross piece -> body2
dxJointLimitMotor limot1; // limit and motor information for axis1
dxJointLimitMotor limot2; // limit and motor information for axis2
};
extern struct dxJoint::Vtable __duniversal_vtable;
// slider. if body2 is 0 then qrel is the absolute rotation of body1 and
// offset is the position of body1 center along axis1.
struct dxJointSlider : public dxJoint {
dVector3 axis1; // axis w.r.t first body
dQuaternion qrel; // initial relative rotation body1 -> body2
dVector3 offset; // point relative to body2 that should be
// aligned with body1 center along axis1
dxJointLimitMotor limot; // limit and motor information
};
extern struct dxJoint::Vtable __dslider_vtable;
// contact
struct dxJointContact : public dxJoint {
int the_m; // number of rows computed by getInfo1
dContact contact;
};
extern struct dxJoint::Vtable __dcontact_vtable;
// hinge 2
struct dxJointHinge2 : public dxJoint {
dVector3 anchor1; // anchor w.r.t first body
dVector3 anchor2; // anchor w.r.t second body
dVector3 axis1; // axis 1 w.r.t first body
dVector3 axis2; // axis 2 w.r.t second body
dReal c0,s0; // cos,sin of desired angle between axis 1,2
dVector3 v1,v2; // angle ref vectors embedded in first body
dxJointLimitMotor limot1; // limit+motor info for axis 1
dxJointLimitMotor limot2; // limit+motor info for axis 2
dReal susp_erp,susp_cfm; // suspension parameters (erp,cfm)
};
extern struct dxJoint::Vtable __dhinge2_vtable;
// angular motor
struct dxJointAMotor : public dxJoint {
int num; // number of axes (0..3)
int mode; // a dAMotorXXX constant
int rel[3]; // what the axes are relative to (global,b1,b2)
dVector3 axis[3]; // three axes
dxJointLimitMotor limot[3]; // limit+motor info for axes
dReal angle[3]; // user-supplied angles for axes
// these vectors are used for calculating euler angles
dVector3 reference1; // original axis[2], relative to body 1
dVector3 reference2; // original axis[0], relative to body 2
};
extern struct dxJoint::Vtable __damotor_vtable;
// fixed
struct dxJointFixed : public dxJoint {
dQuaternion qrel; // initial relative rotation body1 -> body2
dVector3 offset; // relative offset between the bodies
};
extern struct dxJoint::Vtable __dfixed_vtable;
// null joint, for testing only
struct dxJointNull : public dxJoint {
};
extern struct dxJoint::Vtable __dnull_vtable;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,58 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
/*
given (A,b,lo,hi), solve the LCP problem: A*x = b+w, where each x(i),w(i)
satisfies one of
(1) x = lo, w >= 0
(2) x = hi, w <= 0
(3) lo < x < hi, w = 0
A is a matrix of dimension n*n, everything else is a vector of size n*1.
lo and hi can be +/- dInfinity as needed. the first `nub' variables are
unbounded, i.e. hi and lo are assumed to be +/- dInfinity.
we restrict lo(i) <= 0 and hi(i) >= 0.
the original data (A,b) may be modified by this function.
if the `findex' (friction index) parameter is nonzero, it points to an array
of index values. in this case constraints that have findex[i] >= 0 are
special. all non-special constraints are solved for, then the lo and hi values
for the special constraints are set:
hi[i] = abs( hi[i] * x[findex[i]] )
lo[i] = -hi[i]
and the solution continues. this mechanism allows a friction approximation
to be implemented. the first `nub' variables are assumed to have findex < 0.
*/
#ifndef _ODE_LCP_H_
#define _ODE_LCP_H_
void dSolveLCP (int n, dReal *A, dReal *x, dReal *b, dReal *w,
int nub, dReal *lo, dReal *hi, int *findex);
#endif

View File

@ -1,313 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <ode/config.h>
#include <ode/mass.h>
#include <ode/odemath.h>
#include <ode/matrix.h>
#define _I(i,j) I[(i)*4+(j)]
// return 1 if ok, 0 if bad
static int checkMass (dMass *m)
{
int i;
if (m->mass <= 0) {
dDEBUGMSG ("mass must be > 0");
return 0;
}
if (!dIsPositiveDefinite (m->I,3)) {
dDEBUGMSG ("inertia must be positive definite");
return 0;
}
// verify that the center of mass position is consistent with the mass
// and inertia matrix. this is done by checking that the inertia around
// the center of mass is also positive definite. from the comment in
// dMassTranslate(), if the body is translated so that its center of mass
// is at the point of reference, then the new inertia is:
// I + mass*crossmat(c)^2
// note that requiring this to be positive definite is exactly equivalent
// to requiring that the spatial inertia matrix
// [ mass*eye(3,3) M*crossmat(c)^T ]
// [ M*crossmat(c) I ]
// is positive definite, given that I is PD and mass>0. see the theorem
// about partitioned PD matrices for proof.
dMatrix3 I2,chat;
dSetZero (chat,12);
dCROSSMAT (chat,m->c,4,+,-);
dMULTIPLY0_333 (I2,chat,chat);
for (i=0; i<3; i++) I2[i] = m->I[i] + m->mass*I2[i];
for (i=4; i<7; i++) I2[i] = m->I[i] + m->mass*I2[i];
for (i=8; i<11; i++) I2[i] = m->I[i] + m->mass*I2[i];
if (!dIsPositiveDefinite (I2,3)) {
dDEBUGMSG ("center of mass inconsistent with mass parameters");
return 0;
}
return 1;
}
void dMassSetZero (dMass *m)
{
dAASSERT (m);
m->mass = REAL(0.0);
dSetZero (m->c,sizeof(m->c) / sizeof(dReal));
dSetZero (m->I,sizeof(m->I) / sizeof(dReal));
}
void dMassSetParameters (dMass *m, dReal themass,
dReal cgx, dReal cgy, dReal cgz,
dReal I11, dReal I22, dReal I33,
dReal I12, dReal I13, dReal I23)
{
dAASSERT (m);
dMassSetZero (m);
m->mass = themass;
m->c[0] = cgx;
m->c[1] = cgy;
m->c[2] = cgz;
m->_I(0,0) = I11;
m->_I(1,1) = I22;
m->_I(2,2) = I33;
m->_I(0,1) = I12;
m->_I(0,2) = I13;
m->_I(1,2) = I23;
m->_I(1,0) = I12;
m->_I(2,0) = I13;
m->_I(2,1) = I23;
checkMass (m);
}
void dMassSetSphere (dMass *m, dReal density, dReal radius)
{
dMassSetSphereTotal (m, (REAL(4.0)/REAL(3.0)) * M_PI *
radius*radius*radius * density, radius);
}
void dMassSetSphereTotal (dMass *m, dReal total_mass, dReal radius)
{
dAASSERT (m);
dMassSetZero (m);
m->mass = total_mass;
dReal II = REAL(0.4) * total_mass * radius*radius;
m->_I(0,0) = II;
m->_I(1,1) = II;
m->_I(2,2) = II;
# ifndef dNODEBUG
checkMass (m);
# endif
}
void dMassSetCappedCylinder (dMass *m, dReal density, int direction,
dReal radius, dReal length)
{
dReal M1,M2,Ia,Ib;
dAASSERT (m);
dUASSERT (direction >= 1 && direction <= 3,"bad direction number");
dMassSetZero (m);
M1 = M_PI*radius*radius*length*density; // cylinder mass
M2 = (REAL(4.0)/REAL(3.0))*M_PI*radius*radius*radius*density; // total cap mass
m->mass = M1+M2;
Ia = M1*(REAL(0.25)*radius*radius + (REAL(1.0)/REAL(12.0))*length*length) +
M2*(REAL(0.4)*radius*radius + REAL(0.375)*radius*length + REAL(0.25)*length*length);
Ib = (M1*REAL(0.5) + M2*REAL(0.4))*radius*radius;
m->_I(0,0) = Ia;
m->_I(1,1) = Ia;
m->_I(2,2) = Ia;
m->_I(direction-1,direction-1) = Ib;
# ifndef dNODEBUG
checkMass (m);
# endif
}
void dMassSetCappedCylinderTotal (dMass *m, dReal total_mass, int direction,
dReal a, dReal b)
{
dMassSetCappedCylinder (m, 1.0, direction, a, b);
dMassAdjust (m, total_mass);
}
void dMassSetCylinder (dMass *m, dReal density, int direction,
dReal radius, dReal length)
{
dMassSetCylinderTotal (m, M_PI*radius*radius*length*density,
direction, radius, length);
}
void dMassSetCylinderTotal (dMass *m, dReal total_mass, int direction,
dReal radius, dReal length)
{
dReal r2,I;
dAASSERT (m);
dMassSetZero (m);
r2 = radius*radius;
m->mass = total_mass;
I = total_mass*(REAL(0.25)*r2 + (REAL(1.0)/REAL(12.0))*length*length);
m->_I(0,0) = I;
m->_I(1,1) = I;
m->_I(2,2) = I;
m->_I(direction-1,direction-1) = total_mass*REAL(0.5)*r2;
# ifndef dNODEBUG
checkMass (m);
# endif
}
void dMassSetBox (dMass *m, dReal density,
dReal lx, dReal ly, dReal lz)
{
dMassSetBoxTotal (m, lx*ly*lz*density, lx, ly, lz);
}
void dMassSetBoxTotal (dMass *m, dReal total_mass,
dReal lx, dReal ly, dReal lz)
{
dAASSERT (m);
dMassSetZero (m);
m->mass = total_mass;
m->_I(0,0) = total_mass/REAL(12.0) * (ly*ly + lz*lz);
m->_I(1,1) = total_mass/REAL(12.0) * (lx*lx + lz*lz);
m->_I(2,2) = total_mass/REAL(12.0) * (lx*lx + ly*ly);
# ifndef dNODEBUG
checkMass (m);
# endif
}
void dMassAdjust (dMass *m, dReal newmass)
{
dAASSERT (m);
dReal scale = newmass / m->mass;
m->mass = newmass;
for (int i=0; i<3; i++) for (int j=0; j<3; j++) m->_I(i,j) *= scale;
# ifndef dNODEBUG
checkMass (m);
# endif
}
void dMassTranslate (dMass *m, dReal x, dReal y, dReal z)
{
// if the body is translated by `a' relative to its point of reference,
// the new inertia about the point of reference is:
//
// I + mass*(crossmat(c)^2 - crossmat(c+a)^2)
//
// where c is the existing center of mass and I is the old inertia.
int i,j;
dMatrix3 ahat,chat,t1,t2;
dReal a[3];
dAASSERT (m);
// adjust inertia matrix
dSetZero (chat,12);
dCROSSMAT (chat,m->c,4,+,-);
a[0] = x + m->c[0];
a[1] = y + m->c[1];
a[2] = z + m->c[2];
dSetZero (ahat,12);
dCROSSMAT (ahat,a,4,+,-);
dMULTIPLY0_333 (t1,ahat,ahat);
dMULTIPLY0_333 (t2,chat,chat);
for (i=0; i<3; i++) for (j=0; j<3; j++)
m->_I(i,j) += m->mass * (t2[i*4+j]-t1[i*4+j]);
// ensure perfect symmetry
m->_I(1,0) = m->_I(0,1);
m->_I(2,0) = m->_I(0,2);
m->_I(2,1) = m->_I(1,2);
// adjust center of mass
m->c[0] += x;
m->c[1] += y;
m->c[2] += z;
# ifndef dNODEBUG
checkMass (m);
# endif
}
void dMassRotate (dMass *m, const dMatrix3 R)
{
// if the body is rotated by `R' relative to its point of reference,
// the new inertia about the point of reference is:
//
// R * I * R'
//
// where I is the old inertia.
dMatrix3 t1;
dReal t2[3];
dAASSERT (m);
// rotate inertia matrix
dMULTIPLY2_333 (t1,m->I,R);
dMULTIPLY0_333 (m->I,R,t1);
// ensure perfect symmetry
m->_I(1,0) = m->_I(0,1);
m->_I(2,0) = m->_I(0,2);
m->_I(2,1) = m->_I(1,2);
// rotate center of mass
dMULTIPLY0_331 (t2,R,m->c);
m->c[0] = t2[0];
m->c[1] = t2[1];
m->c[2] = t2[2];
# ifndef dNODEBUG
checkMass (m);
# endif
}
void dMassAdd (dMass *a, const dMass *b)
{
int i;
dAASSERT (a && b);
dReal denom = dRecip (a->mass + b->mass);
for (i=0; i<3; i++) a->c[i] = (a->c[i]*a->mass + b->c[i]*b->mass)*denom;
a->mass += b->mass;
for (i=0; i<12; i++) a->I[i] += b->I[i];
}

View File

@ -1,230 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <ode/config.h>
#include <ode/misc.h>
#include <ode/matrix.h>
#include <ode/error.h>
#include <ode/memory.h>
#include "mat.h"
dMatrix::dMatrix()
{
n = 0;
m = 0;
data = 0;
}
dMatrix::dMatrix (int rows, int cols)
{
if (rows < 1 || cols < 1) dDebug (0,"bad matrix size");
n = rows;
m = cols;
data = (dReal*) dAlloc (n*m*sizeof(dReal));
dSetZero (data,n*m);
}
dMatrix::dMatrix (const dMatrix &a)
{
n = a.n;
m = a.m;
data = (dReal*) dAlloc (n*m*sizeof(dReal));
memcpy (data,a.data,n*m*sizeof(dReal));
}
dMatrix::dMatrix (int rows, int cols,
dReal *_data, int rowskip, int colskip)
{
if (rows < 1 || cols < 1) dDebug (0,"bad matrix size");
n = rows;
m = cols;
data = (dReal*) dAlloc (n*m*sizeof(dReal));
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++) data[i*m+j] = _data[i*rowskip + j*colskip];
}
}
dMatrix::~dMatrix()
{
if (data) dFree (data,n*m*sizeof(dReal));
}
dReal & dMatrix::operator () (int i, int j)
{
if (i < 0 || i >= n || j < 0 || j >= m) dDebug (0,"bad matrix (i,j)");
return data [i*m+j];
}
void dMatrix::operator= (const dMatrix &a)
{
if (data) dFree (data,n*m*sizeof(dReal));
n = a.n;
m = a.m;
if (n > 0 && m > 0) {
data = (dReal*) dAlloc (n*m*sizeof(dReal));
memcpy (data,a.data,n*m*sizeof(dReal));
}
else data = 0;
}
void dMatrix::operator= (dReal a)
{
for (int i=0; i<n*m; i++) data[i] = a;
}
dMatrix dMatrix::transpose()
{
dMatrix r (m,n);
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++) r.data[j*n+i] = data[i*m+j];
}
return r;
}
dMatrix dMatrix::select (int np, int *p, int nq, int *q)
{
if (np < 1 || nq < 1) dDebug (0,"Matrix select, bad index array sizes");
dMatrix r (np,nq);
for (int i=0; i<np; i++) {
for (int j=0; j<nq; j++) {
if (p[i] < 0 || p[i] >= n || q[i] < 0 || q[i] >= m)
dDebug (0,"Matrix select, bad index arrays");
r.data[i*nq+j] = data[p[i]*m+q[j]];
}
}
return r;
}
dMatrix dMatrix::operator + (const dMatrix &a)
{
if (n != a.n || m != a.m) dDebug (0,"matrix +, mismatched sizes");
dMatrix r (n,m);
for (int i=0; i<n*m; i++) r.data[i] = data[i] + a.data[i];
return r;
}
dMatrix dMatrix::operator - (const dMatrix &a)
{
if (n != a.n || m != a.m) dDebug (0,"matrix -, mismatched sizes");
dMatrix r (n,m);
for (int i=0; i<n*m; i++) r.data[i] = data[i] - a.data[i];
return r;
}
dMatrix dMatrix::operator - ()
{
dMatrix r (n,m);
for (int i=0; i<n*m; i++) r.data[i] = -data[i];
return r;
}
dMatrix dMatrix::operator * (const dMatrix &a)
{
if (m != a.n) dDebug (0,"matrix *, mismatched sizes");
dMatrix r (n,a.m);
for (int i=0; i<n; i++) {
for (int j=0; j<a.m; j++) {
dReal sum = 0;
for (int k=0; k<m; k++) sum += data[i*m+k] * a.data[k*a.m+j];
r.data [i*a.m+j] = sum;
}
}
return r;
}
void dMatrix::operator += (const dMatrix &a)
{
if (n != a.n || m != a.m) dDebug (0,"matrix +=, mismatched sizes");
for (int i=0; i<n*m; i++) data[i] += a.data[i];
}
void dMatrix::operator -= (const dMatrix &a)
{
if (n != a.n || m != a.m) dDebug (0,"matrix -=, mismatched sizes");
for (int i=0; i<n*m; i++) data[i] -= a.data[i];
}
void dMatrix::clearUpperTriangle()
{
if (n != m) dDebug (0,"clearUpperTriangle() only works on square matrices");
for (int i=0; i<n; i++) {
for (int j=i+1; j<m; j++) data[i*m+j] = 0;
}
}
void dMatrix::clearLowerTriangle()
{
if (n != m) dDebug (0,"clearLowerTriangle() only works on square matrices");
for (int i=0; i<n; i++) {
for (int j=0; j<i; j++) data[i*m+j] = 0;
}
}
void dMatrix::makeRandom (dReal range)
{
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++)
data[i*m+j] = (dRandReal()*REAL(2.0)-REAL(1.0))*range;
}
}
void dMatrix::print (char *fmt, FILE *f)
{
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++) fprintf (f,fmt,data[i*m+j]);
fprintf (f,"\n");
}
}
dReal dMatrix::maxDifference (const dMatrix &a)
{
if (n != a.n || m != a.m) dDebug (0,"maxDifference(), mismatched sizes");
dReal max = 0;
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++) {
dReal diff = dFabs(data[i*m+j] - a.data[i*m+j]);
if (diff > max) max = diff;
}
}
return max;
}

View File

@ -1,71 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// matrix class. this is mostly for convenience in the testing code, it is
// not optimized at all. correctness is much more importance here.
#ifndef _ODE_MAT_H_
#define _ODE_MAT_H_
#include <ode/common.h>
class dMatrix {
int n,m; // matrix dimension, n,m >= 0
dReal *data; // if nonzero, n*m elements allocated on the heap
public:
// constructors, destructors
dMatrix(); // make default 0x0 matrix
dMatrix (int rows, int cols); // construct zero matrix of given size
dMatrix (const dMatrix &); // construct copy of given matrix
// create copy of given data - element (i,j) is data[i*rowskip+j*colskip]
dMatrix (int rows, int cols, dReal *_data, int rowskip, int colskip);
~dMatrix(); // destructor
// data movement
dReal & operator () (int i, int j); // reference an element
void operator= (const dMatrix &); // matrix = matrix
void operator= (dReal); // matrix = scalar
dMatrix transpose(); // return transposed matrix
// return a permuted submatrix of this matrix, made up of the rows in p
// and the columns in q. p has np elements, q has nq elements.
dMatrix select (int np, int *p, int nq, int *q);
// operators
dMatrix operator + (const dMatrix &);
dMatrix operator - (const dMatrix &);
dMatrix operator - ();
dMatrix operator * (const dMatrix &);
void operator += (const dMatrix &);
void operator -= (const dMatrix &);
// utility
void clearUpperTriangle();
void clearLowerTriangle();
void makeRandom (dReal range);
void print (char *fmt = "%10.4f ", FILE *f=stdout);
dReal maxDifference (const dMatrix &);
};
#endif

View File

@ -1,358 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <ode/common.h>
#include <ode/matrix.h>
// misc defines
#define ALLOCA dALLOCA16
void dSetZero (dReal *a, int n)
{
dAASSERT (a && n >= 0);
while (n > 0) {
*(a++) = 0;
n--;
}
}
void dSetValue (dReal *a, int n, dReal value)
{
dAASSERT (a && n >= 0);
while (n > 0) {
*(a++) = value;
n--;
}
}
void dMultiply0 (dReal *A, const dReal *B, const dReal *C, int p, int q, int r)
{
int i,j,k,qskip,rskip,rpad;
dAASSERT (A && B && C && p>0 && q>0 && r>0);
qskip = dPAD(q);
rskip = dPAD(r);
rpad = rskip - r;
dReal sum;
const dReal *b,*c,*bb;
bb = B;
for (i=p; i; i--) {
for (j=0 ; j<r; j++) {
c = C + j;
b = bb;
sum = 0;
for (k=q; k; k--, c+=rskip) sum += (*(b++))*(*c);
*(A++) = sum;
}
A += rpad;
bb += qskip;
}
}
void dMultiply1 (dReal *A, const dReal *B, const dReal *C, int p, int q, int r)
{
int i,j,k,pskip,rskip;
dReal sum;
dAASSERT (A && B && C && p>0 && q>0 && r>0);
pskip = dPAD(p);
rskip = dPAD(r);
for (i=0; i<p; i++) {
for (j=0; j<r; j++) {
sum = 0;
for (k=0; k<q; k++) sum += B[i+k*pskip] * C[j+k*rskip];
A[i*rskip+j] = sum;
}
}
}
void dMultiply2 (dReal *A, const dReal *B, const dReal *C, int p, int q, int r)
{
int i,j,k,z,rpad,qskip;
dReal sum;
const dReal *bb,*cc;
dAASSERT (A && B && C && p>0 && q>0 && r>0);
rpad = dPAD(r) - r;
qskip = dPAD(q);
bb = B;
for (i=p; i; i--) {
cc = C;
for (j=r; j; j--) {
z = 0;
sum = 0;
for (k=q; k; k--,z++) sum += bb[z] * cc[z];
*(A++) = sum;
cc += qskip;
}
A += rpad;
bb += qskip;
}
}
int dFactorCholesky (dReal *A, int n)
{
int i,j,k,nskip;
dReal sum,*a,*b,*aa,*bb,*cc,*recip;
dAASSERT (n > 0 && A);
nskip = dPAD (n);
recip = (dReal*) ALLOCA (n * sizeof(dReal));
aa = A;
for (i=0; i<n; i++) {
bb = A;
cc = A + i*nskip;
for (j=0; j<i; j++) {
sum = *cc;
a = aa;
b = bb;
for (k=j; k; k--) sum -= (*(a++))*(*(b++));
*cc = sum * recip[j];
bb += nskip;
cc++;
}
sum = *cc;
a = aa;
for (k=i; k; k--, a++) sum -= (*a)*(*a);
if (sum <= REAL(0.0)) return 0;
*cc = dSqrt(sum);
recip[i] = dRecip (*cc);
aa += nskip;
}
return 1;
}
void dSolveCholesky (const dReal *L, dReal *b, int n)
{
int i,k,nskip;
dReal sum,*y;
dAASSERT (n > 0 && L && b);
nskip = dPAD (n);
y = (dReal*) ALLOCA (n*sizeof(dReal));
for (i=0; i<n; i++) {
sum = 0;
for (k=0; k < i; k++) sum += L[i*nskip+k]*y[k];
y[i] = (b[i]-sum)/L[i*nskip+i];
}
for (i=n-1; i >= 0; i--) {
sum = 0;
for (k=i+1; k < n; k++) sum += L[k*nskip+i]*b[k];
b[i] = (y[i]-sum)/L[i*nskip+i];
}
}
int dInvertPDMatrix (const dReal *A, dReal *Ainv, int n)
{
int i,j,nskip;
dReal *L,*x;
dAASSERT (n > 0 && A && Ainv);
nskip = dPAD (n);
L = (dReal*) ALLOCA (nskip*n*sizeof(dReal));
memcpy (L,A,nskip*n*sizeof(dReal));
x = (dReal*) ALLOCA (n*sizeof(dReal));
if (dFactorCholesky (L,n)==0) return 0;
dSetZero (Ainv,n*nskip); // make sure all padding elements set to 0
for (i=0; i<n; i++) {
for (j=0; j<n; j++) x[j] = 0;
x[i] = 1;
dSolveCholesky (L,x,n);
for (j=0; j<n; j++) Ainv[j*nskip+i] = x[j];
}
return 1;
}
int dIsPositiveDefinite (const dReal *A, int n)
{
dReal *Acopy;
dAASSERT (n > 0 && A);
int nskip = dPAD (n);
Acopy = (dReal*) ALLOCA (nskip*n * sizeof(dReal));
memcpy (Acopy,A,nskip*n * sizeof(dReal));
return dFactorCholesky (Acopy,n);
}
/***** this has been replaced by a faster version
void dSolveL1T (const dReal *L, dReal *b, int n, int nskip)
{
int i,j;
dAASSERT (L && b && n >= 0 && nskip >= n);
dReal sum;
for (i=n-2; i>=0; i--) {
sum = 0;
for (j=i+1; j<n; j++) sum += L[j*nskip+i]*b[j];
b[i] -= sum;
}
}
*/
void dVectorScale (dReal *a, const dReal *d, int n)
{
dAASSERT (a && d && n >= 0);
for (int i=0; i<n; i++) a[i] *= d[i];
}
void dSolveLDLT (const dReal *L, const dReal *d, dReal *b, int n, int nskip)
{
dAASSERT (L && d && b && n > 0 && nskip >= n);
dSolveL1 (L,b,n,nskip);
dVectorScale (b,d,n);
dSolveL1T (L,b,n,nskip);
}
void dLDLTAddTL (dReal *L, dReal *d, const dReal *a, int n, int nskip)
{
int j,p;
dReal *W1,*W2,W11,W21,alpha1,alpha2,alphanew,gamma1,gamma2,k1,k2,Wp,ell,dee;
dAASSERT (L && d && a && n > 0 && nskip >= n);
if (n < 2) return;
W1 = (dReal*) ALLOCA (n*sizeof(dReal));
W2 = (dReal*) ALLOCA (n*sizeof(dReal));
W1[0] = 0;
W2[0] = 0;
for (j=1; j<n; j++) W1[j] = W2[j] = a[j] * M_SQRT1_2;
W11 = (REAL(0.5)*a[0]+1)*M_SQRT1_2;
W21 = (REAL(0.5)*a[0]-1)*M_SQRT1_2;
alpha1=1;
alpha2=1;
dee = d[0];
alphanew = alpha1 + (W11*W11)*dee;
dee /= alphanew;
gamma1 = W11 * dee;
dee *= alpha1;
alpha1 = alphanew;
alphanew = alpha2 - (W21*W21)*dee;
dee /= alphanew;
gamma2 = W21 * dee;
alpha2 = alphanew;
k1 = REAL(1.0) - W21*gamma1;
k2 = W21*gamma1*W11 - W21;
for (p=1; p<n; p++) {
Wp = W1[p];
ell = L[p*nskip];
W1[p] = Wp - W11*ell;
W2[p] = k1*Wp + k2*ell;
}
for (j=1; j<n; j++) {
dee = d[j];
alphanew = alpha1 + (W1[j]*W1[j])*dee;
dee /= alphanew;
gamma1 = W1[j] * dee;
dee *= alpha1;
alpha1 = alphanew;
alphanew = alpha2 - (W2[j]*W2[j])*dee;
dee /= alphanew;
gamma2 = W2[j] * dee;
dee *= alpha2;
d[j] = dee;
alpha2 = alphanew;
k1 = W1[j];
k2 = W2[j];
for (p=j+1; p<n; p++) {
ell = L[p*nskip+j];
Wp = W1[p] - k1 * ell;
ell += gamma1 * Wp;
W1[p] = Wp;
Wp = W2[p] - k2 * ell;
ell -= gamma2 * Wp;
W2[p] = Wp;
L[p*nskip+j] = ell;
}
}
}
// macros for dLDLTRemove() for accessing A - either access the matrix
// directly or access it via row pointers. we are only supposed to reference
// the lower triangle of A (it is symmetric), but indexes i and j come from
// permutation vectors so they are not predictable. so do a test on the
// indexes - this should not slow things down too much, as we don't do this
// in an inner loop.
#define _GETA(i,j) (A[i][j])
//#define _GETA(i,j) (A[(i)*nskip+(j)])
#define GETA(i,j) ((i > j) ? _GETA(i,j) : _GETA(j,i))
void dLDLTRemove (dReal **A, const int *p, dReal *L, dReal *d,
int n1, int n2, int r, int nskip)
{
int i;
dAASSERT(A && p && L && d && n1 > 0 && n2 > 0 && r >= 0 && r < n2 &&
n1 >= n2 && nskip >= n1);
#ifndef dNODEBUG
for (i=0; i<n2; i++) dIASSERT(p[i] >= 0 && p[i] < n1);
#endif
if (r==n2-1) {
return; // deleting last row/col is easy
}
else if (r==0) {
dReal *a = (dReal*) ALLOCA (n2 * sizeof(dReal));
for (i=0; i<n2; i++) a[i] = -GETA(p[i],p[0]);
a[0] += REAL(1.0);
dLDLTAddTL (L,d,a,n2,nskip);
}
else {
dReal *t = (dReal*) ALLOCA (r * sizeof(dReal));
dReal *a = (dReal*) ALLOCA ((n2-r) * sizeof(dReal));
for (i=0; i<r; i++) t[i] = L[r*nskip+i] / d[i];
for (i=0; i<(n2-r); i++)
a[i] = dDot(L+(r+i)*nskip,t,r) - GETA(p[r+i],p[r]);
a[0] += REAL(1.0);
dLDLTAddTL (L + r*nskip+r, d+r, a, n2-r, nskip);
}
// snip out row/column r from L and d
dRemoveRowCol (L,n2,nskip,r);
if (r < (n2-1)) memmove (d+r,d+r+1,(n2-r-1)*sizeof(dReal));
}
void dRemoveRowCol (dReal *A, int n, int nskip, int r)
{
int i;
dAASSERT(A && n > 0 && nskip >= n && r >= 0 && r < n);
if (r >= n-1) return;
if (r > 0) {
for (i=0; i<r; i++)
memmove (A+i*nskip+r,A+i*nskip+r+1,(n-r-1)*sizeof(dReal));
for (i=r; i<(n-1); i++)
memcpy (A+i*nskip,A+i*nskip+nskip,r*sizeof(dReal));
}
for (i=r; i<(n-1); i++)
memcpy (A+i*nskip+r,A+i*nskip+nskip+r+1,(n-r-1)*sizeof(dReal));
}

View File

@ -1,87 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <ode/config.h>
#include <ode/memory.h>
#include <ode/error.h>
static dAllocFunction *allocfn = 0;
static dReallocFunction *reallocfn = 0;
static dFreeFunction *freefn = 0;
void dSetAllocHandler (dAllocFunction *fn)
{
allocfn = fn;
}
void dSetReallocHandler (dReallocFunction *fn)
{
reallocfn = fn;
}
void dSetFreeHandler (dFreeFunction *fn)
{
freefn = fn;
}
dAllocFunction *dGetAllocHandler()
{
return allocfn;
}
dReallocFunction *dGetReallocHandler()
{
return reallocfn;
}
dFreeFunction *dGetFreeHandler()
{
return freefn;
}
void * dAlloc (size_t size)
{
if (allocfn) return allocfn (size); else return malloc (size);
}
void * dRealloc (void *ptr, size_t oldsize, size_t newsize)
{
if (reallocfn) return reallocfn (ptr,oldsize,newsize);
else return realloc (ptr,newsize);
}
void dFree (void *ptr, size_t size)
{
if (!ptr) return;
if (freefn) freefn (ptr,size); else free (ptr);
}

View File

@ -1,169 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <ode/config.h>
#include <ode/misc.h>
#include <ode/matrix.h>
//****************************************************************************
// random numbers
static unsigned long seed = 0;
unsigned long dRand()
{
seed = (1664525L*seed + 1013904223L) & 0xffffffff;
return seed;
}
unsigned long dRandGetSeed()
{
return seed;
}
void dRandSetSeed (unsigned long s)
{
seed = s;
}
int dTestRand()
{
unsigned long oldseed = seed;
int ret = 1;
seed = 0;
if (dRand() != 0x3c6ef35f || dRand() != 0x47502932 ||
dRand() != 0xd1ccf6e9 || dRand() != 0xaaf95334 ||
dRand() != 0x6252e503) ret = 0;
seed = oldseed;
return ret;
}
/* adam's all-int straightforward(?) dRandInt (0..n-1) */
int dRandInt (int n)
{
/* seems good; xor-fold and modulus */
const unsigned long un = n;
unsigned long r = dRand();
/* note: probably more aggressive than it needs to be -- might be
able to get away without one or two of the innermost branches. */
if (un <= 0x00010000UL) {
r ^= (r >> 16);
if (un <= 0x00000100UL) {
r ^= (r >> 8);
if (un <= 0x00000010UL) {
r ^= (r >> 4);
if (un <= 0x00000004UL) {
r ^= (r >> 2);
if (un <= 0x00000002UL) {
r ^= (r >> 1);
}
}
}
}
}
return (int) (r % un);
}
dReal dRandReal()
{
return ((dReal) dRand()) / ((dReal) 0xffffffff);
}
//****************************************************************************
// matrix utility stuff
void dPrintMatrix (const dReal *A, int n, int m, char *fmt, FILE *f)
{
int i,j;
int skip = dPAD(m);
for (i=0; i<n; i++) {
for (j=0; j<m; j++) fprintf (f,fmt,A[i*skip+j]);
fprintf (f,"\n");
}
}
void dMakeRandomVector (dReal *A, int n, dReal range)
{
int i;
for (i=0; i<n; i++) A[i] = (dRandReal()*REAL(2.0)-REAL(1.0))*range;
}
void dMakeRandomMatrix (dReal *A, int n, int m, dReal range)
{
int i,j;
int skip = dPAD(m);
dSetZero (A,n*skip);
for (i=0; i<n; i++) {
for (j=0; j<m; j++) A[i*skip+j] = (dRandReal()*REAL(2.0)-REAL(1.0))*range;
}
}
void dClearUpperTriangle (dReal *A, int n)
{
int i,j;
int skip = dPAD(n);
for (i=0; i<n; i++) {
for (j=i+1; j<n; j++) A[i*skip+j] = 0;
}
}
dReal dMaxDifference (const dReal *A, const dReal *B, int n, int m)
{
int i,j;
int skip = dPAD(m);
dReal diff,max;
max = 0;
for (i=0; i<n; i++) {
for (j=0; j<m; j++) {
diff = dFabs(A[i*skip+j] - B[i*skip+j]);
if (diff > max) max = diff;
}
}
return max;
}
dReal dMaxDifferenceLowerTriangle (const dReal *A, const dReal *B, int n)
{
int i,j;
int skip = dPAD(n);
dReal diff,max;
max = 0;
for (i=0; i<n; i++) {
for (j=0; j<=i; j++) {
diff = dFabs(A[i*skip+j] - B[i*skip+j]);
if (diff > max) max = diff;
}
}
return max;
}

View File

@ -1,125 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// object, body, and world structs.
#ifndef _ODE_OBJECT_H_
#define _ODE_OBJECT_H_
#include <ode/common.h>
#include <ode/memory.h>
#include <ode/mass.h>
#include "array.h"
// some body flags
enum {
dxBodyFlagFiniteRotation = 1, // use finite rotations
dxBodyFlagFiniteRotationAxis = 2, // use finite rotations only along axis
dxBodyDisabled = 4, // body is disabled
dxBodyNoGravity = 8, // body is not influenced by gravity
dxBodyAutoDisable = 16 // enable auto-disable on body
};
// base class that does correct object allocation / deallocation
struct dBase {
void *operator new (size_t size) { return dAlloc (size); }
void operator delete (void *ptr, size_t size) { dFree (ptr,size); }
void *operator new[] (size_t size) { return dAlloc (size); }
void operator delete[] (void *ptr, size_t size) { dFree (ptr,size); }
};
// base class for bodies and joints
struct dObject : public dBase {
dxWorld *world; // world this object is in
dObject *next; // next object of this type in list
dObject **tome; // pointer to previous object's next ptr
void *userdata; // user settable data
int tag; // used by dynamics algorithms
};
// auto disable parameters
struct dxAutoDisable {
dReal linear_threshold; // linear (squared) velocity treshold
dReal angular_threshold; // angular (squared) velocity treshold
dReal idle_time; // time the body needs to be idle to auto-disable it
int idle_steps; // steps the body needs to be idle to auto-disable it
};
// quick-step parameters
struct dxQuickStepParameters {
int num_iterations; // number of SOR iterations to perform
dReal w; // the SOR over-relaxation parameter
};
// contact generation parameters
struct dxContactParameters {
dReal max_vel; // maximum correcting velocity
dReal min_depth; // thickness of 'surface layer'
};
struct dxBody : public dObject {
dxJointNode *firstjoint; // list of attached joints
int flags; // some dxBodyFlagXXX flags
dGeomID geom; // first collision geom associated with body
dMass mass; // mass parameters about POR
dMatrix3 invI; // inverse of mass.I
dReal invMass; // 1 / mass.mass
dVector3 pos; // position of POR (point of reference)
dQuaternion q; // orientation quaternion
dMatrix3 R; // rotation matrix, always corresponds to q
dVector3 lvel,avel; // linear and angular velocity of POR
dVector3 facc,tacc; // force and torque accumulators
dVector3 finite_rot_axis; // finite rotation axis, unit length or 0=none
// auto-disable information
dxAutoDisable adis; // auto-disable parameters
dReal adis_timeleft; // time left to be idle
int adis_stepsleft; // steps left to be idle
};
struct dxWorld : public dBase {
dxBody *firstbody; // body linked list
dxJoint *firstjoint; // joint linked list
int nb,nj; // number of bodies and joints in lists
dVector3 gravity; // gravity vector (m/s/s)
dReal global_erp; // global error reduction parameter
dReal global_cfm; // global costraint force mixing parameter
dxAutoDisable adis; // auto-disable parameters
int adis_flag; // auto-disable flag for new bodies
dxQuickStepParameters qs;
dxContactParameters contactp;
};
#endif

View File

@ -1,130 +0,0 @@
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <ode/common.h>
#include <ode/error.h>
#include <ode/memory.h>
#include "obstack.h"
//****************************************************************************
// macros and constants
#define ROUND_UP_OFFSET_TO_EFFICIENT_SIZE(arena,ofs) \
ofs = (size_t) (dEFFICIENT_SIZE( ((intP)(arena)) + ofs ) - ((intP)(arena)) );
#define MAX_ALLOC_SIZE \
((size_t)(dOBSTACK_ARENA_SIZE - sizeof (Arena) - EFFICIENT_ALIGNMENT + 1))
//****************************************************************************
// dObStack
dObStack::dObStack()
{
first = 0;
last = 0;
current_arena = 0;
current_ofs = 0;
}
dObStack::~dObStack()
{
// free all arenas
Arena *a,*nexta;
a = first;
while (a) {
nexta = a->next;
dFree (a,dOBSTACK_ARENA_SIZE);
a = nexta;
}
}
void *dObStack::alloc (int num_bytes)
{
if ((size_t)num_bytes > MAX_ALLOC_SIZE) dDebug (0,"num_bytes too large");
// allocate or move to a new arena if necessary
if (!first) {
// allocate the first arena if necessary
first = last = (Arena *) dAlloc (dOBSTACK_ARENA_SIZE);
first->next = 0;
first->used = sizeof (Arena);
ROUND_UP_OFFSET_TO_EFFICIENT_SIZE (first,first->used);
}
else {
// we already have one or more arenas, see if a new arena must be used
if ((last->used + num_bytes) > dOBSTACK_ARENA_SIZE) {
if (!last->next) {
last->next = (Arena *) dAlloc (dOBSTACK_ARENA_SIZE);
last->next->next = 0;
}
last = last->next;
last->used = sizeof (Arena);
ROUND_UP_OFFSET_TO_EFFICIENT_SIZE (last,last->used);
}
}
// allocate an area in the arena
char *c = ((char*) last) + last->used;
last->used += num_bytes;
ROUND_UP_OFFSET_TO_EFFICIENT_SIZE (last,last->used);
return c;
}
void dObStack::freeAll()
{
last = first;
if (first) {
first->used = sizeof(Arena);
ROUND_UP_OFFSET_TO_EFFICIENT_SIZE (first,first->used);
}
}
void *dObStack::rewind()
{
current_arena = first;
current_ofs = sizeof (Arena);
if (current_arena) {
ROUND_UP_OFFSET_TO_EFFICIENT_SIZE (current_arena,current_ofs)
return ((char*) current_arena) + current_ofs;
}
else return 0;
}
void *dObStack::next (int num_bytes)
{
// this functions like alloc, except that no new storage is ever allocated
if (!current_arena) return 0;
current_ofs += num_bytes;
ROUND_UP_OFFSET_TO_EFFICIENT_SIZE (current_arena,current_ofs);
if (current_ofs >= current_arena->used) {
current_arena = current_arena->next;
if (!current_arena) return 0;
current_ofs = sizeof (Arena);
ROUND_UP_OFFSET_TO_EFFICIENT_SIZE (current_arena,current_ofs);
}
return ((char*) current_arena) + current_ofs;
}

Some files were not shown because too many files have changed in this diff Show More