bc... []

Box.cs ( File view )

  • By maninwest 2015-02-10
  • View(s):24
  • Download(s):0
  • Point(s): 1
			using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Media3D;
using System.Windows.Media;

namespace Bornander.Wpf.Meshes
{

    public class Box
    {

        [Flags]
        public enum Side : short
        {

            Front = 1,
            Right = 2,
            Back = 4,
            Left = 8,
            Bottom = 16,
            Top = 32
        
}

        public static MeshGeometry3D CreateBoxMesh(double width, double height, double depth)
        {

            return CreateBoxMesh(width, height, depth, Side.Front | Side.Back | Side.Left | Side.Right | Side.Bottom | Side.Top);
        
}

        public static MeshGeometry3D CreateBoxMesh(double width, double height, double depth, Side sides)
        {

            MeshGeometry3D mesh = new MeshGeometry3D();

            if ((sides & Side.Front) == Side.Front)
            {

                Plane.AddPlaneToMesh(
                    mesh,
                    new Vector3D(0, 0, 1),
                    new Point3D(-0.5 * width, 0.5 * height, 0.5 * depth),
                    new Point3D(-0.5 * width, -0.5 * height, 0.5 * depth),
                    new Point3D(0.5 * width, -0.5 * height, 0.5 * depth),
                    new Point3D(0.5 * width, 0.5 * height, 0.5 * depth));
            
}

            if ((sides & Side.Right) == Side.Right)
            {

                Plane.AddPlaneToMesh(
                    mesh,
                    new Vector3D(1, 0, 0),
                    new Point3D(0.5 * width, 0.5 * height, 0.5 * depth),
                    new Point3D(0.5 * width, -0.5 * height, 0.5 * depth),
                    new Point3D(0.5 * width, -0.5 * height, -0.5 * depth),
                    new Point3D(0.5 * width, 0.5 * height, -0.5 * depth));
            
}

            if ((sides & Side.Back) == Side.Back)
            {

                Plane.AddPlaneToMesh(
                    mesh,
                    new Vector3D(0, 0, -1),
                    new Point3D(0.5 * width, 0.5 * height, -0.5 * depth),
                    new Point3D(0.5 * width, -0.5 * height, -0.5 * depth),
                    new Point3D(-0.5 * width, -0.5 * height, -0.5 * depth),
                    new Point3D(-0.5 * width, 0.5 * height, -0.5 * depth));
            
}

            if ((sides & Side.Left) == Side.Left)
            {

                Plane.AddPlaneToMesh(
                    mesh,
                    new Vector3D(-1, 0, 0),
                    new Point3D(-0.5 * width, 0.5 * height, -0.5
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
Bornander.UI.TabCarousel.sln1.97 kB2009-12-26|13:54
01.96 kB
App.xaml313.00 B2009-12-26|13:42
App.xaml.cs331.00 B2009-12-26|13:38
Bornander.UI.TabCarousel.Test.csproj4.69 kB2010-01-01|20:45
Bornander.UI.TabCarousel.Test.csproj.user74.00 B2009-12-26|13:45
01.96 kB
LoginPanel.xaml1.98 kB2010-01-01|20:45
LoginPanel.xaml.cs200.00 B2010-01-01|20:45
MainWindow.xaml3.03 kB2010-01-01|21:24
MainWindow.xaml.cs2.98 kB2010-01-01|21:25
01.96 kB
AssemblyInfo.cs2.27 kB2009-12-26|13:38
Resources.Designer.cs2.82 kB2009-12-26|13:38
Resources.resx5.48 kB2009-12-26|13:38
Settings.Designer.cs1.09 kB2009-12-26|13:38
Settings.settings201.00 B2009-12-26|13:38
01.96 kB
Bornander.UI.TabCarousel.csproj3.46 kB2009-12-26|15:04
Carousel.xaml1.03 kB2009-12-28|19:39
Carousel.xaml.cs11.61 kB2009-12-28|20:57
01.96 kB
AssemblyInfo.cs1.43 kB2009-12-26|13:45
Tab.cs2.77 kB2009-12-28|20:34
01.96 kB
Bornander.Wpf.Meshes.csproj2.85 kB2009-12-26|14:15
Box.cs3.81 kB2009-12-26|14:47
Plane.cs1.65 kB2009-12-26|14:49
01.96 kB
AssemblyInfo.cs1.42 kB2009-12-26|13:51
...

Box.cs (22.50 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D