game-ai/src/main/java/com/jzy/game/ai/nav/triangle/TriangleHeuristic.java
/**
	 * Estimates the distance between two triangles, by calculating the distance
	 * between their edge midpoints.
	 *
	 * @param node
	 * @param endNode
	 * @return
	 */
Estimates the distance between two triangles, by calculating the distance
between their edge midpoints.

@param node
@param endNode
@return
Estimates the distance between two triangles by calculating the distance between their edge midpoints . @param node @param endNode @return
@Override
	public float estimate(Triangle node, Triangle endNode) {
		float dst2;
		float minDst2 = Float.POSITIVE_INFINITY;
		A_AB.set(node.a).add(node.b).scl(0.5f);
		A_BC.set(node.b).add(node.c).scl(0.5f);
		A_CA.set(node.c).add(node.a).scl(0.5f);
		B_AB.set(endNode.a).add(endNode.b).scl(0.5f);
		B_BC.set(endNode.b).add(endNode.c).scl(0.5f);
		B_CA.set(endNode.c).add(endNode.a).scl(0.5f);
		if ((dst2 = A_AB.dst2(B_AB)) < minDst2)
			minDst2 = dst2;
		if ((dst2 = A_AB.dst2(B_BC)) < minDst2)
			minDst2 = dst2;
		if ((dst2 = A_AB.dst2(B_CA)) < minDst2)
			minDst2 = dst2;
		if ((dst2 = A_BC.dst2(B_AB)) < minDst2)
			minDst2 = dst2;
		if ((dst2 = A_BC.dst2(B_BC)) < minDst2)
			minDst2 = dst2;
		if ((dst2 = A_BC.dst2(B_CA)) < minDst2)
			minDst2 = dst2;
		if ((dst2 = A_CA.dst2(B_AB)) < minDst2)
			minDst2 = dst2;
		if ((dst2 = A_CA.dst2(B_BC)) < minDst2)
			minDst2 = dst2;
		if ((dst2 = A_CA.dst2(B_CA)) < minDst2)
			minDst2 = dst2;
		return (float) Math.sqrt(minDst2);
	}
@ Override public float estimate ( Triangle node , Triangle endNode ) { float dst2 ; float minDst2 = Float . POSITIVE_INFINITY ; A_AB . set ( node . a ) . add ( node . b ) . scl ( 0.5f ) ; A_BC . set ( node . b ) . add ( node . c ) . scl ( 0.5f ) ; A_CA . set ( node . c ) . add ( node . a ) . scl ( 0.5f ) ; B_AB . set ( endNode . a ) . add ( endNode . b ) . scl ( 0.5f ) ; B_BC . set ( endNode . b ) . add ( endNode . c ) . scl ( 0.5f ) ; B_CA . set ( endNode . c ) . add ( endNode . a ) . scl ( 0.5f ) ; if ( ( dst2 = A_AB . dst2 ( B_AB ) ) < minDst2 ) minDst2 = dst2 ; if ( ( dst2 = A_AB . dst2 ( B_BC ) ) < minDst2 ) minDst2 = dst2 ; if ( ( dst2 = A_AB . dst2 ( B_CA ) ) < minDst2 ) minDst2 = dst2 ; if ( ( dst2 = A_BC . dst2 ( B_AB ) ) < minDst2 ) minDst2 = dst2 ; if ( ( dst2 = A_BC . dst2 ( B_BC ) ) < minDst2 ) minDst2 = dst2 ; if ( ( dst2 = A_BC . dst2 ( B_CA ) ) < minDst2 ) minDst2 = dst2 ; if ( ( dst2 = A_CA . dst2 ( B_AB ) ) < minDst2 ) minDst2 = dst2 ; if ( ( dst2 = A_CA . dst2 ( B_BC ) ) < minDst2 ) minDst2 = dst2 ; if ( ( dst2 = A_CA . dst2 ( B_CA ) ) < minDst2 ) minDst2 = dst2 ; return ( float ) Math . sqrt ( minDst2 ) ; }
Estimates the distance between two triangles, by calculating the distance
 between their edge midpoints.
Estimates the distance between two triangles by calculating the distance between their edge midpoints .