# k-dop visualization

This topic is 3658 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi I was looking for a solution for visualizing k-dop bounding volumes and came across the thread http://www.gamedev.net/community/forums/topic.asp?topic_id=477374. It's been closed and I have since made a working k-dop visualization and thought I would add it to the kb. 1) The first section is correct though I found it easier to use an explicit representation for calculating the intersection of three planes (see http://mathworld.wolfram.com/Plane-PlaneIntersection.html) 2) There is a bug here. You should test if the scalar projection of the point along the plane normal is greater-than NOT less-than the dop-projection. Also be sure to use absolute lengths in case you have negative distances for your bounding volume. (ie bvMin = -1, bvMax = +1) 3) As for finding an ordering of the points on each plane for drawing purposes, I kept track of which points were attached to which planes like the poster did. I then transform the 3d plane into a 2d plane. I take the closest point to plane and pick any point on the plane and set that to one axis. Then cross the normal with that vector to get the other. Build a transformation matrix with these axes and also calculate it's inverse for later. Then I run a Graham scan convex hull algorithm on these points to get the ordering. (Since all points are on the hull you really only need to do the initialization steps of a Graham scan - that is pick an extreme point and order the points in some polar direction). Once you have the ordering use the inverse transform to get the points in the original coordinate system. Draw however you want. Hope that helps somebody down the road. S

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 12
• 10
• 11
• 13
• ### Forum Statistics

• Total Topics
634094
• Total Posts
3015476
×