|
-
Jul 17th, 2003, 09:02 PM
#1
Thread Starter
Frenzied Member
-
Jul 18th, 2003, 03:12 AM
#2
Thread Starter
Frenzied Member
please help me...any help is apriciated. just something to get me started. not a whole function is not needed.
if you dont know what i want, just ask me!
-
Jul 18th, 2003, 04:11 PM
#3
Fanatic Member
you should label the points instead of mentioning the colors (hard to see).
anywayz i am not sure what is the relationship of (x,y) and (x2,y2) and the angle a (maybe its the angle bisector?)
so i cant help you with x2.
but for the distance d, you first need to find the equation of the line passing through (x2,y2) and the origin (cx,cy). obviously, this line has slope of tan(ca). we have slope and a point, so we have equation. say the equation is Ax+By+c=0
then the distance d from (x,y) to that line is given by the formula:
|Ax+By+c|
-------------
sqrt(A^2+B^2)
Massey RuleZ! ^-^__  Cheers!  __^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!
-
Jul 19th, 2003, 09:24 AM
#4
Thread Starter
Frenzied Member
the origin is allways (0,0), but the (cx,cy) can be changed. the green line is stuck with the origin (0,0).
-
Jul 19th, 2003, 02:19 PM
#5
Thread Starter
Frenzied Member
-
Jul 21st, 2003, 08:23 AM
#6
Ex-Super Mod'rater
for the last Q if I understand you right:
VB Code:
l3 = l * Tan(V)
l2 = Sqr((l^2) + (l3^2))
'Or
l2 = l / Cos(V)
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jul 22nd, 2003, 02:04 AM
#7
Thread Starter
Frenzied Member
thanks alot! finally someone answers me!
-
Jul 22nd, 2003, 06:23 AM
#8
Ex-Super Mod'rater
Originally posted by cyborg
thanks alot! finally someone answers me!
LOL
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jul 22nd, 2003, 11:42 AM
#9
Addicted Member
Electroman,
You might be the man to help me.
I have a program that works out (or rather attempts to!) the angle between two known points, given a fixed datum (similar to the previous bit by cyborg). I've done the code, but it seems that I simply cannot get a true result. Can you point me in the right direction, please (before I start loosing my sanity!)...
[vb]
Private Sub CLOCK_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'This section calculates the relevant time based on the location of the users click on the object, bearing in mind
'that the hour clicked will determine the minutes also. The calculation uses basic trig to work out the time...
'version 2.0
'2.0: The initial version of this was a simple typed entry created many years ago and not used since. The new
' version includes this radically different GUI.
'1.0: Initial version.
'Divide the face into 90° segments & get eh angle to work out the hour, followed by fractional minutes...
Dim sglX As Single
Dim sglY As Single
Dim sglHours As Single
Dim sglLength As Single
Dim sglAngle As Single
Dim sglTotalAngle As Single
Dim sglMinutes As Single
Dim intQuarter As Integer
Dim intPM As Integer
Static intXYQ(3) As Integer
'On Error GoTo CLOCK_MouseDown_Error
'Get the AM/PM setting...
'The user can specify the PM time by either clicking the am/pm button, or by holding down the SHIFT button
'while clicking the time on the clock face.
intPM = Abs(([CMDAMPM].Caption = "pm") Or (Shift And acShiftMask)) * 360 'Get the add on for PM if necessary
[CMDAMPM].Caption = Mid("ampm", (intPM Mod 358) + 1, 2) 'Set the caption for the AM/PM button
'The following array maps bitwise +/- X and Y values to the clock-wise quarters of the clock...
If intXYQ(0) = 0 Then
intXYQ(0) = 4
intXYQ(1) = 3
intXYQ(2) = 1
intXYQ(3) = 2
End If
'Determine which quarter the click was located in...
sglX = X - sglCentre 'Find datum x
sglY = Y - sglCentre 'Find datum y
intQuarter = intXYQ((sglX >= 0 And 2) Or (sglY >= 0 And 1)) 'Get the quarter number
'Now get the time...
sglLength = Sqr(Abs(sglX) ^ 2 + Abs(sglY) ^ 2) 'Get the hypoteneuse
sglAngle = Cos(Abs(sglX) / sglLength) * RadToDeg 'Get the angle
sglTotalAngle = (intQuarter - 1) * 90 + sglAngle + intPM 'Total up the angle
sglHours = sglTotalAngle / 30 '30° in an hour
sglMinutes = (sglHours - Int(sglHours)) * 60 'Get the remaining minutes
'Position the hour hand on the clock...
With [HOUR]
.Height = Abs(sglHourLen * Sin(sglAngle * DegToRad)) 'Get the height of the hour hand
.Width = Abs(sglHourLen * Cos(sglAngle * DegToRad)) 'Get the width of the hour hand
.Left = sglCentre + [CLOCK].Left + (intQuarter Mod 2 <> 0) * .Width 'Set the position based on the quarter clicked
.Top = sglCentre + (sglY < 0) * .Height + [CLOCK].Top 'Set the position based on the quarter clicked
'.LineSlant = (intQuarter Mod 2) <> 0 'Switches the line direction based on the quarter
End With
'Position the minute hand on the clock...
'With [MINUTE]
' .Height = Abs(sglMinuteLen * Sin(sglTotalAngle)) 'Get the height of the minute hand
' .Width = Abs(sglMinuteLen * Cos(sglTotalAngle)) 'Get the width of the minute hand
' .Left = sglCentre + (intQuarter > 2) * .Width 'Set the position based on the quarter clicked
' .Top = sglCentre + (intQuarter = 1 Or intQuarter = 4) * .Height 'Set the position based on the quarter clicked
' .LineSlant = (intQuarter Mod 2) = 0 'Switches the line direction based on the quarter
'End With
End Sub
[/vb]
Thanks,
Paul.
-
Jul 22nd, 2003, 02:54 PM
#10
Ex-Super Mod'rater
I'll give it a go but could you draw a pic of what you mean cos you lost me a bit .
Oh yea and the tags for code are meant to be [ vbcode ] [/ vbcode ] with out the spaces tho
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jul 23rd, 2003, 03:32 AM
#11
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
|