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

0 Members and 1 Guest are viewing this topic.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
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.

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]
Repeat getKey(15)
!If C^5
Horizontal -
« Last Edit: July 21, 2010, 01:24:23 am by nemo »

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
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)
.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
.as stated, c is our true x position
.x will be our variant x position used to "randomize" the curvature
.defining our initial y axis(it will shift during drawing)
.let's pretend that you want this curve to span the length of the screen
.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...)
.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
.our variant  x position is increased by varying amounts
.the reason for this will be revealed in a moment
.i dont remember the axe syntax for sine atm, but it should be easy to find
.just a drawing command
dispgraph(unless you want to wait and do it at the end, that is)

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 »