+1

AddExtrudedGeometry problem

MCv 11 months ago in Question 0

Hi Everyone,

I'm trying to create a simple 3d object, extruded one out of 4 pairs of 2D coordinates. But what I'm getting - is a 2d object. I can't understand: it's a my mistake or something else is wrong?


Here is my xaml code:

<Grid>
        <helix:HelixViewport3D x:Name="view1" Background="LightBlue" IsHeadLightEnabled="True" >

            <helix:MeshGeometryVisual3D  MeshGeometry="{Binding GlassGeometry}" Fill="White"/>
        </helix:HelixViewport3D>
    </Grid>


And code behind method:

  public MeshGeometry3D GlassGeometry
        {
            get
            {
                var builder = new MeshBuilder(true, true);                 List<Point> pints2D = new List<Point>()
                {
                    new Point(-1, -1),
                    new Point(0, -1),
                    new Point(1, 1),
                    new Point(-1, 1)
                };
                Point3D sp = new Point3D(0, 0, 0);
                Point3D ep = new Point3D(0, 0, 1);

               builder.AddExtrudedGeometry(pints2D, new Vector3D(1,0, 0), sp, ep);

                return builder.ToMesh(true);
            }

What I'm expecting to see is just a cube(in this case). But in the future I would like to get something like this:



But now my result looks like:

Or is it a possibility to create a 3d Object in code using 8 pairs of 3D coordinates?

Thank you in advance.

WPF