|
-
Feb 9th, 2001, 09:12 PM
#1
Thread Starter
transcendental analytic
You want to draw a sine curve that is angled?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 10th, 2001, 11:02 AM
#2
New Member
Curved line with angle.
Yep!
I would like to draw a curved line that is angled.
It should work for angles from 1 to 360
-
Feb 10th, 2001, 11:44 AM
#3
Thread Starter
transcendental analytic
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
I did this one using guv's safe arctan that you can get here:
http://forums.vb-world.net/showthrea...threadid=53924
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 10th, 2001, 04:21 PM
#4
New Member
did not understand some of your code..
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
-
Feb 10th, 2001, 04:45 PM
#5
Monday Morning Lunatic
You get ArkTangent from the link he quoted
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 10th, 2001, 04:45 PM
#6
Thread Starter
transcendental analytic
go for the link and copy guv's code for it
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 14th, 2001, 09:38 PM
#7
Good Ol' Platypus
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...)
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|