当前位置: 首页>>代码示例>>C#>>正文


C# Media3D.Model3DGroup类代码示例

本文整理汇总了C#中System.Windows.Media.Media3D.Model3DGroup的典型用法代码示例。如果您正苦于以下问题:C# Model3DGroup类的具体用法?C# Model3DGroup怎么用?C# Model3DGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Model3DGroup类属于System.Windows.Media.Media3D命名空间,在下文中一共展示了Model3DGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        public Model3DGroup Create(Color modelColor,string pictureName, Point3D startPos, double maxHigh)
        {
            try
            {
                Uri inpuri = new Uri(@pictureName, UriKind.Relative);
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.UriSource = inpuri;
                bi.EndInit();
                ImageBrush imagebrush = new ImageBrush(bi);
                imagebrush.Opacity = 100;
                imagebrush.Freeze();

                Point[] ptexture0 = { new Point(0, 0), new Point(0, 1), new Point(1, 0) };
                Point[] ptexture1 = { new Point(1, 0), new Point(0, 1), new Point(1, 1) };

                SolidColorBrush modelbrush = new SolidColorBrush(modelColor);
                Model3DGroup cube = new Model3DGroup();
                Point3D uppercircle = startPos;
                modelbrush.Freeze();
                uppercircle.Y = startPos.Y + maxHigh;
                cube.Children.Add(CreateEllipse2D(modelbrush, uppercircle, _EllipseHigh, new Vector3D(0, 1, 0)));
                cube.Children.Add(CreateEllipse2D(modelbrush, startPos, _EllipseHigh, new Vector3D(0, -1, 0)));
                cube.Children.Add(CreateEllipse3D(imagebrush, startPos, _EllipseHigh, maxHigh, ptexture0));
                return cube;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:kse-jp,项目名称:RM-3000,代码行数:31,代码来源:EllipseModel.cs

示例2: OpacitySortingVisual3D

 public OpacitySortingVisual3D()
 {
     opaqueChildren = new Model3DGroup();
     transparentChildren = new Model3DGroup();
     Children.Add(new ModelVisual3D { Content = opaqueChildren });
     Children.Add(new ModelVisual3D { Content = transparentChildren });
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:OpacitySortingVisual3D.cs

示例3: FlipTransition

        public FlipTransition()
        {
            _viewport = TransitionResources["3DCube"] as Viewport3D;

            _rootModel = (_viewport.Children[0] as ModelVisual3D).Content as Model3DGroup;
            _cubeModelContainer = _rootModel.Children[1] as Model3DGroup;
        }
开发者ID:slytsal,项目名称:nmtmdz,代码行数:7,代码来源:FlipTransition.cs

示例4: floor

        public void floor(double l, double h, double w)
        {
            DiffuseMaterial material1 = new DiffuseMaterial();
            ImageBrush brush = new ImageBrush();
            brush.ImageSource = new BitmapImage(new Uri(@"floor15.jpg", UriKind.Relative));
            brush.Viewport = new Rect(0, 0, 0.1, 0.1);
            brush.TileMode = TileMode.Tile;
            material1.Brush = brush;

            Model3DGroup cube = new Model3DGroup();
            material[0] = material1;
            material[1] = material1;
            material[2] = material1;
            material[3] = material1;
            material[4] = material1;
            material[5] = material1;
            material[6] = material1;
            material[7] = material1;
            material[8] = material1;
            material[9] = material1;
            material[10] = material1;
            material[11] = material1;
            cubegroup(l, h, w,ref cube,  material);
            this.Content = cube;  
        }
开发者ID:uwitec,项目名称:gloryview-rfid,代码行数:25,代码来源:ModelWall.cs

示例5: FlipTile

        public FlipTile(DiffuseMaterial frontMaterial,
            Size size, Point center, Material backMaterial, Rect backTextureCoordinates)
        {
            m_locationDesired = new Point3D(center.X, center.Y, 0);
            m_locationCurrent = new Point3D(0, 0, Util.Rnd.NextDouble() * 10 - 20);
            m_size = size;

            Point3D topLeft = new Point3D(-size.Width / 2, size.Height / 2, 0);
            Point3D topRight = new Point3D(size.Width / 2, size.Height / 2, 0);
            Point3D bottomLeft = new Point3D(-size.Width / 2, -size.Height / 2, 0);
            Point3D bottomRight = new Point3D(size.Width / 2, -size.Height / 2, 0);

            m_frontMaterial = frontMaterial;

            Model3DGroup quad = new Model3DGroup();
            quad.Children.Add(
                CreateTile(
                    frontMaterial,
                    backMaterial,
                    m_borderMaterial,
                    new Size3D(size.Width, size.Height, .01),
                    backTextureCoordinates));

            Transform3DGroup group = new Transform3DGroup();

            group.Children.Add(new RotateTransform3D(m_verticalFlipRotation));
            group.Children.Add(new RotateTransform3D(m_quaternionRotation3D));

            group.Children.Add(m_scaleTransform);
            group.Children.Add(m_translate);

            quad.Transform = group;

            this.Visual3DModel = quad;
        }
开发者ID:hungdluit,项目名称:bot,代码行数:35,代码来源:FlipTile.cs

示例6: dibujaCubo

        public ModelVisual3D dibujaCubo(Point3D[] puntos)
        {
            if (puntos.Length == 8)
            {
                Model3DGroup cube = new Model3DGroup();
                cube.Children.Add(CreateTriangleModel(puntos[3], puntos[2], puntos[6]));
                cube.Children.Add(CreateTriangleModel(puntos[3], puntos[6], puntos[7]));

                cube.Children.Add(CreateTriangleModel(puntos[2], puntos[1], puntos[5]));
                cube.Children.Add(CreateTriangleModel(puntos[2], puntos[5], puntos[6]));

                cube.Children.Add(CreateTriangleModel(puntos[1], puntos[0], puntos[4]));
                cube.Children.Add(CreateTriangleModel(puntos[1], puntos[4], puntos[5]));

                cube.Children.Add(CreateTriangleModel(puntos[0], puntos[3], puntos[7]));
                cube.Children.Add(CreateTriangleModel(puntos[0], puntos[7], puntos[4]));

                cube.Children.Add(CreateTriangleModel(puntos[7], puntos[6], puntos[5]));
                cube.Children.Add(CreateTriangleModel(puntos[7], puntos[5], puntos[4]));

                cube.Children.Add(CreateTriangleModel(puntos[2], puntos[3], puntos[0]));
                cube.Children.Add(CreateTriangleModel(puntos[2], puntos[0], puntos[1]));
                ModelVisual3D modelo = new ModelVisual3D();
                modelo.Content = cube;
                return modelo;
            }
            return null;
        }
开发者ID:AaronRevilla,项目名称:TT_2012b-049_ComputerGraphics,代码行数:28,代码来源:Graficos.cs

示例7: VisualisationWindow

        public VisualisationWindow(Interferometry.math_classes.ZArrayDescriptor array)
        {
            InitializeComponent();

            // prepare points
            Point3D[,] points = new Point3D[array.width, array.height];
            for (int i = 0; i < array.width; ++i)
                for (int j = 0; j < array.height; ++j)
                    points[i, j] = new Point3D(i, array.array[i][j], j);

            // build model
            Model3DGroup surface = new Model3DGroup();
            for (int i = 0; i < array.width - 1; ++i)
            {
                for (int j = 0; j < array.height - 1; ++j)
                {
                    surface.Children.Add(createTriangle(points[i, j], points[i + 1, j], points[i, j + 1]));
                    surface.Children.Add(createTriangle(points[i, j + 1], points[i + 1, j], points[i, j]));

                    surface.Children.Add(createTriangle(points[i, j + 1], points[i + 1, j], points[i + 1, j + 1]));
                    surface.Children.Add(createTriangle(points[i + 1, j + 1], points[i + 1, j], points[i, j + 1]));
                }
                System.Console.WriteLine("buidling on row: " + i + "/" + array.width);
            }
            System.Console.WriteLine("model building done");

            ModelVisual3D model = new ModelVisual3D();
            model.Content = surface;
            this.mainViewport.Children.Add(model);
        }
开发者ID:interferometry7,项目名称:interferometry,代码行数:30,代码来源:VisualisationWindow.xaml.cs

示例8: MainViewModel

        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        public MainViewModel()
        {
            // Create a model group
            var modelGroup = new Model3DGroup();

            // Create a mesh builder and add a box to it
            var meshBuilder = new MeshBuilder(false, false);
            meshBuilder.AddBox(new Point3D(0, 0, 1), 1, 2, 0.5);
            meshBuilder.AddBox(new Rect3D(0, 0, 1.2, 0.5, 1, 0.4));

            // Create a mesh from the builder (and freeze it)
            var mesh = meshBuilder.ToMesh(true);

            // Create some materials
            var greenMaterial = MaterialHelper.CreateMaterial(Colors.Green);
            var redMaterial = MaterialHelper.CreateMaterial(Colors.Red);
            var blueMaterial = MaterialHelper.CreateMaterial(Colors.Blue);
            var insideMaterial = MaterialHelper.CreateMaterial(Colors.Yellow);

            // Add 3 models to the group (using the same mesh, that's why we had to freeze it)
            modelGroup.Children.Add(new GeometryModel3D { Geometry = mesh, Material = greenMaterial, BackMaterial = insideMaterial });
            modelGroup.Children.Add(new GeometryModel3D { Geometry = mesh, Transform = new TranslateTransform3D(-2, 0, 0), Material = redMaterial, BackMaterial = insideMaterial });
            modelGroup.Children.Add(new GeometryModel3D { Geometry = mesh, Transform = new TranslateTransform3D(2, 0, 0), Material = blueMaterial, BackMaterial = insideMaterial });

            // Set the property, which will be bound to the Content property of the ModelVisual3D (see MainWindow.xaml)
            this.Model = modelGroup;
        }
开发者ID:ORRNY66,项目名称:helix-toolkit,代码行数:30,代码来源:MainViewModel.cs

示例9: NodesVisual

        public NodesVisual()
        {
            InitializeComponent();

            // Make IMU model here

            Model3DGroup items = new Model3DGroup();
            GeometryModel3D model = new GeometryModel3D();
            MeshGeometry3D geom = new MeshGeometry3D();
            DiffuseMaterial paint = new DiffuseMaterial(new SolidColorBrush(Colors.Red));

            double xPos, yPos, zPos;

            for(int z = 0; z < 2; z++)
                for (int y = 0; y < 2; y++)
                    for (int x = 0; x < 2; x++)
                    {
                        xPos = x * CUBE_SIZE - CUBE_SIZE / 2;
                        yPos = y * CUBE_SIZE - CUBE_SIZE / 2;
                        zPos = z * CUBE_SIZE - CUBE_SIZE / 2;

                        geom.Positions.Add(new Point3D(xPos, yPos, zPos));
                        Debug.Print("(" + x + "," + y + "," + z + ")");
                    }
            

            // TriangleIndices = "2 3 1  2 1 0  7 1 3  7 5 1  6 5 7  6 4 5  6 2 0  6 0 4  2 7 3  2 6 7  0 1 5  0 5 4" >
            geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(3);    geom.TriangleIndices.Add(1);
            geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(1);    geom.TriangleIndices.Add(0);
            geom.TriangleIndices.Add(7);    geom.TriangleIndices.Add(1);    geom.TriangleIndices.Add(3);

            geom.TriangleIndices.Add(7);    geom.TriangleIndices.Add(5);    geom.TriangleIndices.Add(1);
            geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(5);    geom.TriangleIndices.Add(7);
            geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(4);    geom.TriangleIndices.Add(5);

            geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(0);
            geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(0);    geom.TriangleIndices.Add(4);
            geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(7);    geom.TriangleIndices.Add(3);

            geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(7);
            geom.TriangleIndices.Add(0);    geom.TriangleIndices.Add(1);    geom.TriangleIndices.Add(5);
            geom.TriangleIndices.Add(0);    geom.TriangleIndices.Add(5);    geom.TriangleIndices.Add(4);

            model.Material = paint;
            model.Geometry = geom;
            items.Children.Add(model);

            imu = new ModelVisual3D();
            imu.Content = items;
            viewportIMU.Children.Add(imu);

            combobox_nodeSelect.Items.Clear();
            Nodes.UpdateAvailableSensors();

            foreach (string sensor in Nodes.COM_Ports)
                combobox_nodeSelect.Items.Add(sensor);

            if (!combobox_nodeSelect.Items.IsEmpty)
                combobox_nodeSelect.SelectedIndex = 0;
        }
开发者ID:xohmz,项目名称:E-MAT,代码行数:60,代码来源:NodesVisual.xaml.cs

示例10: makeCube

 //Creates a cube centred about the origin with the specified diameter.
 public static Model3DGroup makeCube(double diameter, Color colour)
 {
     Model3DGroup cube = new Model3DGroup();
     Point3D p0 = new Point3D(-diameter / 2, -diameter / 2, -diameter / 2);
     Point3D p1 = new Point3D(diameter / 2, -diameter / 2, -diameter / 2);
     Point3D p2 = new Point3D(diameter / 2, -diameter / 2, diameter / 2);
     Point3D p3 = new Point3D(-diameter / 2, -diameter / 2, diameter / 2);
     Point3D p4 = new Point3D(-diameter / 2, diameter / 2, -diameter / 2);
     Point3D p5 = new Point3D(diameter / 2, diameter / 2, -diameter / 2);
     Point3D p6 = new Point3D(diameter / 2, diameter / 2, diameter / 2);
     Point3D p7 = new Point3D(-diameter / 2, diameter / 2, diameter / 2);
     //front side triangles
     cube.Children.Add(Shapes.makeTriangle(p3, p2, p6, colour));
     cube.Children.Add(Shapes.makeTriangle(p3, p6, p7, colour));
     //right side triangles
     cube.Children.Add(Shapes.makeTriangle(p2, p1, p5, colour));
     cube.Children.Add(Shapes.makeTriangle(p2, p5, p6, colour));
     //back side triangles
     cube.Children.Add(Shapes.makeTriangle(p1, p0, p4, colour));
     cube.Children.Add(Shapes.makeTriangle(p1, p4, p5, colour));
     //left side triangles
     cube.Children.Add(Shapes.makeTriangle(p0, p3, p7, colour));
     cube.Children.Add(Shapes.makeTriangle(p0, p7, p4, colour));
     //top side triangles
     cube.Children.Add(Shapes.makeTriangle(p7, p6, p5, colour));
     cube.Children.Add(Shapes.makeTriangle(p7, p5, p4, colour));
     //bottom side triangles
     cube.Children.Add(Shapes.makeTriangle(p2, p3, p0, colour));
     cube.Children.Add(Shapes.makeTriangle(p2, p0, p1, colour));
     return cube;
 }
开发者ID:CRogers,项目名称:KinectGroupPractical,代码行数:32,代码来源:Shapes.cs

示例11: combine

 //Join two shapes together to form one combined shape (AKA group):
 //Note that both shapes are children of the returned shape:
 public static Model3DGroup combine(Model3DGroup shape1, Model3DGroup shape2)
 {
     Model3DGroup parent = new Model3DGroup();
     parent.Children.Add(shape1);
     parent.Children.Add(shape2);
     return parent;
 }
开发者ID:CRogers,项目名称:KinectGroupPractical,代码行数:9,代码来源:Shapes.cs

示例12: Skeleton3d

        public Skeleton3d(Model3DGroup environment)
        {
            if (environment == null)
                throw new NullReferenceException("No 3d environment for skeleton given!");

            _environment = environment;
        }
开发者ID:philipdaubmeier,项目名称:BodyOrientation,代码行数:7,代码来源:Skeleton3d.cs

示例13: VisualTree3DView

		public VisualTree3DView(Visual visual)
		{
			DirectionalLight directionalLight1 = new DirectionalLight(Colors.White, new Vector3D(0, 0, 1));
			DirectionalLight directionalLight2 = new DirectionalLight(Colors.White, new Vector3D(0, 0, -1));

			double z = 0;
			Model3D model = this.ConvertVisualToModel3D(visual, ref z);

			Model3DGroup group = new Model3DGroup();
			group.Children.Add(directionalLight1);
			group.Children.Add(directionalLight2);
			group.Children.Add(model);
			this.zScaleTransform = new ScaleTransform3D();
			group.Transform = this.zScaleTransform;

			ModelVisual3D modelVisual = new ModelVisual3D();
			modelVisual.Content = group;

			Rect3D bounds = model.Bounds;
			double fieldOfView = 45;
			Point3D lookAtPoint = new Point3D(bounds.X + bounds.SizeX / 2, bounds.Y + bounds.SizeY / 2, bounds.Z + bounds.SizeZ / 2);
			double cameraDistance = 0.5 * bounds.SizeX / Math.Tan(0.5 * fieldOfView * Math.PI / 180);
			Point3D position = lookAtPoint - new Vector3D(0, 0, cameraDistance);
			Camera camera = new PerspectiveCamera(position, new Vector3D(0, 0, 1), new Vector3D(0, -1, 0), fieldOfView);

			this.zScaleTransform.CenterZ = lookAtPoint.Z;

			this.Children.Add(modelVisual);
			this.Camera = camera;
			this.ClipToBounds = false;
			this.Width = 500;
			this.Height = 500;

			this.trackballBehavior = new TrackballBehavior(this, lookAtPoint);
		}
开发者ID:JonGonard,项目名称:snoopwpf,代码行数:35,代码来源:VisualTree3DView.cs

示例14: createPortalObject

        static public PortalObject createPortalObject(PortalObjectType objectType,
                                                      string objectName, 
                                                      Point3D points,
                                                      ref Model3DGroup modelGroup)
        {
            PortalObject portalObject = null;

            switch (objectType)
            {
                case PortalObjectType.E_STOP:
                    portalObject = new EStopSensor(objectName, points, ref modelGroup);
                    break;
                case PortalObjectType.LIGHT_CURTAIN_INTERLOCKS:
                    portalObject = new LightCurtainInterlock(objectName, points, ref modelGroup);
                    break;
                case PortalObjectType.MOTION_DETECTOR_SENSORS:
                    portalObject = new MotionDetector(objectName, points, ref modelGroup);
                    break;
                case PortalObjectType.TRAFFIC_LIGHTS:
                    portalObject = new TrafficLight(objectName, points, ref modelGroup);
                    break;
                case PortalObjectType.VEHICLE_SENSORS:
                    portalObject = new VehicleSensor(objectName, points, ref modelGroup);
                    break;
                default:
                    break;
            }

            return portalObject;
        }
开发者ID:BdGL3,项目名称:CXPortal,代码行数:30,代码来源:PortalObjectFactory.cs

示例15: aricondition

        public void aricondition(double x, double y, double z)
        {
            type = 4;
            DiffuseMaterial material1 = new DiffuseMaterial();
            material1.Brush = Brushes.LightGray;
            DiffuseMaterial material2 = new DiffuseMaterial();
            ImageBrush brush = new ImageBrush();
            brush.ImageSource = new BitmapImage(new Uri(@"air.jpg", UriKind.Relative));
            material2.Brush = brush;

            Model3DGroup cube = new Model3DGroup();
            material[0] = material1;
            material[1] = material1;
            material[2] = material1;
            material[3] = material1;
            material[4] = material1;
            material[5] = material1;
            material[6] = material1;
            material[7] = material1;
            material[8] = material2;
            material[9] = material2;
            material[10] = material1;
            material[11] = material1;
            cubegroup( x, y, z,ref cube, material);
            this.Content = cube;           
        }
开发者ID:uwitec,项目名称:gloryview-rfid,代码行数:26,代码来源:ModelObject.cs


注:本文中的System.Windows.Media.Media3D.Model3DGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。