sorry Paolo, it turns out the problem was not with the allocator but my
code... it just took a lot of trial and error to pinpoint it as the segfault
wasn't giving me a line number to where the problem was.
it's still segfaulting, however, when I try to access a vertex of a face
outside the vector's range (no surprise there); I think this is because the
new face's vertices are not properly initialized, as it ends up requesting a
vertex index in the billions... I've tried two different methods of
initializing vertices, but neither fixes the problem:
vcg::tri::Allocator<CMeshO>::AddVertices(m,2);//2 new vertices, 1 old vertex
the first way:
m.face[m.face.size()-1].V(0) = &m.vert[m.vert.size()-2];//new vertex
m.face[m.face.size()-1].V(1) = &m.vert[m.vert.size()-1];//new vertex
m.face[m.face.size()-1].V(2) = &vertices[2];//old vertex: vertices[2] =
m.vert[f.V(2)-&(*m.vert.begin())];
the second way:
vi=m.vert.end();--vi;--vi;//vertices added to the back of the vector,
decrement because end() is past the last element, and second time because
added 2 vertices
ivp[0]=&*vi;(*vi).P()=intersections[0];++vi;//new vertex, intersections[0] =
Point3f(....)
ivp[1]=&*vi;(*vi).P()=intersections[1];//new vertex, intersections[1] =
Point3f(....)
ivp[2]=&vertices[2];//old vertex: vertices[2] =
m.vert[f.V(2)-&(*m.vert.begin())];
fi = m.face.end();--fi;//faces added to back of vector, decrement because
end() is past the last element
(*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2];
when I tried using CoordType(0.0f,-1.0f,1.0f) as used in the documentation I
got the error 'no matching function call to... (Point3<float>) (float,
float, float) even though I've declared CoordType and included allocate.h
as the cause of the segfault is known in this case, I'm not attaching code
for people to replicate the issue - I'm just asking for the correct way of
doing this...
appreciate the help,
imran
On Mon, Aug 18, 2008 at 12:52 AM, Paolo Cignoni
<pao...@is...>wrote:
> Could you provide a 10~30 lines self contained command-line program that
> is AS SHORT AS POSSIBLE and that tries to duplicate your issue?
> Something in the style of the vcglib/apps/sample/trimesh_XXXX examples
> (just a .cpp and a .pro).
>
> >From just the two lines that you are repeatedly posting is impossible to
> understand what is your problem.
> If you post just these two lines nobody can help you. The context is
> necessary. You should know that...
>
> The program should be AS SHORT AS POSSIBLE that is should be impossible to
> remove any statement (any statement) without breaking its ability of
> duplicating the issue.
> If someone post a long bug-duplication program that could be made shorter
> anyone will think that the submitter is either lazy or that the submitter
> considers his time more precious that the others one.
>
> cheers
> p.
>
>
>
>
>
> skunkwerk wrote:
>
> i'm still struggling with how to add and delete faces... I no longer get
> the previous assertion error, but am now getting a segfault whenever I do:
>
> vcg::tri::Allocator<CMeshO>::Addvertices(m,2);
> vcg::tri::Allocator<CMeshO>::AddFaces(m,1);
>
> when I comment out those two lines, I don't get any crashes...
> what am I doing wrong?
>
> thanks,
> imran
>
> On Sat, Aug 16, 2008 at 11:07 AM, skunkwerk <sku...@gm...> wrote:
>
> i managed to track down the error once the compiler gave me the correct
> line...
>
> now i'm getting this assertion failure though:
> meshlab: ../../../../vcglib/vcg/complex/trimesh/allocate.h:513: static void
> vcg::tri::Allocator<AllocateMeshType>::CompactFaceVector(AllocateMeshType&)
> [with AllocateMeshType = CMeshO]: Assertion `(int)pos==m.fn' failed.
>
> this is how i'm adding/deleting faces:
> vcg::tri::Allocator<CMeshO>::AddFaces(m,1);
> vcg::tri::Allocator<CMeshO>::DeleteFace(m,fp);//delete old face, leave
> vertices
> vcg::tri::Allocator<CMeshO>::CompactFaceVector(m);//compact faces to remove
> those marked as deleted
>
> am i doing something wrong?
>
> thanks,
> imran
>
> On Thu, Aug 14, 2008 at 4:58 PM, skunkwerk <sku...@gm...> wrote:
>
> thanks Paolo,
> i had to write 200 lines of code to get the face splitting working -
> and it almost compiles, except for these 3 errors:
>
> colladaio.cpp:264: instantiated from here
> /usr/include/c++/4.3/bits/vector.tcc:293: error: array must be initialized
> with a brace-enclosed initializer
> /usr/include/c++/4.3/bits/vector.tcc:299: error: invalid array assignment
> /usr/include/c++/4.3/bits/stl_construct.h:88: error: request for member
> '~float [2]' in '* pointer', which is of non-class type 'float [2]'
>
> but i have no idea where in the code these errors are coming from, as those
> are all stl things... any suggestions on how to trace this? i'm using gcc
>
> OR if someone could tell me how to use the existing code in meshlab, that'd
> be great too
>
> imran
>
> On Thu, Aug 14, 2008 at 1:04 AM, Paolo Cignoni <pao...@is...>wrote:
>
> no, at the end.
> read this page (and referrred subpages too)
>
> http://vcg.sourceforge.net/index.php/Tutorial
>
> p,
>
> skunkwerk wrote:
>
> quick question: i was reading 'creating elements' on this wiki page:
> http://meshlab.sourceforge.net/wiki/index.php/Accessing_the_mesh
>
> when you call Allocator<CMeshO>::AddVertices or AddFaces, are
> vertices/faces added to the front of the vector?
> because the next line that describes specifying the vertex coordinates,
> etc. uses a pointer to the front of the vector
>
> thanks,
> imran
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the worldhttp://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> _______________________________________________
> Meshlab-devel mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>
>
>
> --
> Paolo Cignoni -- Senior Researcher
> Visual Computing Laboratory - ISTI - CNR http://vcg.isti.cnr.it/~cignoni <http://vcg.isti.cnr.it/%7Ecignoni>
>
> ISTI - CNR
> Via Moruzzi 1,
> 56124 Pisa
> ITALY
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Meshlab-devel mailing list
> Mes...@li...
> https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>
>
>
>
> ------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the worldhttp://moblin-contest.org/redirect.php?banner_id=100&url=/
>
> ------------------------------
>
> _______________________________________________
> Meshlab-devel mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>
>
>
> --
> Paolo Cignoni -- Senior Researcher
> Visual Computing Laboratory - ISTI - CNR http://vcg.isti.cnr.it/~cignoni <http://vcg.isti.cnr.it/%7Ecignoni>
>
> ISTI - CNR
> Via Moruzzi 1,
> 56124 Pisa
> ITALY
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Meshlab-devel mailing list
> Mes...@li...
> https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>
>
|