Results 1 to 6 of 6
Thread: looking for Point interpolater
 08202010, 04:27 AM #1Member
 Join Date
 Jun 2010
 Posts
 86
 Rep Power
 0
looking for Point interpolater
Hello,
I'm wondering if there's a method or class or algorithm of some kind in the Java APIs that will take in two Point objects and interpolate them.
More specifically, I'd like something that will help me produce a line between the points, but I need this line to be made up of Points itself  that is, an array or vector (or something like that) of Points, one per pixel.
If there's something in the Java APIs that can do just that, that would be perfect, but even something that help (like an interpolater) would do the trick. By an 'interpolater' I mean something that takes in two points and a weight and gives back an interpolated Point according to the weight passed into it. The weight would be an int (or double) indicating how close to the one point (and how far away from the other Point) the resulting point is to be. For example, say I passed in .8 for my weight (or 80 if its an int  to be interpreted as 80%), then it would give me the Point that's 80% the way from the first Point to the second Point.
Is there anything like this in the Java APIs or even anything that will help me accomplish what I want to do? Is there any online algorithm outside the Java Platform site that shows how to do this?

I know of no API method that does this, but you can certainly write it yourself using the basics geometry.
 08202010, 10:46 AM #3
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,041
 Blog Entries
 7
 Rep Power
 23
Given point (x1, y1) and point (x2, y2) all points on the line segment between those two points can be described as (x1, y1)+p*(x2x1, y2y1). So for p= 0.8 you have your answer.
kind regards,
Jos
 08202010, 01:33 PM #4array or vector (or something like that) of Points, one per pixel.
 08202010, 02:00 PM #5
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,041
 Blog Entries
 7
 Rep Power
 23
Last edited by JosAH; 08202010 at 04:21 PM.
 08202010, 04:22 PM #6Member
 Join Date
 Jun 2010
 Posts
 86
 Rep Power
 0
Similar Threads

Access Point
By ja107 in forum NetworkingReplies: 0Last Post: 03052010, 06:59 PM 
Drawing a point
By chappa in forum AWT / SwingReplies: 3Last Post: 12132009, 09:24 PM 
Can someone point me to an example?
By smhjr in forum New To JavaReplies: 2Last Post: 08272009, 11:38 PM 
is it bug? or am i missing a point?
By blowguy in forum Threads and SynchronizationReplies: 1Last Post: 11202007, 07:19 PM
Bookmarks