Build Ellipsoid from Mesh

Started by
1 comment, last by Muhammad Haggag 18 years, 11 months ago
can someone gave me an idea or perhaps code on how to build a bounding ellipsoid from a dx mesh?
Advertisement
anyone?
Lock the mesh, retrieving a pointer to the vertices.

max_x = max_y = max_z = LARGEST_NEGATIVE_NUMBER_IN_MY_WORLDmin_x = min_y = min_z = LARGEST_POSITIVE_NUMBER_IN_MY_WORLDfor each vertex in vertices    if x < min_x        min_x = x    else if x > max_x        max_x = x    if y < min_y        min_y = y    else if y > max_y        max_y = y    if z < min_z        min_z = z    else if z > max_z        max_z = zradius_x = (max_x - min_x)/2.0radius_y = (max_y - min_y)/2.0radius_z = (max_z - min_z)/2.0

This topic is closed to new replies.

Advertisement