The code is as follows:
Dim Xc As Double center 'definition
Dim Yc As Double
Dim Rstart As Double 'definition actually radian
Dim Rend the As a Double 'define the end arc
Dim PI As Double
PI=3.1415926
Dim X as Double 'define the coordinates of points on the left
Dim as Double Y
Dim Length as Double 'definition is the horizontal distance between two points, also determine the coordinates of the right point
Xc=X + Length/2
Yc=Y - Sqr (Radius - the Radius * Length * Length/4)
Rstart=PI/2 - arcsin (Length/(2 * Radius))
Rend=PI/2 + arcsin (Length/(2 * Radius))
Picture1. Circle (Xc, Yc), Radius, RGB (0, 0, 255), Rstart, Rend
'the arcsine function definition
Private Function arcsin (X) As a Double
Dim PI
PI=3.1415926
If Abs (X)=1 Then
Arcsin=PI/2
The Else
Arcsin=Atn (X/Sqr (-x * X + 1))
End the If
End the Function
CodePudding user response:
Ha ha, oneself give oneself the top, the curve drawn is not smooth, is there any good method? You guide genuflect is begged!CodePudding user response:
Mostly starting Angle and ending Angle wrongSuggest manually verify two Angle, in radians
CodePudding user response:
I'm turning Angle into radian! Feel no wrong,CodePudding user response:
Need not theory is deduced, because the result is straightforward, you try all the Y coordinate adjustment of an offset,Smooth degree, related to the resolution of the display device, when the pixel is very big, coordinates integral produced the error of the human eye can distinguish,
CodePudding user response:
In practice, the way to improve visual perception is generally USES the gray processing, for integer coordinates error after larger point, USES the gray processing, the larger the error, gray level, the more shallow,CodePudding user response:
'in pixel coordinates'
Picture1. The ScaleMode=vbPixels
'as far as possible with the most number of PI'
PI=3.1415926535898
'circle below should be add'
Yc=Y + Sqr (Radius - the Radius * Length * Length/4)
CodePudding user response:
It must be calculated wrong,Many years ago when I was just learning vb clock eyes, directly in the Picturebox picture, much more than this, the problem of finally found all the math problems, a lot of cosine of sin, mathmetics thin, but the last is settled,
The building Lord slowly adjust
CodePudding user response:
Dim Xc As Double center 'definition
Dim Yc As Double
Dim Rstart As Double 'starting point defined radian
Dim Rend the As a Double 'define the end arc
Dim PI As Double
Dim X As Double 'define the coordinates of points on the left
Dim As Double Y
Dim Length As Double 'definition is the horizontal distance between two points, also determine the coordinates of the right point
'the arcsine function definition
Private Function arcsin (X As Double) As a Double
PI=3.14159265
If Abs (X)=1 Then
Arcsin=PI/2
The Else
Arcsin=Atn (X/Sqr (-x * X + 1))
End the If
End the Function
Private Sub Command1_Click ()
PI=3.14159265
Picture1. ScaleMode=3 'Pixel
X=100
Y=100
Picture1. Circle (X, Y), 4, RGB (0, 0, 0)
Length=200
Picture1. Circle (+ Length X, Y), 4, RGB (0, 0, 0)
The Radius=Length/2 + 10
Xc=X + Length/2
Yc=Y - Sqr (Radius - the Radius * Length * Length/4)
Rstart=3 * PI/2 - arcsin (Length/(2 * Radius))
Rend=3 * PI/2 + arcsin (Length/(2 * Radius))
Picture1. Circle (Xc, Yc), Radius, RGB (255, 0, 0)
Picture1. Circle (Xc, Yc), Radius, RGB (0, 0, 255), Rstart, Rend
End Sub