By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,569 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,569 IT Pros & Developers. It's quick & easy.

Interpolation without FPoint arithmetics

P: n/a
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
Nov 14 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jonas Ernst wrote:
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?

Nov 14 '05 #2

P: n/a
Jonas Ernst wrote:
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.
Nov 14 '05 #3

P: n/a
Jonas Ernst wrote:
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 news:comp.lang.c++ than this one.
CC: news:comp.lang.c++ (for thread consistency)
Followup-To: news:comp.programming

2. Your issue is about an algorithm or the process of getting
something done (such as interpolation). The newsgroup
news:comp.programming 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

Nov 14 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.