Point cloud API

  • qew

    qew - 2007-04-06

    I am writing Python bindings for ptcapi.h. And find some problems.


    Header file "ptcapi.h" do not enclose `` extren "C" `` in such a constructions:

    #ifdef __cplusplus
    #endif /* __cplusplus */


    #ifdef __cplusplus
    #endif /* __cplusplus */

    And this is why Python extension written in C cannot be compiled.


    Reading points like shown below causes Segmentaion Fault (exactly while calling PtcReadDataPoint(...)). I do something wrong?

    int main(int argc, char *argv[])
        int nvars;
        char *types[256];
        char *names[256];
        PtcPointCloud ptc = PtcOpenPointCloudFile(argv[1], &nvars, types, names);

        float point[3];
        float normal[3];
        float radius;
        float *data;
        int datasize;
        PtcGetPointCloudInfo(ptc, "datasize", &datasize);
        data = (float *)malloc(sizeof(float)*datasize);
        PtcReadDataPoint(ptc, point, normal, &radius, data);

        return 0;

    P.S. All files of Python bindings for PtcAPI and some tests available here: http://ribkit.sf.net/PyPtcAPI.tar.gz.

    • qew

      qew - 2007-04-06


      http://ribkit.sf.net/PyPtcAPI.tar.gz - without dot. =)

      • George Harker

        George Harker - 2007-04-06

        Thanks for pointing out the extern "C" issue.  That's now fixed in svn.

        I'm not totally sure what the bug might be here.  It's not crashing for me, but I have tweaked the source code since we released.  It's possibly it was a bug in the release.

        In the source it's possible for there to be issues if the point cloud was not found.



        • bill nieuwendorp

          funny I was just trying some things out with this as well.
          Does the api create a header to the pointcloud? Maybe we need a little more information on the
          actual file format.

          from what i can tell on a valid pointcloud file.
          there are nine ints that always seem to be "123456789".
          then the pixie version number "202"
          then I assume the int numvars "10"
          then the string "PointCloud"

          I tried digging this info up in the source but I just was not finding
          any reference to it.


Log in to post a comment.