Skip to main content

Mapping colors to x-y coordinates on a plane

No replies
HGD
Offline
Joined: 2011-12-28
Points: 0

am trying to write a Java3D application which emulates the what you would see on a spectrogram such as this: http://en.wikipedia.org/wiki/File:Spectrogram-19thC.png. My main difficulty right now is figuring out how to actually display amplitude values on the plane in the same way as the spectrogram does: using different colors to designate different intensities for each time-frequency coordinate ((x, y) point) on the spectrogram.

I have attached snippets of my code. My constructor takes as an argument a 2D array containing time-frequency coordinates. I create a plane representing the spectrogram and set up some for loops to use when actually displaying the amplitude values. I'm aware of how to calculate the amplitude values for each time-frequency pair from the 2D graph and have a idea of how to assign ranges of amplitude values to colors (although I haven't yet coded these).

My main problem is with displaying these colors on the plane itself. While Java3D allows users to specify colors for an entire object (using the Appearance, ColoringAttributes and Color3f classes), I haven't seen any examples of mapping different colors to different points on an object, which is what I want to do.

Does anyone know if this is possible in Java3D? If so, suggestions of how it can be done or links to resources that deal with it would be greatly appreciated. I am fairly new to Java3D, so any advice would be great.

AttachmentSize
Spectrogram.txt1.65 KB