Finally started coding

Been a while since I’ve updated my blog, but rest assured my project work has been progressing well. I’ve made tremendous progress in terms of my understanding and ideas for the project, and have even made a substantial start on coding….finally!

Progression of ideas

Since my last post I have gone from understanding the general techniques that my virtual keyboard will utilise, to the details of the project. I have also discussed my progress with Eugene, and he helped me by further explaining his original ideas for the keyboard. Some of the key areas I have looked are discussed below.

Handling of images

Had to look into what code existed to load images. Found that the ImageManager class would do all the hard work, including the loading of images from within a zip archive. The ThemeModern class of the GUI helped me understand how I would use this.

Format of the keyboard’s ini file

I adopted Eugene’s original idea of extended the HTML imagemap format, to give a simple XML file that would encapsulate all the information needed to describe the different resolutions. For example:

<keyboard> <resolution=320xy> <mode=normal>
<image="key_normal.bmp"> <map> ... </map> </mode> ...
</resolution> ... </keyboard>

I will write a very simple, specialised XML parser for parsing this file, and the specific format of it will be tied down at a later date.

Polygon intersection methods

As I needed to allow for polygonal areas in the image map for the keyboard I had to research algorithms for determining whether a point is inside a polygon. This was known as the Point In Polygon problem. There were a number of different algorithms, but the one that seemed to be simple and quick was the ray casting method. This method works by testing how many times a ray starting from the point intersects the edges of the polygon. If this number is odd then the point is inside the polygon.

Idea of having hierarchy of image map areas

After looking into polygonal intersection routines, I thought that my virtual keyboard could run into efficiency issues when it tries to find out which area of a map was clicked, because there would be alot of different areas it could be. This lead me to think that I could arrange all the imagemap areas into a hierarchy based on areas of the keyboard. It would be similar to the Bounding Volume Hierarchy technique that I used when implementing a ray tracer for my Computer Graphics assignment. Whether this will be needed or not will remain to be seen, but the idea is there.

Started coding

I felt that now was a good time to start writing code. I started by:

  • Writing the header file for the VirtualKeyboard class – defining its interface and key methods
  • Writing support classes for the image map areas – including intersection method (that would detect whether a point was inside the area or not)
  • Made a start on writing of simple XML parser for the ini file

I’m off on holiday tomorrow, so I won’t be around for a week. But once i’m back i’ll be able to really crack on with the coding.