[RhinoCommon] Test for ellipsoid

(Menno Deij - van Rijswijk) #1

I’m trying to think of a method how to identify if a certain surface is an ellipsoid. I only find a test to identify a sphere.
Complication: the ellipsoid does not need to have its axes aligned with the world axes.

Does anyone have a suggestion on how to do this?

(Willem Derks) #2

Hi Menno,

Shooting from the hip:

1: find singularities ( at surface domain extremes ) and construct axis-line inbetween
2: section with plane perpendicular at mid-point axis-line
3: test if section is circular (enough), sample additional points on axis-line and test perpendicular sections for circularity

any of these tests in addition:

  • get the edge (or intersections with planes through axis-line) , and scale 1D along to section line to test for circularity
  • compare theorectical ellipsiod volume with surface volume(area)

All of this assumes an ellipsiod spanning at least from singularity to singularity yet for trimmed parts I have nothing shoot.


(Giulio Piacentino) #3

I have no proof, but this is a direction I’d look into:

  • find the bounding box
  • get the 3 planes parallel to world X, Y, and Z that pass at the middle of the box
  • intersect those with the surface with some tolerance
  • (if surface is an ellipsoid): all three intersections are:
    • singular curves
    • they pass the Curve.IsEllipse(tolerance) test

Sorry I have no proof and I did not test this either :slight_smile:

(Brian Gillespie) #4

RH-36085 is fixed in the latest WIP

(Menno Deij - van Rijswijk) #5

No public acces to the issue. @brian can you fix this?


Hi Menno,

If the isocurves do not correspondent with the triaxial deformation then you need to find the minimum boundingbox and create the section curves based on that box (see attached ). Ellipsoid.3dm (131.4 KB)

I also don’t know what the bug-fix is about but I found that the IsEllipse check is pretty tolerant. However, once you have the minimum bounding box you can scale the sections to be quadratic and check if these are circles.

The tricky part is to find the minimum boundingbox. I made something for that
but it is not ready to be released.


(Giulio Piacentino) #7

I made the item public. There was a bug in the way RhinoCommon was passing the IsEllipse() test to the C++ SDK. It resulted in false negative results in the test. This is fixed in Rhino WIP.