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
  #1  
Old 09-06-2017, 03:04 AM
pradeep20389 pradeep20389 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 17
Default Rotate graph


i want help in vb 6 coding anyone there?
Reply With Quote
  #2  
Old 09-06-2017, 03:38 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

Lol,

Yes i think enough people are here.
But with what do you need help? you question is not , what i would say, specific.

We don't code for you here, we just help you with a specific coding problem you have.
__________________
As finishing touch, god created the Dutch!

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

Sir I am working on a project that plot a graph on picture box with x and y co ordinates.

That is working fine. But now I want to rotate graph .
So I need help regarding that rotation coding.
Reply With Quote
  #4  
Old 09-06-2017, 04:05 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

You should realy open up an new thread for this question.
Andalso could you post the code you have so far in this new thread?
__________________
As finishing touch, god created the Dutch!

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

Sir , I have code for plot the graph . Can I post the code.
Reply With Quote
  #6  
Old 09-06-2017, 04:26 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

Ofcourse, lets see if we can't help you out.
__________________
As finishing touch, god created the Dutch!

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

If msReading.Rows > 3 Then
x2 = Val(msReading.TextMatrix(2, 0))
y2 = Val(msReading.TextMatrix(2, 1))
Dim i As Double
For i = 3 To msReading.Rows - 1
picGraph.Line (x2, y2)-(Val(msReading.TextMatrix(i, 0)), Val(msReading.TextMatrix(i, 1))), vbBlue


x2 = msReading.TextMatrix(i, 0)
y2 = msReading.TextMatrix(i, 1)
Next
End If
Reply With Quote
  #8  
Old 09-06-2017, 04:49 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

You could use whats called a rotation matrix, to rotate all the points.

See here for an explanation
__________________
As finishing touch, god created the Dutch!

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

Thank you sir for your reply
But how to use cos theta and sin theta for x and y. And if Iwhat is the theta can you explain please
Reply With Quote
  #10  
Old 09-06-2017, 05:02 AM
pradeep20389 pradeep20389 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 17
Default

And if I want to rotate graph to specify starting point. Then how to calculate new points
Reply With Quote
  #11  
Old 09-06-2017, 05:04 AM
pradeep20389 pradeep20389 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 17
Default

eg graph
Attached Images
File Type: png graph.PNG (36.4 KB, 2 views)
Reply With Quote
  #12  
Old 09-06-2017, 05:40 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

Multiply a given point (x,y) with a 2x2 Matrix works as follows.

|X| |A B|
| | * | | = Ax+By,Cx+Dy
|Y| |C D|

So Lets say we want to Rotate a point with lets say 90° (1.57079633 Radians) Results in

|X| |0 1|
| | * | | = 0x+1y,-1x+0y = 1y,-1x
|Y| |-1 0|
__________________
As finishing touch, god created the Dutch!

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

Sir sry but I don't understand
Reply With Quote
  #14  
Old 09-06-2017, 06:03 AM
pradeep20389 pradeep20389 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 17
Default

What are the my new points
Reply With Quote
  #15  
Old 09-06-2017, 06:05 AM
pradeep20389 pradeep20389 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 17
Default

What is a b c and d for one point I have one x and one y coordinates
Reply With Quote
  #16  
Old 09-06-2017, 06:08 AM
pradeep20389 pradeep20389 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 17
Default

If I have coordinates 30,50 after rotation using your formula what are new coordinates.
Reply With Quote
  #17  
Old 09-06-2017, 06:12 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

A B C D are the four variables of the rotation matrix
__________________
As finishing touch, god created the Dutch!

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

Sir please reply for my other post
Reply With Quote
  #19  
Old 09-06-2017, 06:25 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

Ok my vb6 is a bit rusty, but try to understand the following example.

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

Private Const Pi As Double = 3.1415

Private Function RotatePoint(ByRef 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 P As Point
    P.X = 2
    P.Y = 2
    
    Call RotatePoint(P, 90)
End Sub
__________________
As finishing touch, god created the Dutch!

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

Thanks sir for your reply I will try it but can I run it on msflexgird . Means I want all the points to change regarding the rotation. Msflexgird first column has x coordinates and second column has y coordinates.
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
 
-->