double precision

  • Grégory Jaegy
    Grégory Jaegy


    I am trying to import an .obj file that contains some geo-referenced model. All vertices are defined with an absolute offset (no mesh transformation) and because of that, the vertices coordinates are very big, for instance:

    v 1024199.614999999 6280752.805999999 0.9109999999890448

    Now, the .obj parser, but also the resulting imported mesh, store the data in arrays of aiVector3D, which is defined as follow:

    typedef aiVector3t<float> aiVector3D;

    I would like all the import pipeline to read my values (at least the vertices position) using double precision floating points.

    I guess I will have to hack the source at some locations, but before I start this, I would like to check with you guys if there was a better existing method ?

    Thanks a lot,

  • Kim Kulling
    Kim Kulling

    We only have single precision accuracy because for render stuff this was more than enough in the past. So you have to do this on your own, I guess.


  • Hi,

    We have exactly the same problem and I think this would be very common in all software used in the professional GIS market.

    Would it be possible to:

    • Have the precision definable at compile time (float would be default)
    • Have a 'typedef float real' or '#define REAL float' somewhere central and then use this 'real' instead of float everywhere applicable
    • Users needing double precision would then only need to change the definition of real before compiling assimp

    While I understand the rationale by why float was chosen in the first place (not much hardware or 3D software that can render double precision directly anyway). This pattern of storing the vertices in real world coordinates is unfortunately very common in our field of work and makes assimp useless for us.

    Alternatively if we successfully create a patch that implements this, would the maintainers consider adopting this patch?

    Having to rewrite assimp every time we need to update it is not very tempting.

    Last edit: Stig R Kristiansen 2015-07-29