Dynamic Linear Octree
Objective:
The goal of this project was to implement a dynamic Linear Octree data structure for handling particle collisions in a 3D simulation environment. The particles, modeled as spheres, are attracted to the center of a segment and can collide with each other. The primary focus was on efficient spatial partitioning and collision detection.
Technologies Used:
Programming Language: C++
Tools: Custom bitwise operations, custom memory management
Role and Contributions:
Implemented Linear Octree: Developed a Linear Octree to manage dynamic objects in a 3D space. Ensured that objects are only present in a single node at any time.
Bitwise Operations: Created custom bitwise operations to handle locational codes for the octree nodes, without using external libraries like
std::bitset
.Collision Detection: Added narrow-phase collision detection to resolve sphere collisions.
User Interactions: Enabled users to change the root size of the octree dynamically, select and move objects through the octree, and visualize AABB (Axis-Aligned Bounding Box) queries interactively.
Debugging and Visualization: Implemented debug drawing features to visualize octree nodes at different levels and highlight objects within those nodes.
Challenges and Solutions:
Memory Management: Ensured there were no memory leaks by carefully managing dynamic memory allocations and deallocations.
Efficiency in Traversal: Implemented a top-down approach for generating all object pairs for collision detection. Avoided recursion to improve performance and manage stack memory usage.
Bitwise Manipulation: Developed helper functions for common bitwise operations to keep the code organized and maintainable.
Outcome: The project successfully demonstrated a dynamic Linear Octree for handling real-time particle collisions. Users could interact with the simulation, adjust octree parameters, and visualize the spatial partitioning and collision detection processes. The implementation met the assignment's requirements and performed efficiently without memory leaks.