DzVertexMesh->addVertex

Alessandro_AMAlessandro_AM Posts: 1,553

Any particular reason why the following code is crashing?
I'm trying to store some vertices into a DzVertexMesh...

    DzVertexMesh *vMesh;    vMesh->beginEdit(false);    vMesh->addVertex(0.0, 0.0, 0.0);    vMesh->addVertex(0.0, 1.0, 0.0);    vMesh->addVertex(1.0, 1.0, 0.0);    vMesh->addVertex(1.0, 0.0, 0.0);    vMesh->finishEdit();

Post edited by Alessandro_AM on

Comments

  • rbtwhizrbtwhiz Posts: 481
    edited December 1969

    At a glance, it would appear that you have declared a DzVertexMesh pointer, but you haven't defined it (i.e. = new DzVertexMesh).

    -Rob

  • Alessandro_AMAlessandro_AM Posts: 1,553
    edited December 1969

    Using:

    
    #include "dzvertexmesh.h"
    ...
    DzVertexMesh *vMesh=new DzVertexMesh;
    

    actually gives a "allocating an object of abstract class 'DzVertexMesh'.

  • Richard HaseltineRichard Haseltine Posts: 19,933
    edited December 1969

    Shouldn't there be parentheses at the end?

  • rbtwhizrbtwhiz Posts: 481
    edited November 2012

    @Alessandro: Yeah, sorry... I was on my tablet, on the way out the door to take my wife to dinner. I didn't have anything other than your post in front of me at the time and the use of a declared but undefined pointer was an obvious issue that didn't require me to look at headers/definitions for more context. That is why I started my response with "At a glance". Now that I've had a chance to look at this when I'm not being rushed out the door... rather than DzVertexMesh, which you are correct is an abstract base class, use DzFacetMesh. You will obviously still need to define the pointer before you attempt to do anything with it, or you will cause a crash.

    @Richard: Take a look at this. It may even answer some questions you didn't even know you had.

    -Rob

    Post edited by rbtwhiz on
  • Alessandro_AMAlessandro_AM Posts: 1,553
    edited December 1969

    Yep, thank you very much Rob, will use the DzFacetMesh

  • Richard HaseltineRichard Haseltine Posts: 19,933
    edited December 1969

    Thanks Rob, an interesting site.

Sign In or Register to comment.
Rocket Fuel