MorphControl - Flowing Curves YZ has a different behavior


#1

Hello,

I’ve realized that MorphControl with a target curve laid in plane YZ has a strange behavior, here the images:

Here the code to reproduce it:

 protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
        ObjRef[] curvesToFlow;
        ObjRef objRefSourceCrv, objRefTargetCrv;

        //Get Curves
        if (RhinoGet.GetOneObject("Source curve", false, ObjectType.Curve, out objRefSourceCrv) != Result.Success) return Result.Failure;
        RhinoDoc.ActiveDoc.Objects.UnselectAll();
        if (RhinoGet.GetOneObject("Target curve", false, ObjectType.Curve, out objRefTargetCrv) != Result.Success) return Result.Failure;
        RhinoDoc.ActiveDoc.Objects.UnselectAll();
        if (RhinoGet.GetMultipleObjects("Curves To Flow", false, ObjectType.Curve, out curvesToFlow) != Result.Success) return Result.Failure;

        //Flow Curves
        var mc = new MorphControl(objRefSourceCrv.Curve().ToNurbsCurve(), objRefTargetCrv.Curve().ToNurbsCurve()) { PreserveStructure = true };
        var outputCrvs = curvesToFlow.Select(objRef => objRef.Curve()).ToList();
        outputCrvs.ForEach(_ => mc.Morph(_));

        //Add to Doc
        outputCrvs.ForEach(_=>RhinoDoc.ActiveDoc.Objects.AddCurve(_));

        return Result.Success;
    }

Is there a way to avoid that?.
Attached a dummy project and 3dm file

Thanks and best regards
Enric

FlowByCurve.zip (25.3 KB) Flowing Curves.3dm (269.7 KB)


(Dale Fugier) #2

Hi Enric,

Is there a reason you are not using a Flow space morph for this?

var morph = Rhino.Geometry.Morphs.FlowSpaceMorph(...);

– Dale


#3

Hello Dale,

Ther is no special reason, I didn’t realized that there are this two kinds of classes.
What’s exactly the difference between Rhino.Geometry.MorphControl and Rhino.Geometry.Morphs.FlowSpaceMorph

Thank you Dale

Enric