Bob Balaban's Blog


    Bob Balaban


    "Reflections on Reflecting Light" - Java program

    Bob Balaban  May 9 2012 06:33:45 PM
    Greetings Geeks!

    Today it is my very great pleasure to introduce to you a new guest blogger: my son David. He has graciously allowed me to prevail upon him to write about his recent science fair project, titled "Reflections on Reflecteing Light". That may sound innocuous, but to quote one of my favorite movies, "That's no ordinary rabbit!". David took this project through our local high school's science fair, was invited to the regional fair, and then to the Massachusetts state science and engineering fair, held at MIT. The Java program he wrote is very sophisticated, both in concept and in execution, and David has agreed to post it here.

    David is looking for a software internship for this summer. If you like this sample of his work (and you are in the Boston area), please consider hiring him!  He is a graduating high school senior, and will attend UMass/Amherst in the Fall, majoring in Physics and Computer Science.


    1) Use the code for anything you like, with appropriate attribution to David Balaban.
    2) If you make any money from this code, you owe some to David.
    3) The entire contents of this page and of the attached code is copyright 2012, Looseleaf Software, Inc. All rights reserved!

    David's email is: david AT
    My email is: bbalaban AT gmail

    Here's the abstract:

    The purpose of my project is to determine how distorted an image becomes when it is reflected off of a curved surface and how the distortion changes as the surface becomes more curved. My hypothesis was that parts of the image will move towards the center of valleys while other parts will move away from peaks and move a smaller distance as the surface becomes more curved. To test this hypothesis, I wrote a program that takes an image saved on the computer and converts it to an array of pixels. The program treats each pixel as a beam of light traveling directly towards a mathematically generated curved surface and traces its path as it is reflected. The program ends by reporting statistical information resulting from over one million beams of light and creating a new picture which shows the resulting image from the reflection. My hypothesis was incorrect, because on average the pixels move away from the center of valleys, not towards.

    And here's the code (RAR format): ScienceFair.rar

    Here's an example of one of the images he used as input to the program: Control.jpg

    And here's the distorted result of that same image: Trial1.gif


    Geek ya later!


    1Ulrich Krause  05/10/2012 1:37:15 AM   Reflections on Reflecting Light - Java program

    OK, I guess, that's a thing that only MIT understands; and your son, of course.

    To be honest, I do not have any clue, what it is about.

    2Rob Wills  05/10/2012 5:03:24 AM   Reflections on Reflecting Light - Java program

    Did he use Java Reflection?!

    3Bob Balaban  05/10/2012 8:18:52 AM   Reflections on Reflecting Light - Java program

    @1 - Ulrich, the concept is not so hard, it's like looking at a reflection in a distortion mirror, like in the circus funhouse. An image (gif, jpg, whatever), reflects off of a curved surface, and what you "see" is the distorted reflection. The big difference, of course, is that it's all happening inside a Java program.

    @2 Hee hee.

    4Karsten Lehmann  05/11/2012 2:55:00 AM   Reflections on Reflecting Light - Java program

    Bob, the link to the RAR file seems to be dead.

    5Bob Balaban  05/11/2012 3:01:01 PM   Reflections on Reflecting Light - Java program

    Thanks Karsten - i uploaded it again and tested, should be ok now