# Is it possible to work out equation of a curve from 3 points?

This topic is 5121 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I've got 3 points that form a curve. eg. (x,y): 786432, 12 480000, 10 307200, 8 And I was wondering if its possible to work out the equation of the curve from these 3 points. I've done 2Unit Year 12 maths, so if you could give me an idea of what I should be looking at to solve this, so I would know where to read up on it Since I haven't really done much maths for 2 years now. Thanks,

##### Share on other sites
You can draw many, many (infinite?) curves that will fit those points. Those three points could very well be part of a sin curve, a cosine curve, or perhaps a any other form of curve.

However, if you know what type the curve is supposed to be, it may be possible.

##### Share on other sites
Hmmm... you can definitely find curves which go through all of these points, this might be somewhat helpful, although I can't say that I've read through it closely...

[the lagrange curves]

CJM

##### Share on other sites
well all I need is from 0 to infinity on both axises.

Basically I'm doing it so I know how big to draw the text onscreen.

eg at
640x480, font size is 8
800x600, font size is 10
1024x768, font size is 12

And I don't know what the resolution maybe, so I thought If I could just put in an equation to work it out for me every time, that would be good.

heres an idea of what the graph may look like.

##### Share on other sites
Quote:
 Is it possible to work out equation of a curve from 3 points?

Yes, if you place constraints as to what the form of the equation must be and it has the appropriate number of degrees of freedom.

##### Share on other sites
I'm assuming that if you got only 3 points and absolutely no more bits of information, your curve should be as simple as possible. That is:
y = a*x^2 + b*x + c;
where:
A * z = y
where:

A =
-----------------
| x0^2 | x0 | 1 |
-----------------
| x1^2 | x1 | 1 |
-----------------
| x2^2 | x2 | 1 |
-----------------

z = (a,b,c)^T
y = (y0,y1,y2)^T

In other words, solve the equation (off-line, of course), so you'll get a, b and c.
Simple.
/def

##### Share on other sites
I see thanks, btw that looks like a quadratic equation..am i wrong?

##### Share on other sites
well, I plugged it in to Excel, fit a 2nd order polynomial:

x=width * height
font_size = -1.05321E-11*x*x + 1.98650E-05*x + 2.89142

note that this won't work at higher resolutions; the font size will start decreasing again.

##### Share on other sites
If this is for finding the proper font size for resolution X, why not just come up with a simple equation such as
Font Size = (Vert Res + Horz Res) / 140
That comes up with 8 for 640*480, 10 for 800*600, 12.8 for 1024*768, and 20 for 1600*1200 which seems close enough to your values to work. Area of the screen isn't a good representation for the 'X' in your 'curve' since really the values you're looking for are closer to linear IMO.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 13
• 9
• 9
• 15
• ### Forum Statistics

• Total Topics
634071
• Total Posts
3015338
×