Jan 28, 2015 at 10:17am UTC
hello
i have a bad_alloc at memory location in the debug ,please can you tell me where i cheated
this is where the problem is
/////////////////////////////
printf("Constructing clips... ");
// construct edge clips
for (size_t eid = 0; eid < edges.size(); eid++)
{
printf("edge(%d) ", eid);
Motion *clip = NULL;
Edge &e = edges[eid];
Node &nsrc = nodes[e.src];
Node &ndst = nodes[e.dst];
if (nsrc.motionIdx != ndst.motionIdx || e.length != ndst.frameIdx - nsrc.frameIdx) // transition between two motions
{
printf("src(%d, %d) dst(%d, %d) %d\n", nsrc.motionIdx, nsrc.frameIdx, ndst.motionIdx, ndst.frameIdx, e.length);
try
{
Transition *tran = new Transition(library->getMotion(nsrc.motionIdx), nsrc.frameIdx, library->getMotion(ndst.motionIdx), ndst.frameIdx, e.theta, e.x0, e.z0);
clip = tran->getBlendedMotion();
delete tran;
}
catch (std::exception &e)
{
printf("%s\n", e.what());
exit(-1);
}
}
else // forward edge
{
printf("forward src(%d, %d) dst(%d, %d) %d\n", nsrc.motionIdx, nsrc.frameIdx, ndst.motionIdx, ndst.frameIdx, e.length);
Motion *motion = library->getMotion(nsrc.motionIdx);
clip = new Motion(e.length + 1, library->getSkeleton());
if (e.length != ndst.frameIdx - nsrc.frameIdx)
{
printf("Error: edges[%d].length != nodes[%d].frameIdx - nodes[%d].frameIdx\n", eid, e.dst, e.src);
}
for (int i = 0, j = nsrc.frameIdx; i < e.length + 1; i++, j++)
{
clip->SetPosture(i, *motion->GetPosture(j));
}
}
clips.push_back(clip);
}
printf("done.\n");
reset();
printf("Generating motion graph: done.\n");
}
thank you for your help