|
-
Nov 16th, 2001, 10:08 PM
#1
Thread Starter
Lively Member
location in a circle
I am writing a program to do single plane balancing using the vector method. I am trying to compare two locations in a circle. An initial and a trial location. What I need to do is, compare the relationship between the two and decide which way from the trial location is. If the initial location is at 90. 270 is 180 from it. And if the trial would fall on 260 it would be CW, 280 would be CCW. Which ever way the trial goes, it will never be more than 180 from the initial location. Is there an easy way to test the user inputs? I put this in the maths forum, but no is in there.
-
Nov 17th, 2001, 02:06 AM
#2
Hyperactive Member
***???? Okay, I might not be the brightest beacon in the harbour, but I don't understand what your asking. Could you please rephrase the question, and I'll try and answer it. thanks 
SD
"I'd rather have a full bottle in front of me than a full frontal lobotomy!"
-
Nov 17th, 2001, 02:43 AM
#3
Conquistador
don't put everything on oneline either it makes it harder to read, why don't you separate it out and explain what variables the user has to enter etc?
see...
-
Nov 17th, 2001, 03:22 AM
#4
PowerPoster
LOL SD.. i think i get what he means. CW would be clockwise and CCW counter clockwise. If the entered details are simply angles on a circle then it is pretty easy. It can be a little more complicated if the different positions are given by x,y coordinates but is still basically the same process.
VB Code:
Private Sub Command1_Click()
Dim Difference As Double
Dim Angle1 As Double 'These are degree angles
Dim Angle2 As Double 'Use Angle * pi / 180 for radians
Dim Direction As String
Angle1 = Text1
Angle2 = Text2
Difference = Angle2 - Angle1
If Difference > 180 Then
Difference = 360 - Angle2 + Angle1
Direction = "Counter Clockwise"
ElseIf Difference < -180 Then
Difference = 360 - Angle1 + Angle2
Direction = "Clockwise"
ElseIf Difference < 0 Then
Difference = Angle1 - Angle2
Direction = "Counter Clockwise"
Else
Direction = "Clockwise"
End If
Debug.Print Direction, Difference
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|