# How do I can plot a curve in graphic

Get help using Construct 2

### » Tue Oct 25, 2016 12:14 am

Hello everyone, I want to know how I can make different curves in a form of layout for each function stored in inputbox, it manages different curves such as: f (x) = 1 / x; f (x) = 1 / x ^ 2; f (x) = x ^ 2; f (x) = x ^ 3 f (x) = cos (x); f (x) = sin (x)
B
33
S
9
G
3
Posts: 280
Reputation: 4,287

### » Tue Oct 25, 2016 9:09 am

Do you mean 'How can I graphically represent the output of these curves?' or 'How can I process these strings to turn them into the data points of the right curve?'

For the former: Lots of tiny sprites.

For the latter: I've had this problem before and wrote a parser. It was a real pain, and never worked perfectly - if you come across a better solution I'd love to hear it, hence joining this thread. Sorry I couldn't be more helpful!
The LEVEL GENERATOR TOOLKIT

24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 254
Reputation: 2,332

### » Tue Oct 25, 2016 11:15 pm

Hello everyone, I'm back here, and got to the graph of a sine function, now I'm having trouble is to fill the empty spaces, I know that with the array can do it, anyone can me help fill these gaps from one point to another.

My last .capx here:
https://goo.gl/ahW9Np
B
33
S
9
G
3
Posts: 280
Reputation: 4,287

### » Wed Oct 26, 2016 1:03 am

Quick and dirty way, stretch the sprites from the current point to the next one:

If you want to plot more points you need a math wizard like @R0J0hound to help.
B
243
S
63
G
33
Posts: 903
Reputation: 40,791

### » Wed Oct 26, 2016 1:55 pm

Thank you my friend, you really helped me.
B
33
S
9
G
3
Posts: 280
Reputation: 4,287

### » Thu Oct 27, 2016 9:21 pm

Hello friends I'm with another entry at this point I believe it is necessary to again another abstraction to fill the empty spaces, can someone tell me how? now to another curve that made the f (x) = x ^ 2 not notice the axis image in discrepancy because for now I could only generate the curve however the exact position as the picture is not all right, thank you for your cooperation.

The link of my project is below.

https://goo.gl/ric8jR
B
33
S
9
G
3
Posts: 280
Reputation: 4,287

### » Thu Oct 27, 2016 10:50 pm

I dont understand why you want it difficult by not drawing around the (0,0)

https://www.dropbox.com/s/ptd5o0qy95664 ... .capx?dl=0

x = the counter, nothing else
y = the function solved for only that x

You need to build in a scale-factor, as i did with scaling y.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

### » Fri Oct 28, 2016 1:39 am

99Instances2Go

Thank you very much dear friend, helped me a lot, I will study your code, thanks.
B
33
S
9
G
3
Posts: 280
Reputation: 4,287

### » Fri Oct 28, 2016 1:44 am

I'm impressed, you're pretty good.
B
33
S
9
G
3
Posts: 280
Reputation: 4,287

### » Fri Oct 28, 2016 5:22 pm

I do not know why but now I found another problem, I changed the resolution to 480 x 640, and now, the curve is also filling in spaces outside of the curve, it will be that this is happening, see this .capx .:
https://goo.gl/qhB3YL
B
33
S
9
G
3
Posts: 280
Reputation: 4,287

Next