Marking foci fails for ellipse created by intersection plane/cone

I am trying to mark the foci of an ellipse created by intersecting a plane and a cone. It fails when I do this. Is this a bug? It feels like a bug. It works correctly when I intersect a plane with a cylinder. I am running the latest Wenatchee for MAC. thanks, david

Thanks for the report. The question I see is whether the intersection curve between a cone and a plane should be seen as an elliptic curve. Currently it’s not as shown when you run the What command on the resulting curve. I filed http://mcneel.myjetbrains.com/youtrack/issue/RH-29333 for our developers to look into it.

In the meantime, you can draw an Ellipse using the diameter option and then choose Quad Osnaps on the intersection curve you already have around the cone to draw the major and then minor axis. You can then use MarkFoci on this ellipse but make sure to delete the original intersection curve to avoid confusion.

I can see why you might think it is a bug.
While intersecting a plane and a cone does make an ellipse by mathematical definition, that isn’t what Rhino is doing here. In Rhino, the surface/surface intersector is run between the two surfaces and a curve is fit within tolerance.
If you look at the details of this NURBS curve created by intersection and an ellipse created with the ellipse command, you’ll see they have very different structure.
The one you made by intersection is an approximation within stated tolerance.

The fundamental underpinnings are that Rhino is a NURBS modeler. This means that a curve is a curve is a curve. There is no deep difference between lines, circles, ellipses, or wiggly curves. They are all defined in NURBS terms.

Here’s a link to more geeky detail:
http://www.rhino3d.com/nurbs

I agree @John_Brock but the resulting curve intersection from the plane/cylinder in my file on the bug has similar details but still works with MarkFoci. I think Mikko will have to take a look to see if that is a special case we account for when intersecting and if the same logic can be applied to the cone/plane example.

A circle made with the deformable option has no center according to Osnap unless you crank up the number of points.

Thanks for the replies. So what does it take for Rhino to recognize a specific curve as an ellipse? Is it the particular layout of the control points? Or is there some other meta data embedded into a curve created with the Ellipse cmd? Why does MarkFoci work with a cylinder/plane intersection, but not with a cone/plane intersection? Thanks and Happy X-mas!

i don’t know why it fails exactly but the point structure of a cone/plane intersection is pretty dense so maybe markFoci gets confused(?) at some point…

if you use _Ellipse-> Diameter and draw a new ellipse over the intersecting one, the control points are much simpler and markFoci will work on it (use the Quadrant oSnap to make it real easy to redraw the ellipse)… and the new ellipse seems ‘right’ as you can use it to Trim the cone etc.

In my Windows Rhino over here, MarkFoci is working on an intersection of a cone and plane if it produces either a parabola or hyperbola… but not an ellipse.

What was interesting though was when I tried SimplifyCrv on any of the intersection curves to see if I could force an ellipse or something else, it broke the curve up into a polycurve with 4-8 segments… Hmmm…

–Mitch

@BrianJ @John_Brock Honestly this sounds like a bug to me. I understand all the issues regarding tolerances, curve structure, etc, but I do believe that the MarkFoci cmd ought to be intelligent enough to recognize this curve as an ellipse, even though it wasn’t created with the native Ellipse cmd. Obviously the curve we have created using the cone/plane intersection fits within standard definitions and tolerances of what an ellipse actually is. The MarkFoci cmd seems to be limited in its scope. Btw, I would still love to know what is going on internally when you run the MarkFoci cmd - What is it looking for? Is it looking for a specific curvature reading, or is it looking for a specific control point structure? thanks! d

Try the below PythonScript

# Script for mark Ellipse foci
#write by ing. Vittorio Carlotto 24-12-2014  vittoriocarlotto@gmail.com
import rhinoscriptsyntax as rs
def fuochiEllisse():       
    
    oldplane=rs.ViewCPlane() # CPlane attuale
    currentview=rs.CurrentView()  # vista corrente
    strObject = rs.GetObject("Select a curve") 
    if strObject==None:return
    rs.EnableRedraw(False)
    if rs.IsCurve(strObject) :        
        arrpc=rs.CurveAreaCentroid(strObject)
        pc=arrpc[0]         # centro ellisse        
        param=rs.CurveClosestPoint(strObject,pc)
        pcl=rs.EvaluateCurve(strObject,param)
        result=rs.CurveSeam(strObject,param)
        if result==True:            
            arrPoints=rs.DivideCurve(strObject,4)               
        if arrPoints :        
               pb=arrPoints[0]  # punto sul quadrante X
               pa=arrPoints[3]  # punto sul quadrante opposto               
               arrplane=rs.PlaneFromPoints(pc,pa,pb)
               rs.ViewCPlane(currentview,arrplane)    # metto il CPlane sull'ellisse                
               distA=rs.Distance(pc,pa)  # semiasse X               
               distB=rs.Distance(pc,pb)  #semiasse   Y              
             
        la=rs.AddLine (pc,pa)   # line semiasse X     
        lb=rs.AddLine (pc,pb)    #line semiasse Y
        lac=rs.CopyObject(la,pb-pc)  # per copiare uso il vettore di traslazione        
        idcir=rs.AddCircle(arrplane,distA)        
        lint=rs.CurveCurveIntersection(lac,idcir)
        pInt=lint[0][1]        
        rs.UnselectAllObjects()
        lbc=rs.CopyObject (lb,pInt-pb)        
        pfuoco=rs.CurveStartPoint(lbc)
        idFuoco=rs.AddPoint (pfuoco)        
        rs.MirrorObject (idFuoco, pc, pb, True )
        rs.DeleteObjects((la,lbc,lb,lac))        
        rs.DeleteObject(idcir)        
        rs.ViewCPlane(currentview,oldplane)
        rs.EnableRedraw(True)
fuochiEllisse()

Ciao Vittorio

Hi again
A change was just checked into the V6 code stream that relaxes the tolerances so an ellipse created by intersecting a plane and a cone, will be work.

Thanks

3 Likes

Whoa that’s friggin awesome - thanks John! :thumbsup:

This bug was reported years ago and still exist in v5 SR11, too. The last version that did it right was Rhino v2. I think after rewriting the Rhino codes from scratch in v3 a lot has changed in calculating intersections.