game4tress 0 Newbie Poster

I've made a rectangle with another 3D point inside. The rectangle is textured with an image. Now, I need to move the point that is inside the rectangle to another 3D position. Does anyone knows how this is possible?
The only way I found, that is no good for what I need to achieve was to create another function similar to the one I post here, clear the viewport and redefine the point. This doesn't work in my case because I want the texture to follow the point that was already defined when the texture was set, meaning that the point has to be moved, not created again.
Can you please help?
My thanks in advanced.

Here is my code:

        private void Draw2()
        {


            //Points
            Point3D point0 = new Point3D(0, 0, 0);
            Point3D point1 = new Point3D(2, 0, 0);
            Point3D point4 = new Point3D(1, 0, -1);
            Point3D point2 = new Point3D(2, 0, -4);
            Point3D point3 = new Point3D(0, 0, -4);

            //triangleMesh
            triangleMesh.Positions.Add(point0);

            triangleMesh.Positions.Add(point1);
            triangleMesh.Positions.Add(point4);

            triangleMesh.Positions.Add(point2);
            triangleMesh.Positions.Add(point3);






            triangleMesh.TriangleIndices.Add(0);
            triangleMesh.TriangleIndices.Add(1);
            triangleMesh.TriangleIndices.Add(2);

            triangleMesh.TriangleIndices.Add(2);
            triangleMesh.TriangleIndices.Add(1);
            triangleMesh.TriangleIndices.Add(3);

            triangleMesh.TriangleIndices.Add(2);
            triangleMesh.TriangleIndices.Add(3);
            triangleMesh.TriangleIndices.Add(4);

            triangleMesh.TriangleIndices.Add(2);
            triangleMesh.TriangleIndices.Add(4);
            triangleMesh.TriangleIndices.Add(0);



            triangleMesh.TextureCoordinates.Add(new System.Windows.Point(0, 0));
            triangleMesh.TextureCoordinates.Add(new System.Windows.Point(0, 1));
            triangleMesh.TextureCoordinates.Add(new System.Windows.Point(1, 1));
            triangleMesh.TextureCoordinates.Add(new System.Windows.Point(1, 0));





            //define the normal, manually
            Vector3D normal = new Vector3D(0, 1, 0);
            triangleMesh.Normals.Add(normal);

            //Materials

            /*******************************
             * 
             *
             * */


            ImageBrush imgBrush = new ImageBrush();
            //imgBrush.ImageSource = new BitmapImage(new Uri(@"FrontalFace.png", UriKind.Relative));
            imgBrush.ImageSource = new BitmapImage(new Uri(@"temp.jpg", UriKind.Relative));


            imgBrush.Stretch = Stretch.UniformToFill;
            imgBrush.TileMode = TileMode.Tile;

            Material material = new DiffuseMaterial(imgBrush);









            /*******************************
             * 
             *
             * */




            //Create the model
            triangleModel = new GeometryModel3D(triangleMesh, material);

            model.Content = triangleModel;

            //Add the model to the viewport
            this.vpt.Children.Add(model);


        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.