Author Topic: curves in axe?  (Read 4229 times)

0 Members and 1 Guest are viewing this topic.

nemo

• LV9 Veteran (Next: 1337)
• Posts: 1203
• Rating: +95/-11
curves in axe?
« on: July 21, 2010, 01:05:25 am »
i'm wondering how one might make curves in axe. there was a topic awhile back about this, but i couldn't glean any useful information from it. what i need is curves that change very little, such as the attached image.

edit:
currently, i have this program. which kind of does what i want, but i'd like it smoother, if anyone has any alternatives.
Code: [Select]
.AAA0->C45->YRepeat getKey(15)Line(95,Y,95,63!If C^5rand^3-1+Y->YEndDispGraphHorizontal -C+1->CEnd
« Last Edit: July 21, 2010, 01:24:23 am by nemo »

shmibs

• しらす丼
• LV11 Super Veteran (Next: 3000)
• Posts: 2132
• Rating: +281/-3
• try to be ok, ok?
Re: curves in axe?
« Reply #1 on: July 21, 2010, 04:39:19 am »
use the sine command and just dilute it by dividing(the higher the divisor the subtler the curve will change)

log the x position as it moves along(the c in your current program) and just find the sine of that and then add the sine to the height of your x axis position on the screen and add a constant to c if you want to slide the curve to the left or the right.

if you want the curving to be less uniform and more random then you could use this somewhat more complex method:(to make it somewhat easier to read it is unoptimized)
1->a
.a will serve as the amount by which the number from which we will derive our sine (i.e.  .c in the last example, although it remained at a constant 1) will change when c moves one .pixel to the right
0->c
.as stated, c is our true x position
0->x
.x will be our variant x position used to "randomize" the curvature
0->Y
.defining our initial y axis(it will shift during drawing)
for(c,0,94
.let's pretend that you want this curve to span the length of the screen
rand^2->b
.just a temporary storage(is there an anser var or something to use instead? i think i remember something like that, but just to be safe...)
a+((b=1)*(a<3))-((b=0)*(a>0))->a
.if b=1 and a<3 a increases by one, if b=0 and a>0 a decreases by one. this is where we will get our variation in how drastic the curve will be
x+a->x
.our variant  x position is increased by varying amounts
y->z
.the reason for this will be revealed in a moment
y+(sinx)->y
.i dont remember the axe syntax for sine atm, but it should be easy to find
line(c,z,c+1,y
.just a drawing command
dispgraph(unless you want to wait and do it at the end, that is)
end

im not entirely certain if this is what you want and im writing it very late at night, so if it makes no sense whatsoever please dont hold it against me =P i promise to try to make sense of it tomorrow(if i remember anything)
however, this should draw something similar to your mspaintamathing there
« Last Edit: July 21, 2010, 04:40:35 am by shmibs »