Rotate graph
Rotate graph
Rotate graph
Rotate graph
Rotate graph
Rotate graph Rotate graph Rotate graph Rotate graph Rotate graph Rotate graph Rotate graph Rotate graph
Rotate graph Rotate graph
Rotate graph
Go Back  Xtreme Visual Basic Talk > > > Rotate graph


Reply
 
Thread Tools Display Modes
  #21  
Old 09-06-2017, 06:17 AM
pradeep20389 pradeep20389 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 17
Default


Sir I tried your code but it will give both the value same in result
Reply With Quote
  #22  
Old 09-06-2017, 06:23 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

what do you mean?
__________________
As finishing touch, god created the Dutch!

utterly useless, but always trying to help
Reply With Quote
  #23  
Old 09-06-2017, 06:31 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

Code:
Private Type Point
    X As Double
    Y As Double
End Type

Private Const Pi As Double = 3.1415

Private Function RotatePoint(P As Point, AngleInDegrees As Double) As Point
    Dim AngleInRadians As Double
    Dim RotationMatrix(1, 1) As Double
    Dim Result As Point
    
    AngleInRadians = AngleInDegrees * Pi / 180
    RotationMatrix(0, 0) = Math.Cos(AngleInRadians)
    RotationMatrix(0, 1) = -Math.Sin(AngleInRadians)
    RotationMatrix(1, 0) = Math.Sin(AngleInRadians)
    RotationMatrix(1, 1) = Math.Cos(AngleInRadians)
    
    Result.X = P.X * RotationMatrix(0, 0) + P.Y * RotationMatrix(0, 1)
    Result.Y = P.X * RotationMatrix(1, 0) + P.Y * RotationMatrix(1, 1)
    
    RotatePoint = Result
End Function

Private Sub Form_Load()
    Dim Points(9) As Point
    Dim RotatedPoints(9) As Point
    Dim Index As Integer
    
    For Index = 0 To 9
        Points(Index).X = Index
        Points(Index).Y = Index
        RotatedPoints(Index) = RotatePoint(Points(Index), 90)
        Debug.Print (PointToString(Points(Index)) & " " & PointToString(RotatedPoints(Index)))
    Next
    
    
End Sub

Private Function PointToString(P As Point) As String
    Dim Result As String
    Result = "X: " & P.X & " " & "Y: " & P.Y
    PointToString = Result
End Function
Result:

X: 0 Y: 0 X: 0 Y: 0
X: 1 Y: 1 X: -0,999953672132034 Y: 1,00004632572179
X: 2 Y: 2 X: -1,99990734426407 Y: 2,00009265144359
X: 3 Y: 3 X: -2,9998610163961 Y: 3,00013897716538
X: 4 Y: 4 X: -3,99981468852814 Y: 4,00018530288718
X: 5 Y: 5 X: -4,99976836066017 Y: 5,00023162860897
X: 6 Y: 6 X: -5,9997220327922 Y: 6,00027795433076
X: 7 Y: 7 X: -6,99967570492424 Y: 7,00032428005256
X: 8 Y: 8 X: -7,99962937705627 Y: 8,00037060577435
X: 9 Y: 9 X: -8,99958304918831 Y: 9,00041693149615
__________________
As finishing touch, god created the Dutch!

utterly useless, but always trying to help
Reply With Quote
  #24  
Old 09-06-2017, 06:50 AM
pradeep20389 pradeep20389 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 17
Default

Sir I will try again
Reply With Quote
  #25  
Old 09-06-2017, 08:28 AM
Flyguy's Avatar
FlyguyRotate graph Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,160
Default

Next time start your own thread for asking questions.
Also provide a useful title, describing in short your question.
Reply With Quote
  #26  
Old 09-06-2017, 11:31 PM
pradeep20389 pradeep20389 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 17
Default

Thank you for your reply code is working fine. I have code to calculate angle between 2 points on the graph code is working fine. But I have to show angular line with arrow between that 2 points and move anywhere with mouse move . I have code for normal line can you help me with angular line . And the curve is depending upon angle. I am calculating angle between 3 points so I want curve line between point 1 and point 3 can you help me
Attached Images
File Type: png unnamed.png (4.6 KB, 2 views)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Rotate graph
Rotate graph
Rotate graph Rotate graph
Rotate graph
Rotate graph
Rotate graph Rotate graph Rotate graph Rotate graph Rotate graph Rotate graph Rotate graph
Rotate graph
Rotate graph
 
Rotate graph
Rotate graph
 
-->