# Visualizing Complex Functions

## Click here to edit subtitle

### Communication Post New Entry

 view:  full / summary

#### 4/3 Posted by Branden on April 4, 2013 at 12:55 AM comments (0)

#### Bilinear Interpolation Posted by Mr. Watson on February 10, 2013 at 1:20 PM comments (0)

Here is an article that explains what bilinear interpolation performs and how to perform it:
en.wikipedia.org/wiki/Bilinear_interpolation

Bilinear Interpolation

Method:

//the algorithm used for bilinear interpolation

//Diagram:

//                  x

// top_y *----|---- +              * = (left_x,top_y) = tlPixel (top left Pixel)

//            |      |      |               + = (right_x,top_y) = trPixel (top right Pixel)

//            |-----|---- |- y         @ = (right_x,low_y) = brPixel (bottom right Pixel)

//            |       |      |              . = (left_x,low_y) = blPixel (bottom left Pixel)

//low_y . -----|[email protected]

//         left_x       right_x

public static int bilinearInterpolation(int tlPixel, int trPixel, int brPixel, int blPixel,

int x, int y, int left_x, int low_y, int right_x, int top_y)

{

//Bilinear Interpolation algorithm adapted from

int value =

(

( (blPixel / ( (right_x - left_x)*(top_y - low_y) )) * (right_x - x) * (top_y - y) ) +

( (brPixel / ( (right_x - left_x)*(top_y - low_y) )) * (x - left_x) * (top_y - y) ) +

( (tlPixel / ( (right_x - left_x)*(top_y - low_y) )) * (right_x - x) * (y - low_y) ) +

( (trPixel / ( (right_x - left_x)*(top_y - low_y) )) * (x - left_x) * (y - low_y) )

);

return value;

}

How its called:

//Interpolation

Color tl, tr, lr, ll; //top left, top right, low right, low left

int alpha, red, blue, green, combo; //each color part of each pixel

//goes through dstImage and interpolates

//each pixel based on each of its color components

for (int i = (minx + 1); i < (maxx - 1); i++)

{

for (int j = (miny + 1); j < (maxy - 1); j++)

{

tl = new Color((int)(dstImage.getRGB((i-1), (j-1))));

tr = new Color((int)(dstImage.getRGB((i-1), (j+1))));

lr = new Color((int)(dstImage.getRGB((i+1), (j+1))));

ll = new Color((int)(dstImage.getRGB((i+1), (j-1))));

//bilinear interpolation on the alpha component of the 4 pixels

alpha = bilinearInterpolation(tl.getAlpha(), tr.getAlpha(), lr.getAlpha(), ll.getAlpha(), i, j, (i-1), (j-1), (i+1), (j+1));

//" " " " red " " " " "

red = bilinearInterpolation(tl.getRed(), tr.getRed(), lr.getRed(), ll.getRed(), i, j, (i-1), (j-1), (i+1), (j+1));

//" " " " green " " " " "

green = bilinearInterpolation(tl.getGreen(), tr.getGreen(), lr.getGreen(), ll.getGreen(), i, j, (i-1), (j-1), (i+1), (j+1));

//" " " " blue " " " " "

blue = bilinearInterpolation(tl.getBlue(), tr.getBlue(), lr.getBlue(), ll.getBlue(), i, j, (i-1), (j-1), (i+1), (j+1));

//combines the 4 components into the 8-bit integer representation

combo = new Color(red, green, blue, alpha).getRGB();

dstImage.setRGB(i, j, combo);

}

}

#### todo Posted by TestUser on February 10, 2013 at 1:15 PM comments (0)

more patterns

upload pic

resolution + smooth

foward map thin lines

bitmap vs image

grid scales log/radian

unit-unit unit-log log-unit

#### Colors Posted by Branden on November 4, 2012 at 1:05 PM comments (0)

http://fortwain.com/complex.html

right click page -> view page source

click complex.js near top

#### SVN Posted by Branden on October 19, 2012 at 3:10 PM comments (0)

#### Image Morphing Posted by Branden on October 18, 2012 at 1:10 AM comments (0)

#### Possible Inverses Posted by Branden on October 17, 2012 at 11:45 PM comments (0)

#### Better Complex Package Posted by Paul Giacchetto on October 17, 2012 at 4:05 PM comments (0)

This complex number package for Java is more detailed than the previous one I posted and it comes with documentation on each of the functions.

http://www.ee.ucl.ac.uk/~mflanaga/java/Complex.html

The actual Java file for this is here (you can find it on the main page, last updated in 2010): http://www.ee.ucl.ac.uk/~mflanaga/java/Complex.java

#### Complex package for Java Posted by Paul Giacchetto on October 11, 2012 at 9:55 AM comments (0)

It looks like there is no built-in complex number package for java, but a slightly modified version of this file should fit our needs. Many complicated operations like the complex argument are already specified. http://www.math.ucla.edu/~tao/java/Complex.java

#### presentation milestone1 Posted by Branden on September 28, 2012 at 3:05 PM comments (0)