void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 10 "..\..\..\..\WpfCubeAnimation\MainWindow.xaml" ((WpfCubeAnimation.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.OnLoaded); #line default #line hidden return; case 2: #line 60 "..\..\..\..\WpfCubeAnimation\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnImage1Animate); #line default #line hidden return; case 3: this.myViewport3D = ((System.Windows.Controls.Viewport3D)(target)); return; case 4: this.myRotate = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
// Public constructor to initialize those fields, etc public Sphere() { rotate = new AxisAngleRotation3D(); xform = new RotateTransform3D(rotate); PropertyChanged(this, new DependencyPropertyChangedEventArgs()); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 7 "..\..\..\Calendar\Calendar.xaml" ((WeatherCalendar.Calendar)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Calendar_OnLoaded); #line default #line hidden return; case 2: this.lastRow = ((System.Windows.Controls.RowDefinition)(target)); return; case 3: this.camera = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 4: this.aar = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
// Public constructor to initialize those fields, etc public Cylinder() { rotate = new AxisAngleRotation3D(); xform = new RotateTransform3D(rotate); PropertyChanged(new DependencyPropertyChangedEventArgs()); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myStoryboard = ((System.Windows.Media.Animation.BeginStoryboard)(target)); return; case 2: this.myViewport = ((System.Windows.Controls.Viewport3D)(target)); return; case 3: this.myCamera = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 4: this.myModelView3D = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 5: this.rotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 6: this.rotation2 = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
public CameraController(Camera c, IListLayout l, PointLight p) { camera = (ProjectionCamera)c; layout = l; light = p; try { Transform3DGroup group = camera.Transform as Transform3DGroup; RotateTransform3D rot = group.Children[0] as RotateTransform3D; cameraRotX = rot.Rotation as AxisAngleRotation3D; rot = group.Children[1] as RotateTransform3D; cameraRotY = rot.Rotation as AxisAngleRotation3D; rot = group.Children[2] as RotateTransform3D; cameraRotZ = rot.Rotation as AxisAngleRotation3D; } catch (Exception ) { System.Diagnostics.Debug.WriteLine("camera transformations are wrong!!!"); } try { Transform3DGroup group = light.Transform as Transform3DGroup; RotateTransform3D rot = group.Children[0] as RotateTransform3D; lightRotX = rot.Rotation as AxisAngleRotation3D; rot = group.Children[1] as RotateTransform3D; lightRotY = rot.Rotation as AxisAngleRotation3D; rot = group.Children[2] as RotateTransform3D; lightRotZ = rot.Rotation as AxisAngleRotation3D; } catch (Exception ) { System.Diagnostics.Debug.WriteLine("light transformations are wrong!!!"); } }
public BlipVisual(Visual3D visual, bool isVisualUpright, TranslateTransform3D translate, AxisAngleRotation3D rotate) { this.Visual = visual; this.IsVisualUpright = isVisualUpright; this.Translate = translate; this.Rotate = rotate; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LeftSpinBeginStoryboard = ((System.Windows.Media.Animation.BeginStoryboard)(target)); return; case 2: this.RightSpinBeginStoryboard = ((System.Windows.Media.Animation.BeginStoryboard)(target)); return; case 3: this.UpwardSpinBeginStoryboard = ((System.Windows.Media.Animation.BeginStoryboard)(target)); return; case 4: this.DownwardSpinBeginStoryboard = ((System.Windows.Media.Animation.BeginStoryboard)(target)); return; case 5: this.myPerspectiveCamera = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 6: this.myHorizontalRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 7: this.myVerticalRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
protected override void BeginTransition3D(TransitionElement transitionElement, ContentPresenter oldContent, ContentPresenter newContent, Viewport3D viewport) { Brush clone = CreateBrush(oldContent); Size size = transitionElement.RenderSize; MeshGeometry3D leftDoor = CreateMesh(new Point3D(), new Vector3D(size.Width / 2, 0, 0), new Vector3D(0, size.Height, 0), 1, 1, new Rect(0, 0, 0.5, 1)); GeometryModel3D leftDoorGeometry = new GeometryModel3D(); leftDoorGeometry.Geometry = leftDoor; leftDoorGeometry.Material = new DiffuseMaterial(clone); AxisAngleRotation3D leftRotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0); leftDoorGeometry.Transform = new RotateTransform3D(leftRotation); GeometryModel3D rightDoorGeometry = new GeometryModel3D(); MeshGeometry3D rightDoor = CreateMesh(new Point3D(size.Width / 2, 0, 0), new Vector3D(size.Width / 2, 0, 0), new Vector3D(0, size.Height, 0), 1, 1, new Rect(0.5, 0, 0.5, 1)); rightDoorGeometry.Geometry = rightDoor; rightDoorGeometry.Material = new DiffuseMaterial(clone); AxisAngleRotation3D rightRotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0); rightDoorGeometry.Transform = new RotateTransform3D(rightRotation, size.Width, 0, 0); Model3DGroup doors = new Model3DGroup(); doors.Children.Add(leftDoorGeometry); doors.Children.Add(rightDoorGeometry); ModelVisual3D model = new ModelVisual3D(); model.Content = doors; // Replace old content in visual tree with new 3d model transitionElement.HideContent(oldContent); viewport.Children.Add(model); DoubleAnimation da = new DoubleAnimation(90 - 0.5 * FieldOfView, Duration); leftRotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da); da = new DoubleAnimation(-(90 - 0.5 * FieldOfView), Duration); rightRotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da); da = new DoubleAnimation(0, Duration); da.Completed += delegate { EndTransition(transitionElement, oldContent, newContent); }; clone.BeginAnimation(Brush.OpacityProperty, da); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\MainWindow.xaml" ((ParallelBoids.MainWindow)(target)).MouseWheel += new System.Windows.Input.MouseWheelEventHandler(this.Window_MouseWheel); #line default #line hidden #line 9 "..\..\MainWindow.xaml" ((ParallelBoids.MainWindow)(target)).MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.Window_MouseDoubleClick); #line default #line hidden #line 9 "..\..\MainWindow.xaml" ((ParallelBoids.MainWindow)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Window_KeyDown); #line default #line hidden #line 9 "..\..\MainWindow.xaml" ((ParallelBoids.MainWindow)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Window_MouseDown); #line default #line hidden #line 9 "..\..\MainWindow.xaml" ((ParallelBoids.MainWindow)(target)).MouseMove += new System.Windows.Input.MouseEventHandler(this.Window_MouseMove); #line default #line hidden #line 9 "..\..\MainWindow.xaml" ((ParallelBoids.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.viewport3D = ((System.Windows.Controls.Viewport3D)(target)); return; case 3: this.camMain = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 4: this.myAngleRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
//Create a rotation transformation about the specified axis by the specified number of degrees anti-clockwise: public static RotateTransform3D makeAxisTransform(Vector3D axis, double angle) { RotateTransform3D myRotateTransform3D = new RotateTransform3D(); AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D(); myAxisAngleRotation3d.Axis = axis; myAxisAngleRotation3d.Angle = angle; //rotate anticlockwise by the specified angle myRotateTransform3D.Rotation = myAxisAngleRotation3d; return myRotateTransform3D; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.tbValues = ((System.Windows.Controls.TextBlock)(target)); return; case 2: this.btnGo = ((System.Windows.Controls.Button)(target)); #line 25 "..\..\Window1.xaml" this.btnGo.Click += new System.Windows.RoutedEventHandler(this.btnGo_Click); #line default #line hidden return; case 3: this.tbAccVals = ((System.Windows.Controls.TextBox)(target)); return; case 4: this.viewport3D1 = ((System.Windows.Controls.Viewport3D)(target)); return; case 5: this.camMain = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 6: this.dirLightMain = ((System.Windows.Media.Media3D.DirectionalLight)(target)); return; case 7: this.MyModel = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 8: this.meshMain = ((System.Windows.Media.Media3D.MeshGeometry3D)(target)); return; case 9: this.matDiffuseMain = ((System.Windows.Media.Media3D.DiffuseMaterial)(target)); return; case 10: this.rotate = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 11: this.slider1 = ((System.Windows.Controls.Slider)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.angle = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
public Node(NodeTemplate template) { Translation = new TranslateTransform3D(); PrimaryRotation = new AxisAngleRotation3D(template.Axis, 0); Transform3DGroup group = new Transform3DGroup(); group.Children.Add(new RotateTransform3D(PrimaryRotation, template.Center)); group.Children.Add(Translation); Transform = group; }
public Cube(Viewport3D myViewport3D, float obesity) { this.up = ((PerspectiveCamera)myViewport3D.Camera).UpDirection; this.trans = new Transform3DGroup(); this.scale = new ScaleTransform3D(); this.translation = new TranslateTransform3D(); this.rotation = new RotateTransform3D(); this.axis = new AxisAngleRotation3D(); this.obesity = obesity; this.cube = new Model3DGroup(); Point3D p0 = new Point3D(-1, -1, -1); Point3D p1 = new Point3D(1, -1, -1); Point3D p2 = new Point3D(1, -1, 1); Point3D p3 = new Point3D(-1, -1, 1); Point3D p4 = new Point3D(-1, 0, -1); Point3D p5 = new Point3D(1, 0, -1); Point3D p6 = new Point3D(1, 0, 1); Point3D p7 = new Point3D(-1, 0, 1); //front side triangles cube.Children.Add(CreateTriangleModel(p3, p2, p6)); cube.Children.Add(CreateTriangleModel(p3, p6, p7)); //right side triangles cube.Children.Add(CreateTriangleModel(p2, p1, p5)); cube.Children.Add(CreateTriangleModel(p2, p5, p6)); //back side triangles cube.Children.Add(CreateTriangleModel(p1, p0, p4)); cube.Children.Add(CreateTriangleModel(p1, p4, p5)); //left side triangles cube.Children.Add(CreateTriangleModel(p0, p3, p7)); cube.Children.Add(CreateTriangleModel(p0, p7, p4)); //top side triangles cube.Children.Add(CreateTriangleModel(p7, p6, p5)); cube.Children.Add(CreateTriangleModel(p7, p5, p4)); //bottom side triangles cube.Children.Add(CreateTriangleModel(p2, p3, p0)); cube.Children.Add(CreateTriangleModel(p2, p0, p1)); this.model = new ModelVisual3D(); this.model.Content = cube; this.myDirectionalLight = new DirectionalLight(); this.myDirectionalLight.Color = Colors.Green; this.myDirectionalLight.Direction = new Vector3D(-2, -3, 1); this.cube.Children.Add(myDirectionalLight); myViewport3D.Children.Add(model); trans.Children.Add(scale); trans.Children.Add(rotation); trans.Children.Add(translation); this.cube.Transform = trans; }
protected override void BeginTransition3D(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent, Viewport3D viewport) { Size size = transitionElement.RenderSize; // Create a rectangle MeshGeometry3D mesh = CreateMesh(new Point3D(), new Vector3D(size.Width, 0, 0), new Vector3D(0, size.Height, 0), 1, 1, new Rect(0, 0, 1, 1)); GeometryModel3D geometry = new GeometryModel3D(); geometry.Geometry = mesh; VisualBrush clone = new VisualBrush(oldContent); geometry.Material = new DiffuseMaterial(clone); ModelVisual3D model = new ModelVisual3D(); model.Content = geometry; viewport.Children.Add(model); Vector3D axis; Point3D center = new Point3D(); switch (Direction) { case RotateDirection.Left: axis = new Vector3D(0, 1, 0); break; case RotateDirection.Right: axis = new Vector3D(0, -1, 0); center = new Point3D(size.Width, 0, 0); break; case RotateDirection.Up: axis = new Vector3D(-1, 0, 0); break; default: axis = new Vector3D(1, 0, 0); center = new Point3D(0, size.Height, 0); break; } AxisAngleRotation3D rotation = new AxisAngleRotation3D(axis, 0); model.Transform = new RotateTransform3D(rotation, center); DoubleAnimation da = new DoubleAnimation(0, Duration); clone.BeginAnimation(Brush.OpacityProperty, da); da = new DoubleAnimation(90 , Duration); da.Completed += delegate { EndTransition(transitionElement, oldContent, newContent); }; rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da); }
private void rotXSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { if (ctrVM != null) { ctrVM.ROTX = (sender as Slider).Value; AxisAngleRotation3D dax3d = new AxisAngleRotation3D(new Vector3D(ctrVM.ROTX, ctrVM.ROTY, ctrVM.ROTZ), 30); RotateTransform3D dmyRotateTransform = new RotateTransform3D(dax3d); ctrVM.functionMV.myPCamera.Transform = dmyRotateTransform; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\..\View\ShapePreview3D.xaml" ((JsdEditor.ShapePreview3D)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded); #line default #line hidden #line 10 "..\..\..\View\ShapePreview3D.xaml" ((JsdEditor.ShapePreview3D)(target)).MouseWheel += new System.Windows.Input.MouseWheelEventHandler(this.UserControl_MouseWheel); #line default #line hidden return; case 2: #line 46 "..\..\..\View\ShapePreview3D.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 3: this.b = ((System.Windows.Controls.Border)(target)); return; case 4: this.mgRoot = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 5: this.mgShape = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 6: this.anrX = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 7: this.anrY = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 8: this.anrZ = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\MainWindow.xaml" ((SharpCube.MainWindow)(target)).Activated += new System.EventHandler(this.Window_Activated); #line default #line hidden return; case 2: this.V3D = ((System.Windows.Controls.Viewport3D)(target)); return; case 3: this.rotate = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 4: this.TBX = ((System.Windows.Controls.TextBox)(target)); #line 53 "..\..\MainWindow.xaml" this.TBX.LostFocus += new System.Windows.RoutedEventHandler(this.TB_LostFocus); #line default #line hidden return; case 5: this.TBY = ((System.Windows.Controls.TextBox)(target)); #line 54 "..\..\MainWindow.xaml" this.TBY.LostFocus += new System.Windows.RoutedEventHandler(this.TB_LostFocus); #line default #line hidden return; case 6: this.TBZ = ((System.Windows.Controls.TextBox)(target)); #line 55 "..\..\MainWindow.xaml" this.TBZ.LostFocus += new System.Windows.RoutedEventHandler(this.TB_LostFocus); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 10 "..\..\MainWindow.xaml" ((WeatherCalendar.MainWindow)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.MainWindow_OnMouseLeftButtonDown); #line default #line hidden #line 11 "..\..\MainWindow.xaml" ((WeatherCalendar.MainWindow)(target)).MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.MainWindow_OnMouseLeftButtonUp); #line default #line hidden #line 12 "..\..\MainWindow.xaml" ((WeatherCalendar.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.MainWindow_OnLoaded); #line default #line hidden #line 12 "..\..\MainWindow.xaml" ((WeatherCalendar.MainWindow)(target)).SizeChanged += new System.Windows.SizeChangedEventHandler(this.MainWindow_OnSizeChanged); #line default #line hidden #line 13 "..\..\MainWindow.xaml" ((WeatherCalendar.MainWindow)(target)).StateChanged += new System.EventHandler(this.MainWindow_OnStateChanged); #line default #line hidden return; case 2: this.mainBorder = ((System.Windows.Controls.Border)(target)); return; case 3: this.aar = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 4: this.calendar = ((WeatherCalendar.Calendar)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\..\View\ShapeView3D.xaml" ((JsdEditor.ShapeView3D)(target)).MouseWheel += new System.Windows.Input.MouseWheelEventHandler(this.UserControl_MouseWheel); #line default #line hidden return; case 2: this.mgRoot = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 3: this.mgShape = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 4: this.anrX = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 5: this.anrY = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 6: this.anrZ = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 7: #line 140 "..\..\..\View\ShapeView3D.xaml" ((System.Windows.Controls.CheckBox)(target)).Checked += new System.Windows.RoutedEventHandler(this.TransparencyCheckBox_Checked); #line default #line hidden #line 141 "..\..\..\View\ShapeView3D.xaml" ((System.Windows.Controls.CheckBox)(target)).Unchecked += new System.Windows.RoutedEventHandler(this.TransparencyCheckBox_Checked); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myStoryBoard = ((System.Windows.Media.Animation.Storyboard)(target)); return; case 2: this.rotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.mainViewport = ((System.Windows.Controls.Viewport3D)(target)); return; case 2: this.camera = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 3: this.MyModel = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 4: this.scale = ((System.Windows.Media.Media3D.ScaleTransform3D)(target)); return; case 5: this.rotateY = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 6: this.rotateX = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 7: this.translate = ((System.Windows.Media.Media3D.TranslateTransform3D)(target)); return; case 8: this.model3DGroup = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 9: this.geometryModel = ((System.Windows.Media.Media3D.GeometryModel3D)(target)); return; case 10: this.meshMain = ((System.Windows.Media.Media3D.MeshGeometry3D)(target)); return; case 11: this.meshBack = ((System.Windows.Media.Media3D.MeshGeometry3D)(target)); return; } this._contentLoaded = true; }
public UserControl1() { InitializeComponent(); ax3d = new AxisAngleRotation3D(new Vector3D(0, 2, 0), 1); RotateTransform3D myRotateTransform = new RotateTransform3D(ax3d); var ModelVisual3D = this.GetModel(); MatrixTransform3D mTransform = new MatrixTransform3D(); ModelVisual3D.Transform = myRotateTransform; //model //// }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\..\..\Views\ProductSlideGallery.xaml" ((MagicMirror.Views.ProductSlideGallery)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.UserControl_MouseDown); #line default #line hidden return; case 2: this.RootGrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.viewport3D = ((System.Windows.Controls.Viewport3D)(target)); #line 12 "..\..\..\..\Views\ProductSlideGallery.xaml" this.viewport3D.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.viewport3D_MouseLeftButtonDown); #line default #line hidden return; case 4: this.mainScene = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 5: this.angleRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 6: this.sceneTransform3d = ((System.Windows.Media.Media3D.TranslateTransform3D)(target)); return; case 7: this.busyGrid = ((System.Windows.Controls.Grid)(target)); return; case 8: this.viewLoading = ((MagicMirror.Views.LoadingWait)(target)); return; } this._contentLoaded = true; }
private static void AddBone(MeshGeometry3D mesh, Point3D startPoint, Point3D endPoint) { AxisAngleRotation3D rotate = new AxisAngleRotation3D(); RotateTransform3D xform = new RotateTransform3D(rotate); Vector3D boneVec = endPoint - startPoint; // radius always points towards -Z (when possible) Vector3D radius; if (boneVec.X == 0 && boneVec.Y == 0) { // Special case. radius = new Vector3D(0, -1, 0); } else { // Find vector axis 90 degrees from bone where Z == 0 rotate.Axis = Vector3D.CrossProduct(boneVec, new Vector3D(0, 0, 1)); rotate.Angle = -90; // Rotate 90 degrees to find radius vector radius = boneVec * xform.Value; radius.Normalize(); } // Rotate the radius around the bone vector rotate.Axis = boneVec; var positions = mesh.Positions; const int slices = 10; for (int slice = 0; slice < slices; ++slice) { // Rotate radius vector rotate.Angle = slice * 360.0 / slices; Vector3D vectRadius = radius * xform.Value; rotate.Angle = (slice + 1) * 360.0 / slices; Vector3D vectRadius1 = radius * xform.Value; // Bit of a hack to avoid having to set the normals or worry about consistent winding. positions.Add(startPoint); positions.Add(endPoint + delta * vectRadius); positions.Add(endPoint + delta * vectRadius1); positions.Add(startPoint); positions.Add(endPoint + delta * vectRadius1); positions.Add(endPoint + delta * vectRadius); } }
private void VerticalTransform(bool upDown, double angleDeltaFactor) { Vector3D postion = new Vector3D(myPerspectiveCamera.Position.X, myPerspectiveCamera.Position.Y, myPerspectiveCamera.Position.Z); Vector3D rotateAxis = Vector3D.CrossProduct(postion, myPerspectiveCamera.UpDirection); RotateTransform3D rt3d = new RotateTransform3D(); AxisAngleRotation3D rotate = new AxisAngleRotation3D(rotateAxis, angleDeltaFactor * (upDown ? -1 : 1)); rt3d.Rotation = rotate; Matrix3D matrix = rt3d.Value; Point3D newPostition = matrix.Transform(myPerspectiveCamera.Position); myPerspectiveCamera.Position = newPostition; myPerspectiveCamera.LookDirection = new Vector3D(-newPostition.X, -newPostition.Y, -newPostition.Z); Vector3D newUpDirection = Vector3D.CrossProduct(myPerspectiveCamera.LookDirection, rotateAxis); newUpDirection.Normalize(); myPerspectiveCamera.UpDirection = newUpDirection; }
public void Grid_MouseDown(object sender, MouseButtonEventArgs e) { DoubleAnimation da = new DoubleAnimation(); da.Duration = new Duration(TimeSpan.FromSeconds(1)); if (e.ClickCount == 2) { da.To = 0d; } else { da.To = 180d; } System.Windows.Media.Media3D.AxisAngleRotation3D aar = Application.Current.MainWindow.FindName("aar") as AxisAngleRotation3D; aar.BeginAnimation(AxisAngleRotation3D.AngleProperty, da); }
void BoardViewerViewPort3D_BoardChanged() { if (Board != null) { //this.Board = new BoardVisual(new XmlBoard(8, 8)); DoubleAnimation da = new DoubleAnimation(); da.From = 0; da.To = 360; da.Duration = TimeSpan.FromSeconds(15); da.RepeatBehavior = RepeatBehavior.Forever; AxisAngleRotation3D r = new AxisAngleRotation3D(); r.Axis = new Vector3D(0, 1, 0); this.Board.Transform = new RotateTransform3D(r); r.BeginAnimation(AxisAngleRotation3D.AngleProperty, da); } }
// Public constructor to initialize those fields, etc public Cylinder() { rotate = new AxisAngleRotation3D(); xform = new RotateTransform3D(rotate); MeshGeometry3D mesh = (MeshGeometry3D)Geometry; mesh.Positions = new Point3DCollection((Slices + 1) * (Stacks + 5) - 2); mesh.Normals = new Vector3DCollection((Slices + 1) * (Stacks + 5) - 2); mesh.TriangleIndices = new Int32Collection(6 * Slices * (Stacks + 1)); mesh.TextureCoordinates = new PointCollection((Slices + 1) * (Stacks + 5) - 2); // Initialize all collection based on default properties GeneratePositions(); GenerateTriangleIndices(); GenerateTextureCoordinates(); }
/// <summary> /// Add a 3D model to the instance /// </summary> private void Init() { Model3DGroup group = ((Model3DGroup)Core.Instance.Models["point"]).Clone(); MeshGeometry3D mesh = ((MeshGeometry3D)Core.Instance.Models["pointMesh"]).Clone(); //Model3DGroup g2 = group.Clone(); SolidColorBrush b = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0)); DiffuseMaterial material = new DiffuseMaterial(b); GeometryModel3D model2 = new GeometryModel3D(mesh, material); ScaleTransform3D scale = new ScaleTransform3D(); TranslateTransform3D move = new TranslateTransform3D(); TranslateTransform3D move2 = new TranslateTransform3D(); AxisAngleRotation3D rotate = new AxisAngleRotation3D(); Transform3DGroup t = new Transform3DGroup(); double factor = 3; Console.WriteLine(_Point.X + " " + _Point.Y); move.OffsetX = (1 / factor) * _Point.X; move.OffsetZ = 0.5;//;// new Random().NextDouble(); move.OffsetY = -(1 / factor) * _Point.Y;//Y*factor; move2.OffsetY = -2; rotate.Axis = new Vector3D(1, 0, 0); rotate.Angle = 270; scale.ScaleX = factor; scale.ScaleY = factor; scale.ScaleZ = factor; t.Children.Add(move); t.Children.Add(scale); t.Children.Add(new RotateTransform3D(rotate)); t.Children.Add(move2); t.Children.Add(_Scale); group.Transform = t; this.Content = group;// (Model3DGroup)Core.Instance.Models["side"]; ColorAnimation da = new ColorAnimation(Color.FromArgb(150, 255, 255, 0), Color.FromArgb(255, 255, 255, 0), new Duration(new TimeSpan(0, 0, 1))); da.RepeatBehavior = RepeatBehavior.Forever; da.AutoReverse = true; GeometryModel3D m1 = (GeometryModel3D)group.Children[0]; GeometryModel3D m2 = (GeometryModel3D)group.Children[0]; ((DiffuseMaterial)m1.Material).BeginAnimation(DiffuseMaterial.ColorProperty, da); ((DiffuseMaterial)m2.Material).BeginAnimation(DiffuseMaterial.ColorProperty, da); //model2.Material.colo //move2.BeginAnimation(TranslateTransform3D.OffsetYProperty, da); }
/// <summary> /// Add a 3D model to the instance /// </summary> private void Init() { MeshGeometry3D m1 = (MeshGeometry3D)Core.Instance.Models["Road"]; SolidColorBrush b = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0)); DiffuseMaterial material = new DiffuseMaterial(b); GeometryModel3D model1 = new GeometryModel3D(m1, material); Model3DGroup group = new Model3DGroup(); group.Children.Add(model1); this.Content = group; ScaleTransform3D scale = new ScaleTransform3D(); TranslateTransform3D move = new TranslateTransform3D(); TranslateTransform3D move2 = new TranslateTransform3D(); AxisAngleRotation3D rotate = new AxisAngleRotation3D(); AxisAngleRotation3D rotate2 = new AxisAngleRotation3D(); Transform3DGroup t = new Transform3DGroup(); double angle = 0; switch (_Location.Direction) { case ESideDirection.SlopeDown: angle = 60; break; case ESideDirection.UpDown: angle = 0; break; case ESideDirection.SlopeUp: angle = -60; break; } scale.ScaleZ = 1.2; scale.ScaleX = 3; move.OffsetX = _Point.X; move.OffsetZ = _Point.Y; move.OffsetY = 0.5; rotate.Axis = new Vector3D(0, 1, 0); rotate.Angle = angle; t.Children.Add(scale); t.Children.Add(new RotateTransform3D(rotate)); t.Children.Add(move); t.Children.Add(_Scale); ColorAnimation da = new ColorAnimation(Color.FromArgb(255, 255, 255, 0), Color.FromArgb(150, 255, 255, 0), new Duration(new TimeSpan(0, 0, 1))); da.RepeatBehavior = RepeatBehavior.Forever; da.AutoReverse = true; material.BeginAnimation(DiffuseMaterial.ColorProperty, da); this.Transform = t; }
private void Init() { MeshGeometry3D m1 = (MeshGeometry3D)Core.Instance.Models["mesh_0"]; MeshGeometry3D m2 = (MeshGeometry3D)Core.Instance.Models["mesh_1"]; SolidColorBrush b = new SolidColorBrush(_Color); DiffuseMaterial material = new DiffuseMaterial(b); GeometryModel3D model1 = new GeometryModel3D(m1, material); GeometryModel3D model2 = new GeometryModel3D(m2, material); Model3DGroup group = new Model3DGroup(); group.Children.Add(model1); group.Children.Add(model2); this.Content = group; ScaleTransform3D scale = new ScaleTransform3D(); TranslateTransform3D move = new TranslateTransform3D(); TranslateTransform3D move2 = new TranslateTransform3D(); AxisAngleRotation3D rotate = new AxisAngleRotation3D(); AxisAngleRotation3D rotate2 = new AxisAngleRotation3D(); Transform3DGroup t = new Transform3DGroup(); move2.OffsetX = 0; move2.OffsetY = -1.7; double factor = .012; move.OffsetX = (1 / factor) * _Point.X; move.OffsetZ = 1; move.OffsetY = -(1 / factor) * _Point.Y; rotate.Axis = new Vector3D(1, 0, 0); rotate.Angle = 270; rotate2.Axis = new Vector3D(0, 0, 1); rotate2.Angle = 45; scale.ScaleX = factor; scale.ScaleY = factor; scale.ScaleZ = factor; t.Children.Add(new RotateTransform3D(rotate2)); t.Children.Add(move); t.Children.Add(scale); t.Children.Add(move2); t.Children.Add(new RotateTransform3D(rotate)); this.Transform = t; }
private void Init() { MeshGeometry3D m1 = (MeshGeometry3D)Core.Instance.Models["City1"]; MeshGeometry3D m2 = (MeshGeometry3D)Core.Instance.Models["City2"]; DiffuseMaterial material = new DiffuseMaterial(new SolidColorBrush(_Color)); GeometryModel3D model1 = new GeometryModel3D(m1, material); GeometryModel3D model2 = new GeometryModel3D(m2, material); Model3DGroup group = new Model3DGroup(); group.Children.Add(model1); group.Children.Add(model2); this.Content = group; ScaleTransform3D scale = new ScaleTransform3D(); TranslateTransform3D move = new TranslateTransform3D(); TranslateTransform3D move2 = new TranslateTransform3D(); AxisAngleRotation3D rotate = new AxisAngleRotation3D(); AxisAngleRotation3D rotate2 = new AxisAngleRotation3D(); Transform3DGroup t = new Transform3DGroup(); move2.OffsetX = 0; move2.OffsetY = -1.7; move.OffsetX = _Point.X - 2; move.OffsetZ = _Point.Y; move.OffsetY = 0; rotate.Axis = new Vector3D(1, 0, 0); rotate.Angle = 270; rotate2.Axis = new Vector3D(0, 0, 1); rotate2.Angle = 45; double scaleFactor = 35; scale.ScaleX = scaleFactor; scale.ScaleY = scaleFactor; scale.ScaleZ = scaleFactor; t.Children.Add(scale); t.Children.Add(move); this.Transform = t; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myViewport = ((System.Windows.Controls.Viewport3D)(target)); return; case 2: this.topModelVisual3D = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 3: this.myAngleRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
public Cover(string imagePath, int pos) { this.pos = pos; imageSource = LoadImageSource(imagePath); modelGroup = new Model3DGroup(); modelGroup.Children.Add(new GeometryModel3D(Tessellate(), LoadImage(imageSource))); modelGroup.Children.Add(new GeometryModel3D(TessellateMirror(), LoadImageMirror(imageSource))); rotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), RotationAngle(0)); translation = new TranslateTransform3D(TranslationX(0), 0, TranslationZ(0)); var transformGroup = new Transform3DGroup(); transformGroup.Children.Add(new RotateTransform3D(rotation)); transformGroup.Children.Add(translation); modelGroup.Transform = transformGroup; Content = modelGroup; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.AboutY = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 2: this.House = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 3: this.Roof = ((System.Windows.Media.Media3D.GeometryModel3D)(target)); return; } this._contentLoaded = true; }
/// <summary/> protected override void BeginTransition(TransitionEventArgs e) { AddFrontSnapshot(e); var viewport = AddViewport3D(e); var panel = (TransitionPanel)e.Source; var cloneBrush = ToBrush(e.BackSnapshot); Size size = panel.RenderSize; MeshGeometry3D leftDoor = CreateMesh(new Point3D(), new Vector3D(size.Width / 2, 0, 0), new Vector3D(0, size.Height, 0), 1, 1, new Rect(0, 0, 0.5, 1)); GeometryModel3D leftDoorGeometry = new GeometryModel3D(); leftDoorGeometry.Geometry = leftDoor; leftDoorGeometry.Material = new DiffuseMaterial(cloneBrush); AxisAngleRotation3D leftRotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0); leftDoorGeometry.Transform = new RotateTransform3D(leftRotation); GeometryModel3D rightDoorGeometry = new GeometryModel3D(); MeshGeometry3D rightDoor = CreateMesh(new Point3D(size.Width / 2, 0, 0), new Vector3D(size.Width / 2, 0, 0), new Vector3D(0, size.Height, 0), 1, 1, new Rect(0.5, 0, 0.5, 1)); rightDoorGeometry.Geometry = rightDoor; rightDoorGeometry.Material = new DiffuseMaterial(cloneBrush); AxisAngleRotation3D rightRotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0); rightDoorGeometry.Transform = new RotateTransform3D(rightRotation, size.Width, 0, 0); Model3DGroup doors = new Model3DGroup(); doors.Children.Add(leftDoorGeometry); doors.Children.Add(rightDoorGeometry); ModelVisual3D model = new ModelVisual3D(); model.Content = doors; viewport.Children.Add(model); AddAnimation(e, leftRotation, AxisAngleRotation3D.AngleProperty, 90 - 0.5 * FieldOfView); AddAnimation(e, rightRotation, AxisAngleRotation3D.AngleProperty, -(90 - 0.5 * FieldOfView)); AddAnimation(e, cloneBrush, Brush.OpacityProperty, 0); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 24 "..\..\..\..\Page\Page_Test.xaml" ((System.Windows.Controls.Grid)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Grid_MouseDown); #line default #line hidden return; case 2: this.aar = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.viewport3D = ((System.Windows.Controls.Viewport3D)(target)); #line 10 "..\..\MainWindow.xaml" this.viewport3D.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.viewport3D_MouseUp); #line default #line hidden #line 10 "..\..\MainWindow.xaml" this.viewport3D.MouseMove += new System.Windows.Input.MouseEventHandler(this.viewport3D_MouseMove); #line default #line hidden #line 10 "..\..\MainWindow.xaml" this.viewport3D.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.viewport3D_MouseDown); #line default #line hidden #line 11 "..\..\MainWindow.xaml" this.viewport3D.MouseWheel += new System.Windows.Input.MouseWheelEventHandler(this.viewport3D_MouseWheel); #line default #line hidden return; case 2: this.camera = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 3: this.axisAngle = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myRoot = ((IdentityMine.Avalon.Controls.Rotater3DTransition)(target)); #line 6 "..\..\Rotater3DTransition.xaml" this.myRoot.Loaded += new System.Windows.RoutedEventHandler(this.OnLoaded); #line default #line hidden return; case 2: #line 11 "..\..\Rotater3DTransition.xaml" ((System.Windows.Media.Animation.Storyboard)(target)).CurrentStateInvalidated += new System.EventHandler(this.OnRotateStoryboard); #line default #line hidden return; case 3: this.myViewport3D = ((System.Windows.Controls.Viewport3D)(target)); return; case 4: this.MainScale = ((System.Windows.Media.Media3D.ScaleTransform3D)(target)); return; case 5: this.MainRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 6: this.MainTranslate = ((System.Windows.Media.Media3D.TranslateTransform3D)(target)); return; } this._contentLoaded = true; }
protected void Update() { ClearModels(); if (dataPoints != null) { double spaceToUseY = 5; double spaceToUseX = 5; double barWidth = spaceToUseX / dataPoints.Count; double largestValue = GetLargestValue(); double unitHeight = spaceToUseY / largestValue; double bottom = -spaceToUseY; double left = -spaceToUseX; double height; int nIndex = 0; foreach (NameValuePair nvp in dataPoints) { height = (nvp.Value * unitHeight); Color col = columnColors[nIndex % columnColors.Count]; Model3D column = CreateColumn(left, bottom, height, barWidth, 0, barWidth, col); ModelVisual3D model = new ModelVisual3D(); model.Content = column; main.Children.Add(model); AxisAngleRotation3D angleRot = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0); RotateTransform3D rot = new RotateTransform3D(angleRot, new Point3D(-spaceToUseX + (spaceToUseX / 2), 0, -(barWidth / 2))); Binding rotBind = new Binding("Value"); rotBind.Source = rotateSlider; BindingOperations.SetBinding(angleRot, AxisAngleRotation3D.AngleProperty, rotBind); model.Transform = rot; left += barWidth; nIndex++; } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.viewport = ((System.Windows.Controls.Viewport3D)(target)); return; case 2: this.camera = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 3: this.ringVisual = ((System.Windows.Media.Media3D.ModelUIElement3D)(target)); #line 16 "..\..\HitTesting.xaml" this.ringVisual.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.ringVisual_MouseDown); #line default #line hidden return; case 4: this.Scene = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 5: this.ringModel = ((System.Windows.Media.Media3D.GeometryModel3D)(target)); return; case 6: this.ringMesh = ((System.Windows.Media.Media3D.MeshGeometry3D)(target)); return; case 7: this.axisRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.x_transition = ((System.Windows.Controls.TextBox)(target)); return; case 2: this.y_transition = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.z_transition = ((System.Windows.Controls.TextBox)(target)); return; case 4: this.move = ((System.Windows.Controls.Button)(target)); #line 24 "..\..\MainWindow.xaml" this.move.Click += new System.Windows.RoutedEventHandler(this.move_Click); #line default #line hidden return; case 5: this.cube = ((System.Windows.Media.Media3D.GeometryModel3D)(target)); return; case 6: this.rotate = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 7: this.slider = ((System.Windows.Controls.Slider)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\MainWindow.xaml" ((_3dMon.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.Canvas = ((System.Windows.Controls.Canvas)(target)); return; case 3: this.BG = ((System.Windows.Controls.Image)(target)); return; case 4: this.View = ((System.Windows.Controls.Viewport3D)(target)); return; case 5: this.Camera = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 6: this.Cube = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 7: this.rotate = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myViewport3D = ((System.Windows.Controls.Viewport3D)(target)); return; case 2: this.myScale = ((System.Windows.Media.Media3D.ScaleTransform3D)(target)); return; case 3: this.myRotate = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 4: this.myRotate2 = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
//Create a rotation transformation about the specified axis by the specified number of degrees anti-clockwise: public static RotateTransform3D makeAxisTransform(Axis axis, double angle) { RotateTransform3D myRotateTransform3D = new RotateTransform3D(); AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D(); switch (axis) { case Axis.X: myAxisAngleRotation3d.Axis = new Vector3D(1, 0, 0); break; case Axis.Y: myAxisAngleRotation3d.Axis = new Vector3D(0, 1, 0); break; case Axis.Z: myAxisAngleRotation3d.Axis = new Vector3D(0, 0, 1); break; default: throw new ArgumentException("Cannot rotate about unrecognised axis. ", "axis"); } myAxisAngleRotation3d.Angle = angle; //rotate anticlockwise by the specified angle myRotateTransform3D.Rotation = myAxisAngleRotation3d; return myRotateTransform3D; }
private void Init() { MeshGeometry3D m1 = (MeshGeometry3D)Core.Instance.Models["Ship1"]; MeshGeometry3D m2 = (MeshGeometry3D)Core.Instance.Models["Ship2"]; SolidColorBrush b = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)); DiffuseMaterial material = new DiffuseMaterial(b); GeometryModel3D model1 = new GeometryModel3D(m1, material); GeometryModel3D model2 = new GeometryModel3D(m2, material); Model3DGroup group = new Model3DGroup(); group.Children.Add(model1); group.Children.Add(model2); this.Content = group; ScaleTransform3D scale = new ScaleTransform3D(); TranslateTransform3D move = new TranslateTransform3D(); AxisAngleRotation3D rotate = new AxisAngleRotation3D(); AxisAngleRotation3D rotate2 = new AxisAngleRotation3D(); Transform3DGroup t = new Transform3DGroup(); double angle = 0; double factor = 25; scale.ScaleZ = factor; scale.ScaleY = factor; scale.ScaleX = factor; move.OffsetX = _Point.X; move.OffsetZ = _Point.Y; move.OffsetY = 0; rotate.Axis = new Vector3D(0, 1, 0); rotate.Angle = angle; t.Children.Add(scale); t.Children.Add(new RotateTransform3D(rotate)); t.Children.Add(move); t.Children.Add(_Move); this.Transform = t; }
public Cover(ImageInfo info, int coverPos, int currentPos, ModelVisual3D model) { pos = coverPos; imageName = new FileInfo(info.Path).Name; visualModel = model; imageSource = LoadImageSource(info); modelGroup = new Model3DGroup(); modelGroup.Children.Add(new GeometryModel3D(Tessellate(), LoadImage(imageSource))); modelGroup.Children.Add(new GeometryModel3D(TessellateMirror(), LoadImageMirror(imageSource))); rotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), RotationAngle(currentPos)); translation = new TranslateTransform3D(TranslationX(currentPos), 0, TranslationZ(currentPos)); var transformGroup = new Transform3DGroup(); transformGroup.Children.Add(new RotateTransform3D(rotation)); transformGroup.Children.Add(translation); modelGroup.Transform = transformGroup; Content = modelGroup; visualModel.Children.Add(this); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.XRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 2: this.YRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 3: this.ZRotation = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 4: this.CubeMaterial = ((System.Windows.Media.Media3D.DiffuseMaterial)(target)); return; case 5: this.XRotation2 = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 6: this.YRotation2 = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 7: this.ZRotation2 = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 8: this.CubeMaterial2 = ((System.Windows.Media.Media3D.DiffuseMaterial)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.viewport3D1 = ((System.Windows.Controls.Viewport3D)(target)); return; case 2: this.camMain = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 3: this.dirLightMain = ((System.Windows.Media.Media3D.DirectionalLight)(target)); return; case 4: this.MyModel = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 5: this.meshMain = ((System.Windows.Media.Media3D.MeshGeometry3D)(target)); return; case 6: this.matDiffuseMain = ((System.Windows.Media.Media3D.DiffuseMaterial)(target)); return; case 7: this.rotate = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 8: this.slider1 = ((System.Windows.Controls.Slider)(target)); return; } this._contentLoaded = true; }
/// <summary> /// /// </summary> /// <param name="info"></param> /// <param name="coverPos"></param> /// <param name="currentPos"></param> /// <param name="model"></param> public Cover(ImageInfo info, int coverPos, int currentPos, ModelVisual3D model) { pos = coverPos; try { imageName = new FileInfo(info.Path).Name; } catch(Exception) { imageName = new FileInfo("/Media/Imagenes/noimage.png").Name; } visualModel = model; try { imageSource = LoadImageSource(info); } catch (Exception) { ImageInfo im = new ImageInfo(Environment.MachineName, System.Configuration.ConfigurationManager.AppSettings["noimage"], "", "", 0,0,""); imageSource = LoadImageSource(im); } modelGroup = new Model3DGroup(); modelGroup.Children.Add(new GeometryModel3D(Tessellate(), LoadImage(imageSource))); modelGroup.Children.Add(new GeometryModel3D(TessellateMirror(), LoadImageMirror(imageSource))); rotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), RotationAngle(currentPos)); translation = new TranslateTransform3D(TranslationX(currentPos), 0, TranslationZ(currentPos)); var transformGroup = new Transform3DGroup(); transformGroup.Children.Add(new RotateTransform3D(rotation)); transformGroup.Children.Add(translation); modelGroup.Transform = transformGroup; Content = modelGroup; visualModel.Children.Add(this); }
private DoubleAnimation Rotate(int face, double angle, double animationTime = 200) { Vector3D axis = RotationAxis[face]; DoubleAnimation result = null; // we must update the array that contains the position of each cubelet var rotatedCubelets = new Model3DGroup[Size, Size, Size]; for (int i = 0; i < Size; i++) for (int j = 0; j < Size; j++) for (int k = 0; k < Size; k++) rotatedCubelets[i, j, k] = cubelets[i, j, k]; // positive angle is turning clockwise // turning face 0: (fix,*,*) // 2,0 2,1 2,2 2,2 1,2 0,2 // 1,0 1,1 1,2 => 2,1 1,1 0,1 // 0,0 0,1 0,2 2,0 1,0 0,0 // if angle is negative we need to rotate // the cubelets the other way int n = Size - 1; // this method only supports rotating the outer sides of the cube for (int a = 0; a < Size; a++) { for (int b = 0; b < Size; b++) { int at = b; int bt = n - a; if (angle < 0) { at = n - b; bt = a; } Model3DGroup group = null; switch (face) { case 0: group = rotatedCubelets[0, at, bt] = cubelets[0, a, b]; break; case 1: group = rotatedCubelets[n, bt, at] = cubelets[n, b, a]; break; case 2: group = rotatedCubelets[bt, 0, at] = cubelets[b, 0, a]; break; case 3: group = rotatedCubelets[at, n, bt] = cubelets[a, n, b]; break; case 4: group = rotatedCubelets[at, bt, 0] = cubelets[a, b, 0]; break; case 5: group = rotatedCubelets[bt, at, n] = cubelets[b, a, n]; break; default: continue; } var rot = new AxisAngleRotation3D { Axis = axis }; var anim = new DoubleAnimation(angle, new Duration(TimeSpan.FromMilliseconds(animationTime))) { AccelerationRatio = 0.3, DecelerationRatio = 0.5 }; rot.BeginAnimation(AxisAngleRotation3D.AngleProperty, anim); if (result == null) result = anim; var rott = new RotateTransform3D(rot); var gt = new Transform3DGroup(); gt.Children.Add(group.Transform); gt.Children.Add(rott); group.Transform = gt; } } cubelets = rotatedCubelets; // can subscribe to the Completed event on this return result; }
private void RotateCamera(Point currentPosition) { Vector3D camZ = _camera.LookDirection; camZ.Normalize(); Vector3D camX = -Vector3D.CrossProduct(camZ, _camera.UpDirection); camX.Normalize(); Vector3D camY = Vector3D.CrossProduct(camZ, camX); camY.Normalize(); double dX = currentPosition.X - _previousPosition2D.X; double dY = currentPosition.Y - _previousPosition2D.Y; dX *= _rotateScale; dY *= -_rotateScale; AxisAngleRotation3D aarY = new AxisAngleRotation3D(camY, dX); AxisAngleRotation3D aarX = new AxisAngleRotation3D(camX, dY); RotateTransform3D rotY = new RotateTransform3D(aarY); RotateTransform3D rotX = new RotateTransform3D(aarX); camZ = camZ * rotY.Value * rotX.Value; camZ.Normalize(); camY = camY * rotX.Value * rotY.Value; camY.Normalize(); _camera.LookDirection = camZ; _camera.UpDirection = camY; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MainGrid = ((System.Windows.Controls.Grid)(target)); return; case 2: #line 30 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.CreateCustom3D); #line default #line hidden return; case 3: #line 33 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.RectCreate); #line default #line hidden return; case 4: #line 34 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.TriangleCreate); #line default #line hidden return; case 5: #line 35 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.CircleCreate); #line default #line hidden return; case 6: this.ligthsComboBox = ((System.Windows.Controls.ComboBox)(target)); return; case 7: this.drl = ((System.Windows.Controls.ComboBoxItem)(target)); #line 39 "..\..\MainWindow.xaml" this.drl.Selected += new System.Windows.RoutedEventHandler(this.LightSelected); #line default #line hidden return; case 8: this.aml = ((System.Windows.Controls.ComboBoxItem)(target)); #line 40 "..\..\MainWindow.xaml" this.aml.Selected += new System.Windows.RoutedEventHandler(this.LightSelected); #line default #line hidden return; case 9: this.ptl = ((System.Windows.Controls.ComboBoxItem)(target)); #line 41 "..\..\MainWindow.xaml" this.ptl.Selected += new System.Windows.RoutedEventHandler(this.LightSelected); #line default #line hidden return; case 10: this.spl = ((System.Windows.Controls.ComboBoxItem)(target)); #line 42 "..\..\MainWindow.xaml" this.spl.Selected += new System.Windows.RoutedEventHandler(this.LightSelected); #line default #line hidden return; case 11: this.cameraBoxer = ((System.Windows.Controls.ComboBox)(target)); return; case 12: this.pers = ((System.Windows.Controls.ComboBoxItem)(target)); #line 46 "..\..\MainWindow.xaml" this.pers.Selected += new System.Windows.RoutedEventHandler(this.CameraSelected); #line default #line hidden return; case 13: this.orth = ((System.Windows.Controls.ComboBoxItem)(target)); #line 47 "..\..\MainWindow.xaml" this.orth.Selected += new System.Windows.RoutedEventHandler(this.CameraSelected); #line default #line hidden return; case 14: this.DB_Enter_Button = ((System.Windows.Controls.MenuItem)(target)); #line 49 "..\..\MainWindow.xaml" this.DB_Enter_Button.Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click); #line default #line hidden return; case 15: this.mainViewport = ((System.Windows.Controls.Viewport3D)(target)); return; case 16: this.perspectiveCameraEditor = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 17: this.LightGroup = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 18: this.Figures = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 19: this.Figures3D = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 20: this.transformGroup = ((System.Windows.Media.Media3D.Transform3DGroup)(target)); return; case 21: this.figureRotateTransformationX = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 22: this.figureRotateTransformationY = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 23: this.figureRotateTransformationZ = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 24: this.osLines = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 25: this.OsXMaterial = ((System.Windows.Media.Media3D.DiffuseMaterial)(target)); return; case 26: this.OsYMaterial = ((System.Windows.Media.Media3D.DiffuseMaterial)(target)); return; case 27: this.OsZMaterial = ((System.Windows.Media.Media3D.DiffuseMaterial)(target)); return; case 28: this.gridSliderX = ((System.Windows.Controls.Slider)(target)); return; case 29: this.gridSliderY = ((System.Windows.Controls.Slider)(target)); return; case 30: this.gridSliderZ = ((System.Windows.Controls.Slider)(target)); return; case 31: this.objectSliderX = ((System.Windows.Controls.Slider)(target)); #line 153 "..\..\MainWindow.xaml" this.objectSliderX.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.ObjectSliderValueChanged); #line default #line hidden return; case 32: this.objectSliderY = ((System.Windows.Controls.Slider)(target)); #line 154 "..\..\MainWindow.xaml" this.objectSliderY.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.ObjectSliderValueChanged); #line default #line hidden return; case 33: this.objectSliderZ = ((System.Windows.Controls.Slider)(target)); #line 155 "..\..\MainWindow.xaml" this.objectSliderZ.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.ObjectSliderValueChanged); #line default #line hidden return; case 34: this.FiguresList3D = ((System.Windows.Controls.ComboBox)(target)); #line 159 "..\..\MainWindow.xaml" this.FiguresList3D.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.FiguresList3D_SelectionChanged); #line default #line hidden return; case 35: this.Updater = ((System.Windows.Controls.Button)(target)); #line 161 "..\..\MainWindow.xaml" this.Updater.Click += new System.Windows.RoutedEventHandler(this.UpdateFigure); #line default #line hidden return; case 36: this.Deleter = ((System.Windows.Controls.Button)(target)); #line 162 "..\..\MainWindow.xaml" this.Deleter.Click += new System.Windows.RoutedEventHandler(this.DeleteFigure); #line default #line hidden return; } this._contentLoaded = true; }
private ModelVisual3D MakeSide( ContentPresenter content, Point3D origin, Vector3D u, Vector3D v, double endAngle, Point3D rotationCenter, Vector3D rotationAxis, EventHandler onCompleted) { MeshGeometry3D sideMesh = CreateMesh(origin, u, v, 1, 1, new Rect(0, 0, 1, 1)); GeometryModel3D sideModel = new GeometryModel3D(); sideModel.Geometry = sideMesh; Brush clone = CreateBrush(content); sideModel.Material = new DiffuseMaterial(clone); AxisAngleRotation3D rotation = new AxisAngleRotation3D(rotationAxis, 0); sideModel.Transform = new RotateTransform3D(rotation, rotationCenter); DoubleAnimation da = new DoubleAnimation(endAngle, Duration); if (onCompleted != null) da.Completed += onCompleted; rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da); ModelVisual3D side = new ModelVisual3D(); side.Content = sideModel; return side; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); #line 110 "..\..\MainWindow.xaml" this.LayoutRoot.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.LayoutRootMouseLeft); #line default #line hidden return; case 2: this.Title = ((System.Windows.Controls.TextBlock)(target)); return; case 3: this.BtnMinimize = ((System.Windows.Controls.Button)(target)); #line 116 "..\..\MainWindow.xaml" this.BtnMinimize.Click += new System.Windows.RoutedEventHandler(this.BtnMinimize_Click); #line default #line hidden return; case 4: this.BtnMaximize = ((System.Windows.Controls.Button)(target)); #line 118 "..\..\MainWindow.xaml" this.BtnMaximize.Click += new System.Windows.RoutedEventHandler(this.BtnMaximize_Click); #line default #line hidden return; case 5: this.BtnClose = ((System.Windows.Controls.Button)(target)); #line 120 "..\..\MainWindow.xaml" this.BtnClose.Click += new System.Windows.RoutedEventHandler(this.BtnClose_Click); #line default #line hidden return; case 6: this.ListTasks = ((System.Windows.Controls.ItemsControl)(target)); return; case 8: this.clearContent = ((System.Windows.Controls.Button)(target)); return; case 9: this.Viewport = ((HelixToolkit.Wpf.HelixViewport3D)(target)); return; case 10: this.Models = ((System.Windows.Media.Media3D.ModelVisual3D)(target)); return; case 11: this.Z = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; case 12: this.ControlPanel = ((System.Windows.Controls.Grid)(target)); return; case 13: this.load = ((System.Windows.Controls.Button)(target)); #line 186 "..\..\MainWindow.xaml" this.load.Click += new System.Windows.RoutedEventHandler(this.BtnLoad_Click); #line default #line hidden return; case 14: this.clear = ((System.Windows.Controls.Button)(target)); #line 187 "..\..\MainWindow.xaml" this.clear.Click += new System.Windows.RoutedEventHandler(this.BtnClear_Click); #line default #line hidden return; case 15: this.minZ = ((System.Windows.Controls.Slider)(target)); return; case 16: this.maxZ = ((System.Windows.Controls.Slider)(target)); return; case 17: this.start = ((System.Windows.Controls.Button)(target)); #line 196 "..\..\MainWindow.xaml" this.start.Click += new System.Windows.RoutedEventHandler(this.BtnStart_Click); #line default #line hidden return; case 18: this.stop = ((System.Windows.Controls.Button)(target)); #line 197 "..\..\MainWindow.xaml" this.stop.Click += new System.Windows.RoutedEventHandler(this.BtnStop_Click); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 5 "..\..\..\MainWindow.xaml" ((WpfApplication1.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.mainmenu = ((System.Windows.Controls.Grid)(target)); return; case 3: this.Yaw = ((System.Windows.Controls.Slider)(target)); #line 27 "..\..\..\MainWindow.xaml" this.Yaw.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider1_ValueChanged); #line default #line hidden return; case 4: this.Pitch = ((System.Windows.Controls.Slider)(target)); #line 28 "..\..\..\MainWindow.xaml" this.Pitch.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider2_ValueChanged); #line default #line hidden return; case 5: this.Roll = ((System.Windows.Controls.Slider)(target)); #line 29 "..\..\..\MainWindow.xaml" this.Roll.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider3_ValueChanged); #line default #line hidden return; case 6: this.label1 = ((System.Windows.Controls.Label)(target)); return; case 7: this.label2 = ((System.Windows.Controls.Label)(target)); return; case 8: this.label3 = ((System.Windows.Controls.Label)(target)); return; case 9: this.chartbox = ((System.Windows.Controls.GroupBox)(target)); return; case 10: this.display = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target)); return; case 11: this.test = ((System.Windows.Controls.Viewport3D)(target)); return; case 12: this.MyCamera = ((System.Windows.Media.Media3D.PerspectiveCamera)(target)); return; case 13: this.my = ((System.Windows.Media.Media3D.Model3DGroup)(target)); return; case 14: this.rotate = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\CalendarDay.xaml" ((WeatherCalendar.CalendarDay)(target)).Loaded += new System.Windows.RoutedEventHandler(this.CalendarDay_OnLoaded); #line default #line hidden return; case 2: #line 53 "..\..\CalendarDay.xaml" ((System.Windows.Controls.Border)(target)).MouseEnter += new System.Windows.Input.MouseEventHandler(this.UIElement_OnMouseEnter); #line default #line hidden #line 53 "..\..\CalendarDay.xaml" ((System.Windows.Controls.Border)(target)).MouseLeave += new System.Windows.Input.MouseEventHandler(this.UIElement_OnMouseLeave); #line default #line hidden return; case 3: this.border = ((System.Windows.Controls.Border)(target)); #line 102 "..\..\CalendarDay.xaml" this.border.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.Border_OnMouseLeftButtonUp); #line default #line hidden return; case 4: #line 105 "..\..\CalendarDay.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SetNotesMenuItem_OnClick); #line default #line hidden return; case 5: #line 106 "..\..\CalendarDay.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.RestHolidayMenuItem_OnClick); #line default #line hidden return; case 6: #line 107 "..\..\CalendarDay.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.HolidayMenuItem_OnClick); #line default #line hidden return; case 7: #line 108 "..\..\CalendarDay.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChineseHolidayMenuItem_OnClick); #line default #line hidden return; case 8: this.aar = ((System.Windows.Media.Media3D.AxisAngleRotation3D)(target)); return; } this._contentLoaded = true; }