0

Programmatic model transform not working

Michael Powell 9 years ago updated 9 years ago 1
I know that Xaml transforms are working, quite well as a matter of fact. I can ScaleTransform3D about axes to achieve simple mirroring, and it works very well. Such as this, mirrors left/right about the Y plane.
<h:RectangleVisual3D>
    <h:RectangleVisual3D.Transform>
        <ScaleTransform3D ScaleY="-1" />
    </h:RectangleVisual3D.Transform>
</h:RectangleVisual3D>
However, I am trying something similar via code behind, and it doesn't seem to be working quite as well; okay, not at all:
return new RectangleVisual3D
{
    Origin = new Point3D {X = 10d},
    LengthDirection = new Vector3D {X = 1d},
    Normal = new Vector3D {Z = 1d},
    Transform = new Transform3DGroup
    {
        Children = {new ScaleTransform3D(new Vector3D {X = -1d}),}
    }
};
My first guess is that perhaps there is some Xaml / Binding magic that is going on behind the scenes. First and a half guess, possibly something about initializing the Transform.Children is causing some problems.

I have also tried initializing RectangleVisual3D.Transform to a new ScaleTransform3D, at first; but then thought that perhaps it needed to be a Transform3DGroup instead, as per some of the example code I've seen listed.

Any other insights would be welcome, however.

Thank you...
Indeed, it did what I told it to do along vector "1,0,0". If I just initialize ScaleX to -1, all is well. Thank you...