Ejemplo n.º 1
0
        /// <summary>   Gets the bottom. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Bottom()
        {
            ObjectRectangle r = new ObjectRectangle(new Point3D(origin.X + width, origin.Y - height, origin.Z),
                                                    -width, 0, depth);

            return(r);
        }
Ejemplo n.º 2
0
        /// <summary>   Gets the right. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Right()
        {
            ObjectRectangle r = new ObjectRectangle(new Point3D(origin.X + width, origin.Y, origin.Z),
                                                    0, height, depth);

            return(r);
        }
Ejemplo n.º 3
0
        /// <summary>   Gets the left. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Left()
        {
            ObjectRectangle r = new ObjectRectangle(new Point3D(origin.X, origin.Y, origin.Z + depth),
                                                    0, height, -depth);

            return(r);
        }
Ejemplo n.º 4
0
        /// <summary>   Adds a cube to mesh. </summary>
        ///
        /// <param name="p0">           The p 0. </param>
        /// <param name="w">            The width. </param>
        /// <param name="h">            The height. </param>
        /// <param name="d">            The double to process. </param>
        /// <param name="mesh">         The mesh. </param>
        /// <param name="useTexture">   true to use texture. </param>
        public static void addCubeToMesh(Point3D p0, double w, double h, double d,
                                         MeshGeometry3D mesh, bool useTexture)
        {
            ObjectCube cube = new ObjectCube(p0, w, h, d);

            double maxDimension = Math.Max(d, Math.Max(w, h));

            PointCollection textureCoordinatesCollection = new PointCollection();

            ObjectRectangle front  = cube.Front();
            ObjectRectangle back   = cube.Back();
            ObjectRectangle right  = cube.Right();
            ObjectRectangle left   = cube.Left();
            ObjectRectangle top    = cube.Top();
            ObjectRectangle bottom = cube.Bottom();

            if (useTexture)
            {
                Point3D extents = front.getDimensions();

                addTextureCoordinates(textureCoordinatesCollection, extents.X / maxDimension,
                                      extents.Y / maxDimension);
                extents = back.getDimensions();
                addTextureCoordinates(textureCoordinatesCollection, extents.X / maxDimension,
                                      extents.Y / maxDimension);
                extents = right.getDimensions();
                addTextureCoordinates(textureCoordinatesCollection, extents.X / maxDimension,
                                      extents.Y / maxDimension);
                extents = left.getDimensions();
                addTextureCoordinates(textureCoordinatesCollection, extents.X / maxDimension,
                                      extents.Y / maxDimension);
                extents = top.getDimensions();
                addTextureCoordinates(textureCoordinatesCollection, extents.X / maxDimension,
                                      extents.Y / maxDimension);
                extents = bottom.getDimensions();
                addTextureCoordinates(textureCoordinatesCollection, extents.X / maxDimension,
                                      extents.Y / maxDimension);
            }

            front.addToMesh(mesh);
            back.addToMesh(mesh);
            right.addToMesh(mesh);
            left.addToMesh(mesh);
            top.addToMesh(mesh);
            bottom.addToMesh(mesh);

            if (useTexture)
            {
                mesh.TextureCoordinates = textureCoordinatesCollection;
            }
        }
Ejemplo n.º 5
0
        /// <summary>   Gets the back. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Back()
        {
            ObjectRectangle r = new ObjectRectangle(new Point3D(origin.X + width, origin.Y, origin.Z + depth), -width, height, 0);

            return(r);
        }
Ejemplo n.º 6
0
        /// <summary>   Gets the front. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Front()
        {
            ObjectRectangle r = new ObjectRectangle(origin, width, height, 0);

            return(r);
        }
Ejemplo n.º 7
0
        /// <summary>   Gets the top. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Top()
        {
            ObjectRectangle r = new ObjectRectangle(origin, width, 0, depth);

            return(r);
        }
Ejemplo n.º 8
0
        /// <summary>   Gets the back. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Back()
        {
            ObjectRectangle r = new ObjectRectangle(new Point3D(origin.X + width, origin.Y, origin.Z + depth), -width, height, 0);

            return r;
        }
Ejemplo n.º 9
0
        /// <summary>   Gets the front. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Front()
        {
            ObjectRectangle r = new ObjectRectangle(origin, width, height, 0);

            return r;
        }
Ejemplo n.º 10
0
        /// <summary>   Gets the bottom. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Bottom()
        {
            ObjectRectangle r = new ObjectRectangle(new Point3D(origin.X + width, origin.Y - height, origin.Z), 
                -width, 0, depth);

            return r;
        }
Ejemplo n.º 11
0
        /// <summary>   Gets the top. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Top()
        {
            ObjectRectangle r = new ObjectRectangle(origin, width, 0, depth);

            return r;
        }
Ejemplo n.º 12
0
        /// <summary>   Gets the right. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Right()
        {
            ObjectRectangle r = new ObjectRectangle(new Point3D(origin.X + width, origin.Y, origin.Z),
                0, height, depth);

            return r;
        }
Ejemplo n.º 13
0
        /// <summary>   Gets the left. </summary>
        ///
        /// <returns>   An ObjectRectangle. </returns>
        public ObjectRectangle Left()
        {
            ObjectRectangle r = new ObjectRectangle(new Point3D(origin.X, origin.Y, origin.Z + depth), 
                0, height, -depth);

            return r;
        }