Changes

Jump to: navigation, search

DPS905 Hic Sunt Dracones

1,378 bytes added, 11:30, 11 December 2010
Class Diagram
==== Class Diagram ====
[[Image:HSD_ClassDiagram.png|700px| ]]
 
====Collision Detection====
For collision detection, we used axis-aligned bounding boxes (AABB). These build an imaginary box around a visible object, as defined by:
 
* minx
* miny
* minz
* maxx
* maxy
* maxz
 
These specify the minimum and maximum bounds of the bounding box in world space. From these, collisions (or general overlap) may be determined via the [http://en.wikipedia.org/wiki/Separating_axis_theorem separating axis theorem]. This theorem can be applied to three-space using the name separating plane theorem and states that "if two convex objects are not penetrating, there exists an axis for which the projection of the objects will not overlap." In implementation, this can be done as such:
 
<pre>
typedef struct Rect3D {
float minx;
float miny;
float minz;
float maxx;
float maxy;
float maxz;
};
 
// AABB Collision Detection in C
int doesOverlap(Rect3D a, Rect3D b) {
return !( a.minx > b.maxx || a.maxx < b.minx
|| a.maxy < b.miny || a.miny > b.maxy
|| a.maxz < b.minz || a.minz > b.maxz );
}
</pre>
 
Note that AABB vs. AABB collision is one of a vast number of cases. For a more comprehensive listing, see [http://www.realtimerendering.com/intersections.html Real Time Rendering]. Also, for performance increase one may wish to investigate [http://en.wikipedia.org/wiki/Space_partitioning spatial partitioning].
=== Screenshots ===

Navigation menu