# another help in a simple math equation

## Recommended Posts

winsrp    277
given x in the range from 0 to 1

how can I know Y, for the values in a quarter for a circle

[attachment=9478:pattern2.png]

where

if x = 0 then Y = 0
if x = 1 then y = 1

I was thinking in something like

SQRT(-(((x-1)^2)-1))

but the values are not cuved to be shaped in a circle, looks more like an ugly oval.

Regards,

Winsrp Edited by winsrp

##### Share on other sites
Cornstalks    7030
Question: what are you accomplishing with these different functions of yours?

The equation of a circle with radius 1 and a center at (1, 0) is: (x - 1)[sup]2[/sup] + (y - 0)[sup]2[/sup] = 1[sup]2[/sup]

Simplify: y[sup]2[/sup] = 1 - (x - 1)[sup]2[/sup]

And since you want the positive part of y:
y = sqrt(1 - (x - 1)[sup]2[/sup])

Or you can [url="http://www.wolframalpha.com/input/?i=y%5E2+%2B+%28x+-+1%29%5E2+%3D+1"]plug it in to Wolfram|Alpha[/url] and you'll get y = sqrt(2x - x[sup]2[/sup]) (which is what I got, but further simplified). Edited by Cornstalks

##### Share on other sites
CulDeVu    3034
Close. The equation it looks like you're going for is:
y = sqrt(1 - (x - 1)^2), which evaluates to
y = sqrt(2x - x^2)

Also, may I recommend an Algebra 2 textbook? It will teach you alot of things like basic equation transformation.

Cheers,
CulDeVu

##### Share on other sites
winsrp    277
hmm I don't know if its excel graphs or something, becuase that equation still looks like an ugly oval.

In order to respond to your first question, the first equation is a terrain modulator, where I have a perlin noise funcion and I wanted to create some sea bottom, then lift up, then some nice shores, and then lift mountains again, and then a flatty mountain top.. looks really nice in the renderer by the way.

this other equation is a 3d fmb perlin gradient where i want to diminish the density value of the 3d effect in a circular way, so that I get a reduced effect as I go up. I first tried something like SQRT(X), but the values do not diminish in a circular approach, so I get lots of floating islands over my landscape.

[img]http://public.gamedev.net//public/style_emoticons/default/happy.png[/img]

thks Edited by winsrp

##### Share on other sites
winsrp    277
Culdevu, yours is inverted in the wrong way, starts with x=0 y=1, and finishes on x=1 y= 0

cornstalks looks more like what it should be, but in excel both of yours looks like an oval.. Edited by winsrp

##### Share on other sites
winsrp    277
This is what I'm doing with the equations

[sharedmedia=core:attachments:9460]

##### Share on other sites
Cornstalks    7030
[quote name='winsrp' timestamp='1339707756' post='4949292']
hmm I don't know if its excel graphs or something, becuase that equation still looks like an ugly oval.
[/quote]
Well, if you [url="http://www.wolframalpha.com/input/?i=y+%3D+sqrt%282x+-+x%5E2%29+from+x+%3D+0+to+x+%3D+1"]plug it in to Wolfram|Alpha[/url], and looking at your graph, your initial reaction is that it's an oval. But if you look closer, you'll see the graphs aren't square. The graphs have been stretched horizontally, so of course they look... not circular. If you make the graph square it'll look like a quarter circle.

[quote name='winsrp' timestamp='1339707756' post='4949292']
In order to respond to your first question, the first equation is a terrain modulator, where I have a perlin noise funcion and I wanted to create some sea bottom, then lift up, then some nice shores, and then lift mountains again, and then a flatty mountain top.. looks really nice in the renderer by the way.
[/quote]
That's cool. I'm just curious [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Edited by Cornstalks

##### Share on other sites
winsrp    277
crap, its excel cheating on me...

[url="http://lmgtfy.com/?q=sqrt(1-(x-1)%5E2)"]http://lmgtfy.com/?q=sqrt(1-(x-1)%5E2)[/url] Edited by winsrp