interpolation

Equidistant points across Bezier curves

Currently, I'm attempting to make multiple beziers have equidistant points. I'm currently using cubic interpolation to find the points, but because the way beziers work some areas are more dense than others and proving gross for texture mapping because of the variable distance. Is there a way to find points on a bezier by distance rath...

Can you control the speed of a video clip playing in Quartz Composer?

Is there a way to manipulate the speed of the video playback? I'm especially interested in a way to slow down with frame blending, exactly like the function in Final Cut Pro. ...

Color scaling function

I am trying to visualize some values on a form. They range from 0 to 200 and I would like the ones around 0 be green and turn bright red as they go to 200. Basically the function should return color based on the value inputted. Any ideas ? ...

How do I sum up weighted arrays in PHP?

Hod do I multiply the values of a multi-dimensional array with weigths and sum up the results into a new array in PHP or in general? The boring way looks like this: $weights = array(0.25, 0.4, 0.2, 0.15); $values = array ( array(5,10,15), array(20,25,30), array(35,40,45), ...

Generate colors between red and green for a power meter?

I'm writing a java game and I want to implement a power meter for how hard you are going to shoot something. I need to write a function that takes a int between 0 - 100, and based on how high that number is, it will return a color between Green (0 on the power scale) and Red (100 on the power scale). Similar to how volume controls wo...

3D surface Reconstruction algorithm

I have a 3D surface ( such as a cone). It is projected to a 2D plan in the form of contour, meaning that different Z will have different lines on 2D plan. The problem is from the contour, how to recover the 3D surface by using interpolation? We only know about the z difference between different contor lines. ...

Math - mapping numbers

How do I map numbers, linearly, between a and b to go between c and d. That is, I want numbers between 2 and 6 to map to numbers between 10 and 20... but I need the generalized case. My brain is fried. ...

In Ruby, can you perform string interpolation on data read from a file?

In Ruby you can reference variables inside strings and they are interpolated at runtime. For example if you declare a variable `foo' equals "Ted" and you declare a string "Hello, #{foo}" it interpolates to "Hello, Ted". I've not been able to figure out how to perform the magic "#{}" interpolation on data read from a file. In pse...

adding alpha values to bilinear resizing algorithm

So I'm trying to take a bilinear interpolation algorithm for resizing images and add in alpha values as well. I'm using Actionscript 3 to do this, but I don't really think the language is relevant. The code I have below actually works really well, but edges around "erased" regions seem to get darker. Is there an easy way for it to not i...

How can I separate Perl variables from text in interpolated strings?

Hello, print " $foo", "AAAAAAAA", $foo, "BBBBBBBB"; Let's say I want to use this code with a print <<EOF;: print <<EOF; $fooAAAAAAAA$fooBBBBBBBB"; EOF That won't work because Perl thinks I have a variable called $fooAAAAAAAA. How can I easily use print << with such lines when I have a long test to print? ...

Double interpolation of regular expressions in Perl

I have a Perl program that stores regular expressions in configuration files. They are in the form: regex = ^/d+$ Elsewhere, the regex gets parsed from the file and stored in a variable - $regex. I then use the variable when checking the regex, e.g. $lValid = ($valuetocheck =~ /$regex/); I want to be able to include perl variables...

Ruby addict looking for PHP subexpressions in strings

Assume color = "orange"; Ruby: puts("My favorite color is #{color.downcase() + 'ish'} -- at least for now."); PHP: print("My favorite color is {strtolower( $color ) + 'ish'} -- at least for now."); The PHP version does not work like I would like it to. I'm not looking for any language wars, I just want to know if anyone knows of a...

What method of multivariate interpolation is the best for practical use?

In Peter Alfred's article on multivariative scattered data interpolation he mentioned, that from a variety of schemes only few are really popular among practitioners. He named for instance Shepard's method and Hardy Multiquadrics. But that article is almost 20 years old by now, and what is really interesting, is what methods are widely u...

How to interpolate between data points?

I am currently developing a piece of software using opencv and qt that plots data points. I need to be able fill in an image from incomplete data. I want to interpolate between the points I have. Can anyone recommend a library or function that could help me. I thought maybe the opencv reMap method but I can't seem to get that to work. T...

Fade a color to white (increasing brightness)

I want to make a text box in .NET "glow" yellow, and then "fade" to white (basically, by incrementally increasing the brightness). I think Stackoverflow does this after you've posted an answer. I know that increasing brightness is not all that simple (it's not just uniformly increasing/decreasing RGB), but I'm not sure how to do this. P...

How do I implement a Bézier curve in C++?

I'd like to implement a Bézier curve. I've done this in C# before, but I'm totally unfamiliar with the C++ libraries. How should I go about creating a quadratic curve? void printQuadCurve(float delta, Vector2f p0, Vector2f p1, Vector2f p2); Clearly we'd need to use linear interpolation, but does this exist in the standard math library...

InterpolationMode.High

I am trying to figure out the difference between High and HighQualityBicubic InterpolationMode in .Net (System.Drawing.Drawing2D.InterpolationMode.High). Does High mean that it will pick the best algorithm based on the image and what you are doing with it? Is it just an alias for HighQualityBicubic? Something else? According to the MS...

Interpolation algorithms when downscaling

Im trying to understand downscaling. I can see how interpolation algorithms such as bicubic and nearest neighbour can be used when when upscaling, to "fill in the blanks" between the old, known points (pixels, in case of images). But downscaling? I cant see how any interpolation technique can be used there. There are no blanks to fill! ...

Data storage to ease data interpolation in python

I have 20+ tables similar to table 1. where all letters represent actual values Table 1: $ / cars |<1 | 2 | 3 | 4+ <10,000 | a | b | c | d 20,000 | e | f | g | h 30,000 | i | j | k | l 40,000+ | m | n | o | p A user input could be for example, (2.4, 24594) which is a value between f, g, j, and k. my python function definition an...

SQL Server view: how to add missing rows using interpolation

Running into a problem. I have a table defined to hold the values of the daily treasury yield curve. It's a pretty simple table used for historical lookup of values. There are notibly some gaps in the table on year 4, 6, 8, 9, 11-19 and 21-29. The formula is pretty simple in that to calculate year 4 it's 0.5*Year3Value + 0.5*Year5Val...