Exception #0815 in function "subtitle_generator", Error: Visitor IQ too low!

Archive for the ‘Misc.’ Category

Painless Tetrahedral Barycentric Mapping in C++

Sonntag, August 14th, 2011

Screenshot of a liver surface mesh mapped to a tetrahedral mesh

This article provides a set of functions to generate barycentric coordinates for surface mesh vertices in relation to a tetrahedral mesh. Additionally I provide some more functions to find the closest tetrahedron to a certain point P. As barycentric coordinates are invariant to translation, rotation and scaling, barycentric mapping is especially useful for efficiently updating a surface mesh according to an underlying deformable tetrahedral mesh.

This article was born out of frustration as I could not find any comprehensive guide on how to do this and I didn’t just want to “borrow” someone else’s code without really understanding what it actually does ( e.g. from SOFA Framework or PhysX SDK). It is primarily meant as an extended reminder for myself, but might be useful for other people dealing with tetrahedral meshes. This article will mostly contain a lot of code and only very few theoretical background and no mathematical proofs! At least that’s what I regard as “painless”. The advantage of my approach is that it simply relies on Vec3f and Vec4f types and avoids funny constructions like “MeshHash” as seen in the PhysX SDK. This will allow easy adaption to different VecXf type implementations and simplify integration into different applications.

For best understanding you should at least be familiar with the following concepts:
Read the rest



[2. Update] Tetrahedral Mesh Generation (GMSH) for SOFA

Dienstag, März 22nd, 2011

During the past few months I have spent lots of time doing experiments using the SOFA framework. In the course of my work I came to the point when I needed some more tetrahedral meshes than those that came included with SOFA. For this reason I started to do some reasearch on how to generate tetrahedral meshes from surface meshes (such as .obj). There are in fact lots of papers available on how to do this, but none of them provided a publically available executable. Furthermore, common programs for tetrahedral mesh generation either do not support the GMSH format (which is at least my own favorite due to good support in SOFA), or require manual work because of wrong order in the tetrahedra indices or additional information that is incompatible with the GMSH format. Anyway, none of those tools provided a solution for surface-to-tetramesh generation.

The solution for tetrahedral mesh generation from .obj files was found with PhysXViewer that is included in Nvidia’s PhysX SDK. It is available for free, but requires registration. The PhysXViewer allows you to import a surface mesh in .obj format and generate a tetrahedral mesh in different resolutions with a simple button and some sliders.

UPDATE: To generate solid meshes you have to activate the “Iso SIngle” mode. Otherwise there will be only an outer layer of tetrahedra.

The resulting tetrahedral mesh can be exported as an XML file in the NXUStream2 format. This format simply has some XML-nodes containing the vertices and the tetrahedra-indices . As the tetrahedra-indices are in correct order, it was pretty easy to write a PhysX_NXUStream2_to_GMSH_converter tool.

Physx NXUStream2 to GMSH converter usage

Download: PhysX_NXUStream2_To_Gmsh_Converter

The downloadable archive contains the sourcecode, the VisualStudio-2008 project, a compiled binary of the resulting program and some demo files (a simple sphere .obj file, the NXUStream2 tetrahedral mesh and the conversion result in GMSH format).

This tool is using the TinyXML library.



Read-only iPod in Ubuntu

Montag, Mai 17th, 2010

Symptoms: When connecting your iPod to your Ubuntu-machine the device will appear in Rhythmbox/gtkpod/etc. as expected but you cannot delete/add files, as it is mounted read-only. Probably due to some filesystem-errors….

Shortly after connecting the iPod the command “dmesg” will show you something like this:

[  706.925751] usb-storage: device found at 4
[  706.925755] usb-storage: waiting for device to settle before scanning
[  711.924249] usb-storage: device scan complete
[  711.939968] scsi 54:0:0:0: Direct-Access     Apple    iPod             1.62 PQ: 0 ANSI: 0
[  711.941113] sd 54:0:0:0: Attached scsi generic sg3 type 0
[  711.950199] sd 54:0:0:0: [sdc] 950209 4096-byte logical blocks: (3.89 GB/3.62 GiB)
[  711.951777] sd 54:0:0:0: [sdc] Write Protect is off
[  711.951786] sd 54:0:0:0: [sdc] Mode Sense: 68 00 00 08
[  711.951791] sd 54:0:0:0: [sdc] Assuming drive cache: write through
[  711.954581] sd 54:0:0:0: [sdc] 950209 4096-byte logical blocks: (3.89 GB/3.62 GiB)
[  711.955859] sd 54:0:0:0: [sdc] Assuming drive cache: write through
[  711.955868]  sdc: sdc1
[  711.959341] sd 54:0:0:0: [sdc] 950209 4096-byte logical blocks: (3.89 GB/3.62 GiB)
[  711.960760] sd 54:0:0:0: [sdc] Assuming drive cache: write through
[  711.960768] sd 54:0:0:0: [sdc] Attached SCSI removable disk
[  712.263430] FAT: Filesystem error (dev sdc1)
[  712.263438]     fat_free_clusters: deleting FAT entry beyond EOF
[  712.263444]     File system has been set read-only
[  712.838734] FAT: Filesystem error (dev sdc1)
[  712.838738]     fat_get_cluster: invalid cluster chain (i_pos 241679)
[  712.838741]     File system has been set read-only
[  712.838746] FAT: Filesystem error (dev sdc1)
[  712.838747]     fat_get_cluster: invalid cluster chain (i_pos 241679)

I ran in to this problem several times, and until now I always had to install iTunes to re-format the iPod.

Today I have discovered that you can easily fix the corrupt filesystem using “dosfsck”:

sudo dosfsck -a -w /dev/[device_identifier] # ( e.g. /dev/sdc1 )



Wiimote Accelerogramm

Samstag, März 1st, 2008

Wiimote-AccelerogrammDas Wiimote-Accelerogramm stellt den zeitlichen Verlauf der Messwerte des Accelerometers im Wiimote in Form dreier unterschiedlich farbiger Kurven dar.
Die Messung erfolgt in Echtzeit. Beim überschreiten des darstellbaren Bereichs für die Zeit t erfolgt ein automatisches Scrolling. Nach dem Beenden der Messung kann der sichtbare Bereich wieder zurückgescrollt werden.
Das ganze funktioniert auch für die Nunchuk-Erweiterung.
Eine neue Messung überschreibt die vorhergehende!
Read the rest