• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VertexUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.andengine.opengl.util.VertexUtils的典型用法代码示例。如果您正苦于以下问题:Java VertexUtils类的具体用法?Java VertexUtils怎么用?Java VertexUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VertexUtils类属于org.andengine.opengl.util包,在下文中一共展示了VertexUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkCollision

import org.andengine.opengl.util.VertexUtils; //导入依赖的package包/类
/**
 * @param pVerticesA
 * @param pVertexCountA the number of vertices in pVerticesA
 * @param pVertexOffsetXA
 * @param pVertexOffsetYA
 * @param pVertexStrideA
 * @param pVerticesB
 * @param pVertexCountB the number of vertices in pVerticesB
 * @param pVertexOffsetXB
 * @param pVertexOffsetYB
 * @param pVertexStrideB
 * @return
 */
public static boolean checkCollision(final float[] pVerticesA, final int pVertexCountA, final int pVertexOffsetXA, final int pVertexOffsetYA, final int pVertexStrideA, final float[] pVerticesB, final int pVertexCountB, final int pVertexOffsetXB, final int pVertexOffsetYB, final int pVertexStrideB) {
	/* Check all the lines of A ... */
	for (int a = pVertexCountA - 2; a >= 0; a--) {
		/* ... against all lines in B. */
		if (BaseCollisionChecker.checkCollisionSub(pVerticesA, pVertexOffsetXA, pVertexOffsetYA, pVertexStrideA, a, a + 1, pVerticesB, pVertexCountB, pVertexOffsetXB, pVertexOffsetYB, pVertexStrideB)) {
			return true;
		}
	}
	/* Also check the 'around the corner of the array' line of A against all lines in B. */
	if (BaseCollisionChecker.checkCollisionSub(pVerticesA, pVertexOffsetXA, pVertexOffsetYA, pVertexStrideA, pVertexCountA - 1, 0, pVerticesB, pVertexCountB, pVertexOffsetXB, pVertexOffsetYB, pVertexStrideB)) {
		return true;
	} else {
		/* At last check if one polygon 'contains' the other one by checking
		 * if one vertex of the one vertices is contained by all of the other vertices. */
		if (BaseCollisionChecker.checkContains(pVerticesA, pVertexCountA, VertexUtils.getVertex(pVerticesB, pVertexOffsetXB, pVertexStrideB, 0), VertexUtils.getVertex(pVerticesB, pVertexOffsetYB, pVertexStrideB, 0))) {
			return true;
		} else if (BaseCollisionChecker.checkContains(pVerticesB, pVertexCountB, VertexUtils.getVertex(pVerticesA, pVertexOffsetXA, pVertexStrideA, 0), VertexUtils.getVertex(pVerticesA, pVertexOffsetYA, pVertexStrideA, 0))) {
			return true;
		} else {
			return false;
		}
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:37,代码来源:BaseCollisionChecker.java


示例2: checkContains

import org.andengine.opengl.util.VertexUtils; //导入依赖的package包/类
/**
 * Works with complex polygons!
 *
 * @see <a href="http://alienryderflex.com/polygon/">alienryderflex.com/polygon/</a>
 *
 * @param pVertices
 * @param pVertexCount the number of vertices in pVertices
 * @param pVertexOffsetX
 * @param pVertexOffsetY
 * @param pVertexStride
 * @param pX
 * @param pY
 * @return <code>true</code> when the point defined by <code>(pX, pY)</code> is inside the polygon defined by <code>pVertices</code>, <code>false</code>. If the point is exactly on the edge of the polygon, the result can be <code>true</code> or <code>false</code>.
 */
public static boolean checkContains(final float[] pVertices, final int pVertexCount, final int pVertexOffsetX, final int pVertexOffsetY, final int pVertexStride, final float pX, final float pY) {
	boolean odd = false;

	int j = pVertexCount - 1;
	for (int i = 0; i < pVertexCount; i++) {
		final float vertexXI = VertexUtils.getVertex(pVertices, pVertexOffsetX, pVertexStride, i);
		final float vertexYI = VertexUtils.getVertex(pVertices, pVertexOffsetY, pVertexStride, i);
		final float vertexXJ = VertexUtils.getVertex(pVertices, pVertexOffsetX, pVertexStride, j);
		final float vertexYJ = VertexUtils.getVertex(pVertices, pVertexOffsetY, pVertexStride, j);

		if ((((vertexYI < pY) && (vertexYJ >= pY)) || ((vertexYJ < pY) && (vertexYI >= pY))) && ((vertexXI <= pX) || (vertexXJ <= pX))) {
			odd ^= ((vertexXI + (((pY - vertexYI) / (vertexYJ - vertexYI)) * (vertexXJ - vertexXI))) < pX);
		}
		j = i;
	}

	return odd;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:33,代码来源:BaseCollisionChecker.java


示例3: checkCollision

import org.andengine.opengl.util.VertexUtils; //导入依赖的package包/类
/**
 * @param pVerticesA
 * @param pVertexCountA the number of vertices in pVerticesA
 * @param pVertexOffsetXA
 * @param pVertexOffsetYA
 * @param pVertexStrideA
 * @param pVerticesB
 * @param pVertexCountB the number of vertices in pVerticesB
 * @param pVertexOffsetXB
 * @param pVertexOffsetYB
 * @param pVertexStrideB
 * @return
 */
public static boolean checkCollision(final float[] pVerticesA, final int pVertexCountA, final int pVertexOffsetXA, final int pVertexOffsetYA, final int pVertexStrideA, final float[] pVerticesB, final int pVertexCountB, final int pVertexOffsetXB, final int pVertexOffsetYB, final int pVertexStrideB) {
	/* Check all the lines of A ... */
	for(int a = pVertexCountA - 2; a >= 0; a--) {
		/* ... against all lines in B. */
		if(ShapeCollisionChecker.checkCollisionSub(pVerticesA, pVertexOffsetXA, pVertexOffsetYA, pVertexStrideA, a, a + 1, pVerticesB, pVertexCountB, pVertexOffsetXB, pVertexOffsetYB, pVertexStrideB)){
			return true;
		}
	}
	/* Also check the 'around the corner of the array' line of A against all lines in B. */
	if(ShapeCollisionChecker.checkCollisionSub(pVerticesA, pVertexOffsetXA, pVertexOffsetYA, pVertexStrideA, pVertexCountA - 1, 0, pVerticesB, pVertexCountB, pVertexOffsetXB, pVertexOffsetYB, pVertexStrideB)){
		return true;
	} else {
		/* At last check if one polygon 'contains' the other one by checking
		 * if one vertex of the one vertices is contained by all of the other vertices. */
		if(ShapeCollisionChecker.checkContains(pVerticesA, pVertexCountA, VertexUtils.getVertex(pVerticesB, pVertexOffsetXB, pVertexStrideB, 0), VertexUtils.getVertex(pVerticesB, pVertexOffsetYB, pVertexStrideB, 0))) {
			return true;
		} else if(ShapeCollisionChecker.checkContains(pVerticesB, pVertexCountB, VertexUtils.getVertex(pVerticesA, pVertexOffsetXA, pVertexStrideA, 0), VertexUtils.getVertex(pVerticesA, pVertexOffsetYA, pVertexStrideA, 0))) {
			return true;
		} else {
			return false;
		}
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:37,代码来源:ShapeCollisionChecker.java


示例4: checkContains

import org.andengine.opengl.util.VertexUtils; //导入依赖的package包/类
/**
 * Works with complex polygons!
 *
 * @see http://alienryderflex.com/polygon/
 *
 * @param pVertices
 * @param pVertexCount the number of vertices in pVertices
 * @param pVertexOffsetX
 * @param pVertexOffsetY
 * @param pVertexStride
 * @param pX
 * @param pY
 * @return <code>true</code> when the point defined by <code>(pX, pY)</code> is inside the polygon defined by <code>pVertices</code>, <code>false</code>. If the point is exactly on the edge of the polygon, the result can be <code>true</code> or <code>false</code>. 
 */
public static boolean checkContains(final float[] pVertices, final int pVertexCount, final int pVertexOffsetX, final int pVertexOffsetY, final int pVertexStride, final float pX, final float pY) {
	boolean odd = false;

	int j = pVertexCount - 1;
	for(int i = 0; i < pVertexCount; i++) {
		final float vertexXI = VertexUtils.getVertex(pVertices, pVertexOffsetX, pVertexStride, i);
		final float vertexYI = VertexUtils.getVertex(pVertices, pVertexOffsetY, pVertexStride, i);
		final float vertexXJ = VertexUtils.getVertex(pVertices, pVertexOffsetX, pVertexStride, j);
		final float vertexYJ = VertexUtils.getVertex(pVertices, pVertexOffsetY, pVertexStride, j);

		if((((vertexYI < pY) && (vertexYJ >= pY)) || ((vertexYJ < pY) && (vertexYI >= pY))) && ((vertexXI <= pX) || (vertexXJ <= pX))) {
			odd ^= ((vertexXI + (((pY - vertexYI) / (vertexYJ - vertexYI)) * (vertexXJ - vertexXI))) < pX);
		}
		j = i;
	}

	return odd;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:33,代码来源:ShapeCollisionChecker.java



注:本文中的org.andengine.opengl.util.VertexUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JAXBElementProvider类代码示例发布时间:2022-05-23
下一篇:
Java DebuggerManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap