當前位置: 首頁>>代碼示例>>C#>>正文


C# Media3D.Transform3DGroup類代碼示例

本文整理匯總了C#中System.Windows.Media.Media3D.Transform3DGroup的典型用法代碼示例。如果您正苦於以下問題:C# Transform3DGroup類的具體用法?C# Transform3DGroup怎麽用?C# Transform3DGroup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Transform3DGroup類屬於System.Windows.Media.Media3D命名空間,在下文中一共展示了Transform3DGroup類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetNextTransformation

        /**
         * Creates transformation group for the object in the list, it can be rotated, translated, scaled, as layout class wish :)
         * \return transformation group for the object in the list
         */
        public Transform3DGroup GetNextTransformation()
        {
            Point3D p = new Point3D();
            p.X = 1.8f * Math.Cos(counter * 0.17 * 30.0);
            p.Y = 1.2f * Math.Sin(counter * 0.17 * 30.0);
            p.Z = -counter;

            if (p.Z < maxDist) maxDist = p.Z;

            ++counter;

            Transform3DGroup group = new Transform3DGroup();
            group.Children.Add(new ScaleTransform3D
            {
                ScaleX = 1.0,
                ScaleY = 1.0,
                ScaleZ = 1.0
            });
            group.Children.Add(new RotateTransform3D
            {
                Rotation = new AxisAngleRotation3D
                {
                    Angle = 35,
                    Axis = new Vector3D(1, 1, 1)
                }
            });
            group.Children.Add(new TranslateTransform3D
            {
                OffsetX = p.X,
                OffsetY = p.Y,
                OffsetZ = p.Z
            });

            return group;
        }
開發者ID:fenbf,項目名稱:search3D,代碼行數:39,代碼來源:SpiralLayout.cs

示例2: Trackball

        public Trackball()
        {
            _transform = new Transform3DGroup();
			_transform.Children.Add( _scale );
            _transform.Children.Add( new RotateTransform3D( _rotation ) );
			_transform.Children.Add( _translation );
        }
開發者ID:xuchuansheng,項目名稱:GenXSource,代碼行數:7,代碼來源:Trackball.cs

示例3: MotionWindow_Loaded

		void MotionWindow_Loaded(object sender, RoutedEventArgs e)
		{
			Transform3DGroup gp = new Transform3DGroup();
			uBase.Load(@"3DModules\upper.xaml");
			ScaleTransform3D sc = new ScaleTransform3D(12, 12, 1, 0, 0, 0);
			TranslateTransform3D tt = new TranslateTransform3D(0, 0, -15.5);
			gp.Children.Add(sc);
			gp.Children.Add(tt);
			uBase.Transform = gp;
			uPlatform.Load(@"3DModules\platform.xaml");
			upper.Load(@"3DModules\upper.xaml");
			AbsoluteVisual.AddLight(Colors.Wheat, new Vector3D(-1, -1, -1), Colors.Gray);
			vpMain.PlaceCamera(
				new Point3D(0, 0, 500),
				new Vector3D(0, 0, -1),
				new Vector3D(0, 1, 0),
				45
			);
			AbsoluteVisual.Children.Add(uBase);
			AbsoluteVisual.Children.Add(uPlatform);
			AbsoluteVisual.Children.Add(upper);
			ca = new EventCameraAgent(vpMain);
			ca.MouseLockRelPos = new Point(1, 1);
			ca.BindEventTo(this);
			ca.OnCameraStatusChange += new CameraAgent.CameraTransformHandler(ca_OnCameraStatusChange);
		}
開發者ID:mind0n,項目名稱:hive,代碼行數:26,代碼來源:Motion.xaml.cs

示例4: Setup3DItem

        public void Setup3DItem(Model3DGroup targetGroup, DiffuseMaterial diffuseMaterialBrushPair,
            Size size, Point center, Material backMaterial, Rect backTextureCoordinates)
        {
            _locationDesired = new Point3D(center.X, center.Y, 0);
            _locationCurrent = new Point3D(0, 0, Rnd.NextDouble() * 10 - 20);
            _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);

            DiffuseMaterial = diffuseMaterialBrushPair;

            _quad.Children.Add(
                CreateTile(
                    diffuseMaterialBrushPair,
                    backMaterial,
                    _borderMaterial,
                    new Size3D(size.Width, size.Height, .01),
                    backTextureCoordinates));

            Transform3DGroup group = new Transform3DGroup();

            group.Children.Add(new RotateTransform3D(_verticalFlipRotation));
            group.Children.Add(new RotateTransform3D(this._quaternionRotation3D));

            group.Children.Add(_scaleTransform);
            group.Children.Add(_translate);

            _quad.Transform = group;

            targetGroup.Children.Add(_quad);
        }
開發者ID:liuxr,項目名稱:wpfumprototype,代碼行數:34,代碼來源:TileData.cs

示例5: ConvertOne

        public GeometryModel3D ConvertOne( EngineViewModel engine )
        {
            var white = Color.FromRgb(255, 255, 255);
            var whiteBrush = new SolidColorBrush(white);
            var model = new GeometryModel3D(GetGeometry(), new DiffuseMaterial(whiteBrush));

            var transform = new Transform3DGroup();
            var scaleTransform = new ScaleTransform3D();
            var translateTransform = new TranslateTransform3D();

            transform.Children.Add(scaleTransform);
            transform.Children.Add(translateTransform);

            scaleTransform.ScaleX = 3;
            scaleTransform.ScaleY = 3;

            var powerBinding = new Binding("Power") {Mode = BindingMode.OneWay, Source = engine};
            BindingOperations.SetBinding(
                scaleTransform,
                ScaleTransform3D.ScaleZProperty,
                powerBinding);

            translateTransform.OffsetX = engine.OffsetX;
            translateTransform.OffsetY = engine.OffsetY;

            model.Transform = transform;

            return model;
        }
開發者ID:Rantanen,項目名稱:flyduino,代碼行數:29,代碼來源:EngineToModelConverter.cs

示例6: 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

示例7: Cell

        public Cell(INeuron neuron, ModelVisual3D mophology, Imaging imager)
        {
            this.neuron = neuron;
            this.mophology = mophology;
            this.imager = imager;
            neuron.Updated += OnUpdated;
            neuron.Hillock.Spike += OnSpike;
            IsPushing = true;

            var transforms = new Transform3DGroup();
            Rotate = new RotateTransform3D(new QuaternionRotation3D());
            Translate = new TranslateTransform3D(neuron.Position.X, neuron.Position.Y, neuron.Position.Z);
            Scale = new ScaleTransform3D();
            transforms.Children.Add(Rotate);
            transforms.Children.Add(Translate);
            transforms.Children.Add(Scale);
            Mophology.Transform = transforms;

            var binding = new Binding()
            {
                Source = neuron,
                Path = new PropertyPath("Position"),
                Mode = BindingMode.OneWay
            };
            BindingOperations.SetBinding(this, Cell.PositionProperty, binding);
        }
開發者ID:babaq,項目名稱:Soul,代碼行數:26,代碼來源:Cell.cs

示例8: CombineTransform

 /// <summary>
 /// Combines two transforms.
 /// </summary>
 /// <param name="t1">
 /// The first transform.
 /// </param>
 /// <param name="t2">
 /// The second transform.
 /// </param>
 /// <returns>
 /// The combined transform group.
 /// </returns>
 public static Transform3D CombineTransform(Transform3D t1, Transform3D t2)
 {
     var g = new Transform3DGroup();
     g.Children.Add(t1);
     g.Children.Add(t2);
     return g;
 }
開發者ID:sivarajankumar,項目名稱:dentalsmile,代碼行數:19,代碼來源:Transform3DHelper.cs

示例9: CreateTransformGroup

        public Transform3DGroup CreateTransformGroup(Halo3.ObjectChunk placedObject)
        {
            var transformGroup = new Transform3DGroup();
            float yaw, pitch, roll;
            Core.Helpers.VectorMath.Convert.ToYawPitchRoll(
                placedObject.SpawnPosition.Right,
                placedObject.SpawnPosition.Forward,
                placedObject.SpawnPosition.Up,
                out yaw,
                out pitch,
                out roll);

            // For some reason you have to swag the roll and yaw.
            var swag = Microsoft.Xna.Framework.Quaternion.CreateFromYawPitchRoll(roll, pitch, yaw);

            // Apply 3D Matrix
            var matrix = new Matrix3D();
            matrix.Rotate(new Quaternion(swag.X, swag.Y, swag.Z, swag.W));
            matrix.OffsetX = placedObject.SpawnCoordinates.X;
            matrix.OffsetY = placedObject.SpawnCoordinates.Y;
            matrix.OffsetZ = placedObject.SpawnCoordinates.Z;
            // TODO: FUCK THIS VALUE
            // TODO: AND FUCK BUNGIE
            //matrix.Prepend(new Matrix3D
            //					{
            //						OffsetX = 0,
            //						OffsetY = 0,
            //						OffsetZ = 0
            //					});
            transformGroup.Children.Add(new MatrixTransform3D(matrix));

            return transformGroup;
        }
開發者ID:0xdeafcafe,項目名稱:VisualForge,代碼行數:33,代碼來源:MainWindow.xaml.cs

示例10: CellNet

        public CellNet(INetwork network, ModelVisual3D mophology, Dictionary<Guid, ICell> cells, Dictionary<Guid, ICellNet> childcellnet)
        {
            this.network = network;
            this.mophology = mophology;
            this.cells = cells;
            this.childcellnet = childcellnet;
            IsPushing = true;

            var transforms = new Transform3DGroup();
            Rotate = new RotateTransform3D(new QuaternionRotation3D());
            Translate = new TranslateTransform3D(network.Position.X, network.Position.Y, network.Position.Z);
            Scale = new ScaleTransform3D();
            transforms.Children.Add(Rotate);
            transforms.Children.Add(Translate);
            transforms.Children.Add(Scale);
            Mophology.Transform = transforms;

            var binding = new Binding()
            {
                Source = network,
                Path = new PropertyPath("Position"),
                Mode = BindingMode.OneWay
            };
            BindingOperations.SetBinding(this, CellNet.PositionProperty, binding);
        }
開發者ID:babaq,項目名稱:Soul,代碼行數:25,代碼來源:CellNet.cs

示例11: PartAnimation

        protected override Matrix3D PartAnimation( string partName )
        {
            if( partName == "propeller" )
            {
                Transform3DGroup group = new Transform3DGroup( );

                group.Children.Add(
                    new TranslateTransform3D( -hubOffsetX, -hubOffsetY, -propZOffset ) );
                group.Children.Add(
                    new RotateTransform3D(
                        new AxisAngleRotation3D( new Vector3D( 1, 0, 0 ), -propAngle ), 0, 0, 0 ) );
                group.Children.Add(
                    new RotateTransform3D(
                        new AxisAngleRotation3D( new Vector3D( 0, 0, 1 ), propRotation ), 0, 0, 0 ) );
                group.Children.Add(
                    new RotateTransform3D(
                        new AxisAngleRotation3D( new Vector3D( 1, 0, 0 ), +propAngle ), 0, 0, 0 ) );
                group.Children.Add(
                    new TranslateTransform3D( +hubOffsetX, +hubOffsetY, +propZOffset ) );

                propRotation += 11;

                return group.Value;
            }
            else
            {
                return Matrix3D.Identity;
            }
        }
開發者ID:QuocHuy7a10,項目名稱:Arianrhod,代碼行數:29,代碼來源:AirplaneMesh.cs

示例12: Plant

 public Plant()
 {
     var x = new Vector3D(1, 0, 0);
     var r1 = new RotateTransform3D(new AxisAngleRotation3D(x, 80));
     var r2 = new RotateTransform3D(new AxisAngleRotation3D(x, -70));
     var r3 = new RotateTransform3D(new AxisAngleRotation3D(x, -10));
     var t1 = new TranslateTransform3D(0, 0, 0.5);
     var t2 = new TranslateTransform3D(0, 0, 0.7);
     var t3 = new TranslateTransform3D(0, 0, 1.0);
     var s1 = new ScaleTransform3D(0.5, 0.5, 0.5);
     var s2 = new ScaleTransform3D(0.3, 0.3, 0.3);
     var s3 = new ScaleTransform3D(0.8, 0.8, 0.8);
     var m1 = new Transform3DGroup();
     m1.Children.Add(r1);
     m1.Children.Add(s1);
     m1.Children.Add(t1);
     var m2 = new Transform3DGroup();
     m2.Children.Add(r2);
     m2.Children.Add(s2);
     m2.Children.Add(t2);
     var m3 = new Transform3DGroup();
     m3.Children.Add(r3);
     m3.Children.Add(s3);
     m3.Children.Add(t3);
     T1 = m1;
     T2 = m2;
     T3 = m3;
 }
開發者ID:XiBeichuan,項目名稱:hydronumerics,代碼行數:28,代碼來源:Plant.cs

示例13: Window1

        public Window1()
        {
            InitializeComponent();

            Flickr.Initialize();

            cv = new PhotoCarouselView();
            ps = new PhotoStack3D();

            Transform3DGroup cvTG = new Transform3DGroup();
            cvTG.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 5)));
            cvTG.Children.Add(new TranslateTransform3D(0, 0, -1));
            cv.Transform = cvTG;

            Transform3DGroup tg = new Transform3DGroup();
            tg.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), -13)));
            tg.Children.Add(new TranslateTransform3D(0, ps.Height / 2, -1.2));
            ps.Transform = tg;

            MainViewport.Children.Add(cv);
            MainViewport.Children.Add(ps);

            cv.ItemClickedOn += new PhotoBrowser.CarouselView.CarouselView.ItemClickedOnEvent(cv_ItemClickedOn);
            cv.GeoLocationAvailable += new PhotoCarouselView.GeoEventHandler(cv_GeoLocationAvailable);
            cv.GeoLocationHidden += new PhotoCarouselView.GeoEventHandler(cv_GeoLocationHidden);

            ps.GeoLocationSelected += new PhotoStack3D.GeoLocationSelectedDelegate(ps_GeoLocationSelected);
            ps.SelectionChanged += new PhotoBrowser.Stack3D.Stack3D.StackSelectionChangedEvent(ps_SelectionChanged);
            ps.BlogRequested += new PhotoStack3D.BlogRequestedDelegate(ps_BlogRequested);

            // create the globe we'll use
            earth = new InteractiveSphere();
            mapVisual = new MapVisual();
            mapVisual.searchMenuItem.Click += new RoutedEventHandler(searchMenuItem_Click);
            earth.Visual = mapVisual;

            // create the transformation applied to the globe
            earthTransform = new Transform3DGroup();
            Point3D earthPos = new Point3D(-0.2, 0.05, -1.1);
            Vector3D earthToCam = new Vector3D(0 - earthPos.X,
                                               0 - earthPos.Y,
                                               0 - earthPos.Z);
            earthToCam.Normalize();

            earthTransform.Children.Add(new ScaleTransform3D(0.0, 0.0, 0.0));
            _myQuaternionRotLong = new QuaternionRotation3D(new Quaternion(new Vector3D(0, 1, 0), 0));
            _myQuaternionRotLat = new QuaternionRotation3D(new Quaternion(new Vector3D(1, 0, 0), 0));

            earthTransform.Children.Add(new RotateTransform3D(_myQuaternionRotLong));
            earthTransform.Children.Add(new RotateTransform3D(_myQuaternionRotLat));
            earthTransform.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0),
                                        Math.Acos(Vector3D.DotProduct(new Vector3D(0, 0, 1), earthToCam)) / Math.PI * 180)));

            earthTransform.Children.Add(new TranslateTransform3D((Vector3D)earthPos));
            earth.Transform = earthTransform;

            // add in the earth
            HookUpEarthEvents();
        }
開發者ID:dingxinbei,項目名稱:OLdBck,代碼行數:59,代碼來源:Window1.xaml.cs

示例14: Element

 public Element()
 {
     // TODO: Add custom rotation and (optional) scaling
     Transform3DGroup group = new Transform3DGroup();
     group.Children.Add(new RotateTransform3D(Rotation, 0.5, 0, 0.5));
     group.Children.Add(Translation);
     Transform = group;
 }
開發者ID:danzhu,項目名稱:JoyfulColours,代碼行數:8,代碼來源:Element.cs

示例15: ToMatrix3DLH

 /// <summary>
 /// Returns the world*perspective matrix for the camera
 /// </summary>
 /// <param name="camera">The WPF camera</param>
 /// <param name="aspectRatio">The aspect ratio of the device surface</param>
 /// <returns></returns>
 public static Matrix3D ToMatrix3DLH( this PerspectiveCamera camera, double aspectRatio )
 {
     Transform3DGroup tg = new Transform3DGroup( );
     tg.Children.Add(new MatrixTransform3D(GetLookAtMatrixLH(camera)));
     tg.Children.Add(camera.Transform);
     tg.Children.Add(new MatrixTransform3D(GetPerspectiveMatrixLH(camera, aspectRatio)));
     return tg.Value;
 }
開發者ID:QuocHuy7a10,項目名稱:Arianrhod,代碼行數:14,代碼來源:MatrixUtilities.cs


注:本文中的System.Windows.Media.Media3D.Transform3DGroup類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。