Thursday, April 21, 2005

Haptic Device to Graphic Mapping

For the past few weeks, I have been struggling to convert the haptic work coordinates to the graphic coordinates. I have been modifying code given in the haptic examples. The simpleHapticScene example provides code to generate the cursor on the screen.

The problem was having the coordinate system of the haptic cursor interact with the voxel shell. The cursor could be drawn to the screen, but when the cursor should have crossed into the voxel shell nothing happened.

Project stlViewer took code from a voxelization project. This took a geometric pyramid and created a voxel shape from this. Dr. Horsch modified this to distinguish the outer shell and the inner body, where the outer shell voxels are drawn. Our project will only require a voxel shell without the need for the voxelization step. I modified the code to create a cube that was 127^3 with only the outer shell drawn.

The next step was allowing the keyboard to move the cursor in the virtual environment and remove voxels when a collision occured. I modified the code provided by Dr. Horsch to activate the invisible voxels surrounding the one that was removed. When a collision occured with a voxel, its neighbors that were not drawn before had there type changed to be on the border.

The haptic toolkit provides a way to get the final transformation. There are two levels, the HL and the HD. The HL provides a proxy transformation that is the calculated with an extra translation. The HD provides the exact transformation; that is, it provides the machine values.

Today I found out that I was multiplying by the wrong transformations. The code provided by simplehapticscene to draw the haptic cursor uses a mapping technique to draw the cursor. I have struggled to get this to work, so instead I took the HD_CURRENT_TRANSFORM and generated the cursor at that position.

0 Comments:

Post a Comment

<< Home


Counters