本文整理汇总了Java中com.badlogic.gdx.math.MathUtils.sinDeg方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtils.sinDeg方法的具体用法?Java MathUtils.sinDeg怎么用?Java MathUtils.sinDeg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.math.MathUtils
的用法示例。
在下文中一共展示了MathUtils.sinDeg方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cos
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
/**
* //use degress
Rotation, equals
cos(angle) sin(angle) 0
-sin(angle) cos(angle) 0 * AffineTransform
0 0 1
*/
public static final AffineTransform AffineTransformRotate(final AffineTransform t, float anAngle, AffineTransform out) {
float sine = MathUtils.sinDeg(anAngle);
float cosine = MathUtils.cosDeg(anAngle);
return AffineTransformMakeOut(t.a * cosine + t.c * sine,
t.b * cosine + t.d * sine,
t.c * cosine - t.a * sine,
t.d * cosine - t.b * sine,
t.tx,
t.ty, out);
}
示例2: progress
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
public void progress(float cx, float cy, float r, float thickness, float amt, Color c, Texture lookup) {
//start and end angles
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z);
}
renderer.end();
}
示例3: progress
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
public void progress(float cx, float cy, float r, float thickness, float amt, Color c, Texture lookup) {
//start and end angles
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
//renderer.
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z);
}
renderer.end();
}
示例4: renderCercle
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
public void renderCercle(OrthographicCamera camera,float amt, Color c){
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(camera.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
//renderer.
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z);
}
renderer.end();
}
示例5: apply
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
@Override
protected int apply (float[] vertices, int vertexStartingIndex, AttributeOffsets offsets, int vertexSize) {
super.apply(vertices, vertexStartingIndex, offsets, vertexSize);
final PolygonRegion region = this.region;
final TextureRegion tRegion = region.getRegion();
final float originX = this.originX;
final float originY = this.originY;
final float scaleX = this.scaleX;
final float scaleY = this.scaleY;
final float[] regionVertices = region.getVertices();
final float worldOriginX = x + originX;
final float worldOriginY = y + originY;
final float sX = width / tRegion.getRegionWidth();
final float sY = height / tRegion.getRegionHeight();
final float cos = MathUtils.cosDeg(rotation);
final float sin = MathUtils.sinDeg(rotation);
float fx, fy;
for (int i = 0, v = vertexStartingIndex + offsets.position, n = regionVertices.length; i < n; i += 2, v += vertexSize) {
fx = (regionVertices[i] * sX - originX) * scaleX;
fy = (regionVertices[i + 1] * sY - originY) * scaleY;
vertices[v] = cos * fx - sin * fy + worldOriginX;
vertices[v + 1] = sin * fx + cos * fy + worldOriginY;
}
return numVertices;
}
示例6: renderCercleRecharge
import com.badlogic.gdx.math.MathUtils; //导入方法依赖的package包/类
public void renderCercleRecharge(OrthographicCamera camera,float amt, Color c){
float start = 0f;
float end = amt * 360f;
lookup.bind();
renderer.begin(camera.combined, GL20.GL_TRIANGLE_STRIP);
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int segs = (int)(24 * Math.cbrt(r));
end += 90f;
start += 90f;
float halfThick = thickness/2f;
float step = 360f / segs;
for (float angle=start; angle<(end+step); angle+=step) {
float tc = 0.5f;
if (angle==start)
tc = 0f;
else if (angle>=end)
tc = 1f;
float fx = MathUtils.cosDeg(angle);
float fy = MathUtils.sinDeg(angle);
float z = 0f;
//renderer.
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 1f);
renderer.vertex(c1x + fx * (r + halfThick), c1y + fy * (r + halfThick), z);
renderer.color(c.r, c.g, c.b, c.a);
renderer.texCoord(tc, 0f);
renderer.vertex(c1x + fx * (r + -halfThick), c1y + fy * (r + -halfThick), z);
}
renderer.end();
}