tags:

views:

87

answers:

0

Hi All,

I have a 3D cone (called as "conemodel") produced by a method. This cone will be rotated in C# code and added to XAML Viewport3D group after rotated by an angle.

Code snippet :

public static void CreateTriangleFace(Point3D p0, Point3D p1, Point3D p2,
                                      Color color, Viewport3D viewport3d)
{
       MeshGeometry3D conemesh = new MeshGeometry3D();
        conemesh.Positions.Add(p0);
        conemesh.Positions.Add(p1);
        conemesh.Positions.Add(p2);
        conemesh.TriangleIndices.Add(0);
        conemesh.TriangleIndices.Add(1);
        conemesh.TriangleIndices.Add(2);

        SolidColorBrush brush = new SolidColorBrush();
        brush.Color = color;
        Material material = new DiffuseMaterial(brush);
        GeometryModel3D geometry = new GeometryModel3D(conemesh, material);
        ModelUIElement3D conemodel = new ModelUIElement3D();
        conemodel.Model = geometry;
        viewport3d.Children.Add(conemodel);  //Just here, the cone called as "conemodel" 
                                               will be rotated by 90 deg on the X axes .
                                               and then it will be added to viewport3d group
}

Could you help me to solve.

Regards

Brad