Matrix Transforms: Rotation : Matrix « Windows Presentation Foundation « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Windows Presentation Foundation » MatrixScreenshots 
Matrix Transforms: Rotation
 

<Window x:Class="WpfApplication1.MatrixTransforms"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Matrix Transforms" Height="450" Width="270">
  <StackPanel>
    <TextBlock Margin="10,10,5,5" Text="Original Matrix:" />
    <TextBlock Name="tbOriginal" Margin="20,0,5,5" />
    <TextBlock Margin="10,0,5,5" Text="Rotation:" />
    <TextBlock Name="tbRotate" Margin="20,0,5,5" TextWrapping="Wrap" />


  </StackPanel>
</Window>
//File:Window.xaml.vb

Imports System
Imports System.Windows
Imports System.Windows.Media


Namespace WpfApplication1
  Public Partial Class MatrixTransforms
    Inherits Window
    Public Sub New()
      ' Original matrix: 
      Dim As New Matrix(123401)
      tbOriginal.Text = "(" & m.ToString() ")"

      'Rotation: 
      m = New Matrix(123401)
      m.Rotate(45)
      tbRotate.Text = "(" & MatrixRound(m).ToString() ")"
    End Sub
    Private Function MatrixRound(As MatrixAs Matrix
      m.M11 = Math.Round(m.M11, 3)
      m.M12 = Math.Round(m.M12, 3)
      m.M21 = Math.Round(m.M21, 3)
      m.M22 = Math.Round(m.M22, 3)
      m.OffsetX = Math.Round(m.OffsetX, 3)
      m.OffsetY = Math.Round(m.OffsetY, 3)
      Return m
    End Function
  End Class
End Namespace

   
  
Related examples in the same category
1.Matrix Operations
2.Matrix Transforms: Scale - Prepend
3.Matrix Transforms: ScaleMatrix Transforms: Scale
4.Matrix Transforms: Rotation atMatrix Transforms: Rotation at
5.Matrix Transforms: Skew -Prepend
6.Matrix Transforms: Skew
7.Matrix Transforms: Rotation at (x = 1, y = 2) - Prepend
8.Matrix Transforms: Rotation - Prepend
9.Matrix Transforms: Translation
w___w___w.___ja__va__2s.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.