2 * OPCODE - Optimized Collision Detection
3 * http://www.codercorner.com/Opcode.htm
5 * Copyright (c) 2001-2008 Pierre Terdiman, pierre@codercorner.com
7 This software is provided 'as-is', without any express or implied warranty.
8 In no event will the authors be held liable for any damages arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it freely,
11 subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
14 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
15 3. This notice may not be removed or altered from any source distribution.
19 OPCODE distribution 1.3 (june 2003)
20 -----------------------
23 - fixed the divide by 0 bug that was happening when all centers where located on a coordinate axis (thanks to Jorrit T)
24 - linearized "complete" vanilla AABB trees
25 - ANSI-compliant "for" loops (for the ones porting it to Linux...)
26 - callbacks & pointers moved to mesh interface
27 - support for triangle & vertex strides
28 - optimized the sphere-triangle overlap code a bit
29 - dynamic trees (refit)
31 - ValidateSubdivision in builders
33 - primitive-bv tests can now be skipped in most volume queries
34 - temporal coherence now also works for airborne objects
35 - temporal coherence completed for boxes / all contacts, LSS, etc
36 - ray-collider now uses a callback
37 - some common "usages" have been introduced (only picking for now)
38 - SPLIT_COMPLETE removed (now implicitely using mLimit = 1)
39 - hybrid collision models
40 - sweep-and-prune code added, moved from my old Z-Collide lib
41 - it now works with meshes made of only 1 triangle (except in mesh-mesh case!)
45 - I forced myself to actually *do* the release today no matter what. Else it would never have been done. That's
46 why the code may not be very polished. I also removed a *lot* of things (more usages, distance queries, etc...)
47 that weren't ready for prime-time (or that were linked to too many of my supporting libs)
49 - Some comments may also be obsolete here and there. The old User Manual for Opcode 1.2 may not fit version 1.3
50 either, since there's a new "mesh interface" to support strides, etc.
52 - Everything in the "Ice" directory has been hacked out of my engine and edited until everything compiled. Don't
53 expect anything out there to be cute or something. In particular, some CPP files are not even included when not
54 needed, so you can expect some linker errors if you try messing around with them...
56 Otherwise, it should be just like previous version, only better. In particular, hybrid models can be very
57 memory-friendly (sometimes using like 10 times less ram than the best trees from version 1.2). The possible
58 speed hit is often invisible (if it even exists), especially using temporal coherence in "all contacts" mode.
59 (Admittedly, this depends on your particular usage pattern / what you do on collided triangles).
61 The sweep-and-prune code is similar to the "vanilla" version found in V-Collide (but that one's better IMHO...)
62 The simple "radix" version is often just as good, see for yourself.
64 OPCODE distribution 1.2 (august 2002)
65 -----------------------
68 - new VolumeCollider base class
69 - simplified callback setup
70 - you can now use callbacks or pointers (setup at compile time)
71 - destination array not needed anymore in the RayCollider (faster in-out tests)
72 - renamed classes: AABBRayCollider => RayCollider, AABBSphereCollider => SphereCollider
73 - the sphere query now only returns a list of faces (extra info discarded). On the other hand it's a lot faster.
74 - OBB, AABB and planes queries. Original OBB and AABB queries contributed by Erwin de Vries.
75 - cosmetic changes in OPC_BoxBoxOverlap.h contributed by Gottfried Chen
76 - some inlining problems fixed
77 - faster ray-mesh tests using the separating axis theorem
78 - new split value in AABB tree construction (contributed by Igor Kravtchenko). Provides faster queries most of the time.
79 - improved temporal coherence for sphere & AABB queries (works in "All contacts" mode)
83 - Everything in the "Ice code" directory (in VC++) is basically copy-pasted from my engine, with a lot
84 of code removed until there was no link error anymore. Don't expect those files to be cute or anything,
85 they've never been meant to be released and they're often updated/modified/messy.
86 - Some experimental features have been removed as well. Else I would never have released the 1.2...
87 - Not as polished/optimal as I would like it to be, but that's life. I promised myself to release it
88 before october 2002 (one YEAR later ?!).... That's the only reason why it's there.
89 - Some people reported ColDet was faster. Uh, come on. They were using Opcode in
90 "All contacts" mode whereas ColDet was doing "first contact"...
92 OPCODE distribution 1.1 (october 2001)
93 -----------------------
98 - abtract base class for colliders
99 - settings validation methods
100 - compilation flags now grouped in OPC_Settings.h
101 - smaller files, new VC++ virtual dirs (cleaner)
105 - "override(baseclass)" is a personal cosmetic thing. It's the same as "virtual", but provides more info.
106 - I code in 1600*1200, so some lines may look a bit long..
107 - This version is not as polished as the previous one due to lack of time. The stabbing & sphere queries
108 can still be optimized: for example by trying other atomic overlap tests. I'm using my first ray-AABB
109 code, but the newer one seems better. Tim Schröder's one is good as well. See: www.codercorner.com/RayAABB.cpp
110 - The trees can easily be compressed even more, I save this for later (lack of time, lack of time!)
111 - I removed various tests before releasing this one:
112 - a separation line, a.k.a. "front" in QuickCD, because gains were unclear
113 - distance queries in a PQP style, because it was way too slow
114 - support for deformable models, too slow as well
115 - You can easily use Opcode to do your player-vs-world collision detection, in a Nettle/Telemachos way.
116 If someone out there wants to donate some art / level for the cause, I'd be glad to release a demo. (current
117 demo uses copyrighted art I'm not allowed to spread)
118 - Sorry for the lack of real docs and/or solid examples. I just don't have enough time.
120 OPCODE distribution 1.0 (march 2001)
121 -----------------------
125 ===============================================================================
129 OPCODE means OPtimized COllision DEtection.
130 So this is a collision detection package similar to RAPID. Here's a
131 quick list of features:
133 - C++ interface, developed for Windows systems using VC++ 6.0
134 - Works on arbitrary meshes (convex or non-convex), even polygon soups
135 - Current implementation uses AABB-trees
136 - Introduces Primitive-BV overlap tests during recursive collision queries (whereas
137 standard libraries only rely on Primitive-Primitive and BV-BV tests)
138 - Introduces no-leaf trees, i.e. collision trees whose leaf nodes have been removed
139 - Supports collision queries on quantized trees (decompressed on-the-fly)
140 - Supports "first contact" or "all contacts" modes (à la RAPID)
141 - Uses temporal coherence for "first contact" mode (~10 to 20 times faster, useful
142 in rigid body simulation during bisection)
143 - Memory footprint is 7.2 times smaller than RAPID's one, which is ideal for console
144 games with limited ram (actually, if you use the unmodified RAPID code using double
145 precision, it's more like 13 times smaller...)
146 - And yet it often runs faster than RAPID (according to RDTSC, sometimes more than 5
147 times faster when objects are deeply overlapping)
148 - Performance is usually close to RAPID's one in close-proximity situations
149 - Stabbing, planes & volume queries (sphere, AABB, OBB, LSS)
151 - Now works with deformable meshes
155 What it can be used for:
156 - standard mesh-mesh collision detection (similar to RAPID, SOLID, QuickCD, PQP, ColDet...)
157 - N-body collisions (similar to V-Collide)
158 - camera-vs-world collisions (similar to Telemachos/Paul Nettle/Stan Melax articles)
159 - shadow feelers to speed up lightmap computations
160 - in-out tests to speed up voxelization processes
162 - rigid body simulation
163 - view frustum culling
168 - Because RAPID uses too many bytes.
169 - Because the idea was nice...
173 It's been coded in march 2001 following a thread on the GD-Algorithms list.
175 GDAlgorithms-list mailing list
176 GDAlgorithms-list@lists.sourceforge.net
177 http://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
184 p.terdiman@wanadoo.fr
185 p.terdiman@codercorner.com
187 http://www.codercorner.com
188 http://www.codercorner.com/Opcode.htm