Interpolation without FPoint arithmetics

J

Jonas Ernst

Hi,

Can somebody give me some hints how to do a line interpolation without using
floating point arithemtics?

The function shall do a linear interpolation between 2 points (line interp?)
and it shall return the y value to any x value given.
e.g. p1: (0,0)
p2 (1000,50)
y value to calculate at x=600

Is there a way to implement this not using any FP arithmetics in C? Perhaps
"scaling up" or sth like this?

Any help would be great

Thanks in advance
J. Ernst
 
G

Grumble

Jonas said:
The function shall do a linear interpolation between 2 points (line interp?)
and it shall return the y value to any x value given.
e.g. p1: (0,0)
p2 (1000,50)
y value to calculate at x=600

y = 20*x ?

How is this related to the C language?
 
M

Martin Ambuhl

Jonas said:
Hi,

Can somebody give me some hints how to do a line interpolation without using
floating point arithemtics?
Yes.

The function shall do a linear interpolation between 2 points (line interp?)
and it shall return the y value to any x value given.
e.g. p1: (0,0)
p2 (1000,50)
y value to calculate at x=600

Is there a way to implement this not using any FP arithmetics in C? Perhaps
"scaling up" or sth like this?

Yes. Most early graphics-oriented devices had no FP. The BetaCom
devices I programmed (sold to Gould. What they did with BetaCom I don't
know.) were 4K and 8K 12-bit PDP-8's with no FP. They did quite well.
What we could do in PDP-8 assembler, you can do in C. Elementary
graphics texts would be a help to you.
 
T

Thomas Matthews

Jonas said:
Hi,

Can somebody give me some hints how to do a line interpolation without using
floating point arithemtics?

The function shall do a linear interpolation between 2 points (line interp?)
and it shall return the y value to any x value given.
e.g. p1: (0,0)
p2 (1000,50)
y value to calculate at x=600

Is there a way to implement this not using any FP arithmetics in C? Perhaps
"scaling up" or sth like this?

Any help would be great

Thanks in advance
J. Ernst

1. Don't post separately to multiple newsgroups. If you are
going to crosspost, append them to the "Newsgroup:" section
of your post. For example, there are different replies to
your post in than this one.
CC: (for thread consistency)
Followup-To:
2. Your issue is about an algorithm or the process of getting
something done (such as interpolation). The newsgroup
is an excellent place for algorithmic
questions. Most all algorithms are language independent.

3. This also happens to be a mathematics issue, again independent
of the programming language. Also try a newsgroup with the
term "sci.math" in its name.

4. How do you want the interpolation performed?
Linear Interpolation?
Binomial Interpolation?
Other?

5. Your issue may also fall under the relm of "curve fitting",
which is the subject of determining the best equation to
describe a set of points. If you have the equation then
determining any other point is easy. However, determining
the equation is not always easy.


--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top