当前位置: 首页>>代码示例>>Java>>正文


Java GeometryUtils类代码示例

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


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

示例1: calculatePolygonCentroid

import com.badlogic.gdx.math.GeometryUtils; //导入依赖的package包/类
/**
 * Calculate the centroid of a polygon defined by its vertices
 * @param vertices Array of polygon vertices
 * @return Vector2 containing x and y coordinates of the centroid
 */
private Vector2 calculatePolygonCentroid(float[] vertices) {
    Vector2 polygonCentroid = new Vector2();

    GeometryUtils.polygonCentroid(vertices, 0, vertices.length, polygonCentroid);
    return polygonCentroid;
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:12,代码来源:GameScene.java

示例2: TrapOriginator

import com.badlogic.gdx.math.GeometryUtils; //导入依赖的package包/类
public TrapOriginator(TrapLocation trapLocation, float[] vertices) {
	this(trapLocation.getInternalId(), trapLocation.getTrap().getType().getName(), trapLocation.getMap(), trapLocation);
	isTrapLocation = true;
	Vector2 polygonCenter = GeometryUtils.polygonCentroid(vertices, 0, vertices.length, MathUtil.getVector2());
	position().set(polygonCenter);
	MathUtil.freeVector2(polygonCenter);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:8,代码来源:TrapOriginator.java

示例3: ensureClockWise

import com.badlogic.gdx.math.GeometryUtils; //导入依赖的package包/类
static public void ensureClockWise (float[] polygon, int offset, int count) {
	if (GeometryUtils.isClockwise(polygon, offset, count)) return;
	int lastX = offset + count - 2;
	for (int i = offset, n = offset + count / 2; i < n; i += 2) {
		int other = lastX - i;
		float x = polygon[i];
		float y = polygon[i + 1];
		polygon[i] = polygon[other];
		polygon[i + 1] = polygon[other + 1];
		polygon[other] = x;
		polygon[other + 1] = y;
	}
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:14,代码来源:PolygonUtils.java

示例4: getCenterX

import com.badlogic.gdx.math.GeometryUtils; //导入依赖的package包/类
@Override
public float getCenterX() {
	if(centroidDirty) {
		GeometryUtils.polygonCentroid(vertices, 0, vertices.length, centroid);
		centroidDirty = false;
	}
	return centroid.x;
}
 
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:9,代码来源:Polygon.java

示例5: getCenterY

import com.badlogic.gdx.math.GeometryUtils; //导入依赖的package包/类
@Override
public float getCenterY() {
	if(centroidDirty) {
		GeometryUtils.polygonCentroid(vertices, 0, vertices.length, centroid);
		centroidDirty = false;
	}
	return centroid.y;
}
 
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:9,代码来源:Polygon.java


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