Home > Software engineering >  VB drawing problems, seek help from god
VB drawing problems, seek help from god

Time:09-27

Under the PictureBox to draw two lines form a first Angle, in which to draw a circle, but always can't wrapped in Angle, feel no problem ah algorithm theory, please god to see

CodePudding user response:

It doesn't need to see, to check your calculation...

CodePudding user response:

Calculate correctly sent several pixels, this can be

CodePudding user response:

Remind: trigonometric function units is radian Angle instead of degrees,

CodePudding user response:

Feeling is a junior high school don't pass the appearance of analytic geometry.

CodePudding user response:


The code is for reference only
 Option Explicit 

'Angle of vertex
Const ox As Single=200
Const oy As Single=2400
'PI=3.1415926...
Dim PI As Double
Angle
'Dim Angle As Double
'circle
Cx As Single Dim
Dim cy As Single
'radius
Dim cr As Single

Private Sub Form_Load ()
Randomize
PI=Atn (1) * 4
Do
Angle=(PI/2) * Rnd
Loop Until Tan (Angle) & gt; Cx - ox (oy - cy)/()
Cx=2400
Cy=1600
Dim tana As Double, tanb As Double, tanc As Double
Tana=Tan (Angle)
Tanb=(oy - cy)/cx - (ox)
Tanc=(tana - tanb)/(1 + tana * tanb)
Dim sinc the As a Double
Sinc=Sqr (tanc ^ 2/(tanc ^ 2 + 1))
Dim d As Single
D=sinc * (Sqr (cx - (ox) ^ 2 + (cy - oy) ^ 2))
Cr=IIf (d & lt; Oy - cy, d, oy - cy)
Me. The Line (ox, oy) - (OS x + Me. ScaleWidth, oy)
Me. The Line (ox, oy) - (OS x + Me. ScaleWidth * Cos (Angle), oy - Me. ScaleWidth * Sin (Angle))
Cx, Me. PSet (cy)
Cx, Me. Circle (cy), cr
End Sub
  • Related