How to create an ellipsoid from two ellipses?

rhino5
unhandled
ellipsoid

#1

I need to create a double-ellipse ellipsoid (ellipses) in two planes. As shown in the picture below, the curve “b” is a perfect circle while the curve “B” is an ellipse. That’s the easy one to create since the ellipsoid can be made using the Revolve command.

But the curves “a” and “A” are both ellipses, so now it gets tricky (the ellipse form of “a” is not so clear in the picture, but it is an ellipse). Q: So how can I make an ellipsoid out of these two curves? (a and A)

Addendum: Although not part of the basic problem of creating the ellipsoid, I can mention that the ellipsoid will be adjusted many times before finding the final shape. I will have to adjust two radiuses for each plane (a1, a2 in the XY plane and A1, A2 in the YZ plane) several times before arriving at the final form (I will iteratively try to fit it against some other objects until I find a “best fit”).

// Rolf


#2

railrevolve? of course i am not sure if i understood you correct, you would also have to see how to solve that in grasshopper, but railrevolve would exactly do that with both closed ellipse curves.


#3

Have you tried making a sphere and then scaling the axes appropriately?
You can use either scale1d twice or non-uniform scale,


#4

Yup, there it was! < Big smile! >

bild

Many thanks!

// Rolf


#5

No, I haven’t tried that, but it for sure sounds interesting since I have to iteratively try out the best fit.

But how do I “scale the axes”? That escapes me.

// Rolf


#6

Hi Rolf,

below seems to generate a valid Ellipsoid:

import Rhino
import scriptcontext
    
def AddEllipsoid(plane, size_x, size_y, size_z):
    '''creates an ellipsoid in a plane'''
    surface = Rhino.Geometry.Sphere(plane, 1.0).ToNurbsSurface()
    xform = Rhino.Geometry.Transform.Scale(plane, size_x, size_y, size_z)
    surface.Transform(xform)
    return surface
    
def RunCommand():
    plane = Rhino.Geometry.Plane.WorldXY
    size_x, size_y, size_z = 13.0, 8.0, 18.0
    ellipsoid = AddEllipsoid(plane, size_x, size_y, size_z)
    if ellipsoid: 
        scriptcontext.doc.Objects.Add(ellipsoid)
        scriptcontext.doc.Views.Redraw()
        
RunCommand()

_
c.


(David Cockey) #7

Regular Rhino has the command Ellipsoid to create ellipses. Is it available for scripting, etc?


#8

Hm, I don’t see four (4) different radiuses there, only three.

But 3/4 is pretty close… :slight_smile:

// Rolf


(David Cockey) #9

By “radius” do you mean the length of the semi-axis, or the radius at the ends of the semi-axis, or something else? For an ellipsoid there are only three independent parameters, though there are a number of different parameter sets which can be used.


#10

Hi Rolf,

Hm, i guess an Ellipsoid does have only 3 radii. :wink:

Does _RailRevolve result in a valid Ellipsoid ? I have not tried that. I’ve compared the above script result with one done with _Ellipsoid command so the seams are identical then used _SelDup and both where identical.

_
c.


#11

There are two different ellipses combined, which means four different radiuses. That may not be a “valid” ellipsoid, but I will need to make that shape anyway (Railrevolve is one way to do it).

Also, unfortunately there is no command Ellispsoid in RhinoCommon or GrassHopper API, but as @clement demonstrated, transform Scale may do the trick.

// Rolf


#12

It seems not, but it makes the 4-radii alien, and that is what I need. :slight_smile:


Edit:
Apparently I’ve stayed up too late at night. Of course there can’t be more than three radiuses in one closed shape. Of course not. So your code @clement will do exactly what I need. I’ll make a C# version of it and off I go.

Many thanks!

// Rolf


#13

If you use non-uniform scale you just enter the scale factors for each axis. It looks like a sphere with radius b would need to be scaled by a factor of about 1.2 for the x axis and around 2 for the z axis and a factor of 1 for the y axis to get your Aab ellipsoid

Clement’s script appears to do the same.


#14

“tri-axial ellipsoid” at least freaky pedia says so no idea if thats valid then…

@RIL before your long night gets even longer and there is not other need for this other than to preview it, maybe just switch history on with both curves before you revolve and off you go, sorry maybe its a lame suggestion but since you are tired maybe you have overseen that either :crazy_face:


#15

Using History would definitely be another option, but since I’m doing this programatically I think @clement’s code snippet is the simplest solution, very suitable for iteratively adjusting X, Y and Z parameters (radiuses).

Good night folks!

// Rolf