ilmola / generator

A procedural geometry generation library for C++11
GNU Lesser General Public License v2.1
211 stars 26 forks source link

Infinite loop when generating IcosahedronMesh or IcoSphereMesh #16

Closed JesseTG closed 8 years ago

JesseTG commented 8 years ago

This happens in my own code, but not in generate-glm. It could just be my own code, but I wanted to report this before I forget.

Looks like it's in the generation of Triangles.

Also may have something to do with an unsigned integer either not being initialized or over/underflowing.

Also, this is with GLM.

JesseTG commented 8 years ago

Some internal loop counter (I think it's called i_?) is not being incremented. May be a clue.

ilmola commented 8 years ago

In IcosahedronMesh::Triangles i_ is the face index. It's incremented at IcosahedronMesh.cpp line 101 after all triangles for the current face are iterated.

Once again I can not reproduce this bug. What are the values given to the IcosahedronMesh constructor and how the triangles are iterated? Maybe it fails only for certain values.

JesseTG commented 8 years ago

Default parameters. That is, radius and segments are 1.0 and 1u for IcosahedronMesh, and 1.0 and 4u for IcoSphereMesh.

I must be going mad.

JesseTG commented 8 years ago

Also, possibly related, BoxMesh goes into an infinite loop if any of the values in segments are zero.

ilmola commented 8 years ago

Fixed the BoxMesh zero segment bug. This has nothing to do with anything else. It was simply failing with this one nonsensical input. Now it skips faces in the direction where segments is zero.

ilmola commented 8 years ago

It seems I accidentally managed to replicate this bug. I will fix it tomorrow.

JesseTG commented 8 years ago

Awesome, thanks!

But, regarding a5d4168024, if all you did was add to the docs then shouldn't that not fix the behavior? Or is it related to this issue? Or maybe I'm missing something.

ilmola commented 8 years ago

Fixed in c73827d795a313286f3da76568117ca763651ec7 The zero segment bug was fixed in 24ce0b3aaef2bf2ddaa0f52201b7ba9c28afe7ab

JesseTG commented 8 years ago

Ah, I see. Will try it out and report back, thanks!

I wonder if this is also related to #10?

JesseTG commented 8 years ago

Fixed! Mission accomplished, thank you!