You want to draw a sine curve that is angled?
Printable View
You want to draw a sine curve that is angled?
Yep!
I would like to draw a curved line that is angled.
It should work for angles from 1 to 360
I did this one using guv's safe arctan that you can get here:Code:Const deg2rad = 1.74527777777778E-02
offsetx = ScaleWidth \ 2
offsety = ScaleHeight \ 2
amplitude = ScaleWidth \ 8
frequency = 0.01
phi = 120 * deg2rad 'to convert degree to radians, multiply with pi/180
length = 1000
centerx = ScaleWidth \ 2
centery = ScaleHeight \ 2
For pixelx = 0 To length
Y = offsety + Sin(pixelx * frequency) * amplitude
X = offsetx + pixelx
dx = -centerx + X
dy = -centery + Y
r = Sqr(dx * dx + dy * dy)
theta = Sgn(dy) * ArkTangent(dy, dx) + phi
PSet (centerx + Cos(theta) * r, centery + Sin(theta) * r)
Next pixelx
End Sub
http://forums.vb-world.net/showthrea...threadid=53924
Hi!
There was some of your code I did not understand.
This line of code:
theta = Sgn(dy) * ArkTangent(dy, dx) + phi
What sort of a function is ArkTangent?
It is not anywhere in the code you posted
You get ArkTangent from the link he quoted :rolleyes:
go for the link and copy guv's code for it ;)
Or you could use sin and cos to do it....
but only if the curve was square (eg X1=50,X2=0,Y1=50,Y2=0) then the centerpoint (origin) would be 0,50 and so on...)