Hey guys
I have a problem with math rather than vb.
My aim is to imitate the hand of a clock i.e. rotate a line from a fixed point.
I thought it was easy trigonometry but Im really really tired and I cant figure it out so after I searched google with no success I decided to ask along.
Here is what I managed yet:
PS: Its in a kinda mess cause its just whats coming in my mind at that instance. What I want is to change the angle from 0 to 360 (Cos) and get the coords of the line.Code:Public Class Form1 Dim Pt1 As Point = New Point(100, 100) Dim Pt2 As Point = New Point(100, 75) Dim Pt3 As Point = New Point(125, 100) Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint e.Graphics.FillEllipse(Brushes.White, 75, 75, 50, 50) e.Graphics.DrawEllipse(Pens.Black, 75, 75, 50, 50) e.Graphics.DrawLine(Pens.Black, Pt1, Pt2) 'Variable triangle e.Graphics.DrawLine(Pens.Black, Pt1, Vary(90)) End Sub Private Function Vary(ByVal variable As Integer) As Point Dim height As Integer = 0 Dim Rads As Integer = (variable / 180) * 3.146 height = 25 * Math.Sin(Rads) Dim tmpPt As Point = New Point(100 - height, 100 + height) Return tmpPt End Function End Class
Thanks in advance,
Skate





Reply With Quote