Skip to content
/ yuka Public

Non-terminating while loop #62

@arcman77

Description

@arcman77

In an attempt to get around the large mesh issue I was talking about here I watered down the detail of the 3d geometry of the mesh and then split it into six parts resulting in this gltf file. That seems to have helped as I now get stuck further down the pipeline of loading the navmesh, here:

	/**
	* Returns true if the polygon is convex.
	*
	* @param {Boolean} ccw - Whether the winding order is CCW or not.
	* @return {Boolean} Whether this polygon is convex or not.
	*/
	convex( ccw = true ) {

		let edge = this.edge;

		do {

			const v1 = edge.tail();
			const v2 = edge.head();
			const v3 = edge.next.head();

			if ( ccw ) {

				if ( leftOn( v1, v2, v3 ) === false )	return false;

			} else {

				if ( leftOn( v3, v2, v1 ) === false ) return false;

			}

			edge = edge.next;

		} while ( edge !== this.edge );

		return true;

	}

I put a deactivated debugger stopping point inside the do-while block, and let it run until it hit an endless loop cycle, then I was able to pause execution inside this code. From there I ran this snippet:

let arr = []
while (edge && edge.vis2 === undefined) {
    arr.push(edge)
    edge.vis2 = true
    arr.push(edge)
    edge = edge.next
}
console.log(arr.length)
console.log(arr.indexOf(this.edge))

The length of the array was 16, and arr.indexOf(this.edge) returns -1, so that proves that the while loop will never terminate.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions