taking care of transforms with GetContourSegments and multiple models?

Apr 10, 2013 at 11:12 PM
I'm trying to us GetContourSegments as shown in the Contour example but it doesn't seem to apply post transform. I've examined the code and it appears Visual3DHelper.Traverse<GeometryModel3D>(model1, this.AddContours); should take care of transforms?

I put out the example below and it gives the contours for the original sphere and not the end resulting scaled sphere.

Also is there a way to compute contours of a model group or is the only way computing contours of each object then joining them together?

Thanks.

Code:
        //add a sphere to the model
        MeshBuilder myMeshBuilder = new MeshBuilder();
        myMeshBuilder.AddSphere(new Point3D(0, 0, 0), 2);

        GeometryModel3D mySphere = new GeometryModel3D { Geometry = myMeshBuilder.ToMesh(true), Material = MaterialHelper.CreateMaterial(Colors.Pink), BackMaterial = MaterialHelper.CreateMaterial(Colors.Blue) };

        ScaleTransform3D scaletrans = new ScaleTransform3D(2, 2, 2);
        mySphere.Transform = scaletrans;

        ModelVisual3D myMod3d = new ModelVisual3D();
        myMod3d.Content = mySphere;

        view1.Children.Add(myMod3d);
        AddContours(myMod3d, 20, 20, 20);
//end result is the contoured original sphere and not the scaled up version
Coordinator
Apr 15, 2013 at 11:45 AM
I would like to keep the GetContourSegments function as it is - working on a single MeshGeometry3D and not transforming the positions.
To support the transforms I think you should inverse(?) transform the position and normal of the contour plane! I think this is the best choice for performance...