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


Java TrigMath.sin方法代码示例

本文整理汇总了Java中com.flowpowered.math.TrigMath.sin方法的典型用法代码示例。如果您正苦于以下问题:Java TrigMath.sin方法的具体用法?Java TrigMath.sin怎么用?Java TrigMath.sin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.flowpowered.math.TrigMath的用法示例。


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

示例1: eulerRad

import com.flowpowered.math.TrigMath; //导入方法依赖的package包/类
public static Quaterniond eulerRad(Vector3d vector3d) {
	//https://gist.github.com/aeroson/043001ca12fe29ee911e
	double yaw = vector3d.getX();
	double pitch = vector3d.getY();
	double roll = vector3d.getZ();

	double rollOver2 = roll * 0.5f;
	double sinRollOver2 = TrigMath.sin(rollOver2);
	double cosRollOver2 = TrigMath.cos(rollOver2);
	double pitchOver2 = pitch * 0.5f;
	double sinPitchOver2 = TrigMath.sin(pitchOver2);
	double cosPitchOver2 = TrigMath.cos(pitchOver2);
	double yawOver2 = yaw * 0.5f;
	double sinYawOver2 = TrigMath.sin(yawOver2);
	double cosYawOver2 = TrigMath.cos(yawOver2);
	return new Quaterniond(
			cosYawOver2 * cosPitchOver2 * cosRollOver2 + sinYawOver2 * sinPitchOver2 * sinRollOver2,
			cosYawOver2 * cosPitchOver2 * sinRollOver2 - sinYawOver2 * sinPitchOver2 * cosRollOver2,
			cosYawOver2 * sinPitchOver2 * cosRollOver2 + sinYawOver2 * cosPitchOver2 * sinRollOver2,
			sinYawOver2 * cosPitchOver2 * cosRollOver2 - cosYawOver2 * sinPitchOver2 * sinRollOver2
	);
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:23,代码来源:VectorUtils.java

示例2: spiral

import com.flowpowered.math.TrigMath; //导入方法依赖的package包/类
@Override
public void spiral(double radius, double points, double fullrot,
				   double rotation,
				   Consumer<Vector3d> cb) {
	double a = radius / points;
	double s = fullrot / points;
	double arad = s * TrigMath.TWO_PI;
	rotation *= TrigMath.TWO_PI; //torad
	for (double i = 1; i <= points; i++) {
		double dist = i * a;
		double angle = i * arad + rotation;
		double x = TrigMath.cos(angle) * dist;
		double y = TrigMath.sin(angle) * dist;
		cb.accept(new Vector3d(x, 0, y));
	}
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:17,代码来源:ParticleDecorator.java

示例3: rotateAroundAxisX

import com.flowpowered.math.TrigMath; //导入方法依赖的package包/类
public static Vector3d rotateAroundAxisX(Vector3d v, double angle) {
	double sin = TrigMath.sin(angle);
	double cos = TrigMath.cos(angle);
	double y = v.getY() * cos - v.getZ() * sin;
	double z = v.getY() * sin + v.getZ() * cos;
	return new Vector3d(v.getX(), y, z);
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:8,代码来源:VectorUtils.java

示例4: rotateAroundAxisZ

import com.flowpowered.math.TrigMath; //导入方法依赖的package包/类
public static Vector3d rotateAroundAxisZ(Vector3d v, double angle) {
	double cos = TrigMath.cos(angle);
	double sin = TrigMath.sin(angle);
	double x = v.getX() * cos - v.getY() * sin;
	double y = v.getX() * sin + v.getY() * cos;
	return new Vector3d(x, y, v.getZ());
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:8,代码来源:VectorUtils.java

示例5: rotateAroundAxisY

import com.flowpowered.math.TrigMath; //导入方法依赖的package包/类
public static Vector3d rotateAroundAxisY(Vector3d v, double angle) {
	double cos = TrigMath.cos(angle);
	double sin = TrigMath.sin(angle);
	double z = v.getX() * -sin + v.getZ() * cos;
	double x = v.getX() * cos + v.getZ() * sin;
	return new Vector3d(x, v.getY(), z);
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:8,代码来源:VectorUtils.java

示例6: circle

import com.flowpowered.math.TrigMath; //导入方法依赖的package包/类
@Override
public void circle(Location location, int count, double radius, Consumer<Location> callback) {
	Extent e = location.getExtent();
	double increment = TrigMath.TWO_PI / count;
	for (int i = 0; i < count; i++) {
		double angle = i * increment;
		double x = location.getX() + radius * TrigMath.cos(angle);
		double z = location.getZ() + radius * TrigMath.sin(angle);
		callback.accept(new Location(e, x, location.getY(), z));
	}
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:12,代码来源:ParticleDecorator.java

示例7: fillCircle

import com.flowpowered.math.TrigMath; //导入方法依赖的package包/类
public void fillCircle(Vector3d[] d, double radius) {
	double increment = TrigMath.TWO_PI / d.length;
	for (int i = 0; i < d.length; i++) {
		double angle = i * increment;
		double x = radius * TrigMath.cos(angle);
		double z = radius * TrigMath.sin(angle);
		d[i] = new Vector3d(x, 0, z);
	}
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:10,代码来源:ParticleDecorator.java

示例8: computeRotatedPoints

import com.flowpowered.math.TrigMath; //导入方法依赖的package包/类
private static PointSet.Four<Vector2d> computeRotatedPoints(double width, double height, double radians) {
    Vector2d bottomLeft = Vector2d.ZERO;
    Vector2d bottomRight = new Vector2d(width, 0);
    Vector2d topRight = new Vector2d(width, height);
    Vector2d topLeft = new Vector2d(0, height);
    double sin = TrigMath.sin(radians);
    double cos = TrigMath.cos(radians);
    bottomLeft = Maths.rotate(bottomLeft, sin, cos);
    bottomRight = Maths.rotate(bottomRight, sin, cos);
    topRight = Maths.rotate(topRight, sin, cos);
    topLeft = Maths.rotate(topLeft, sin, cos);
    return PointSet.Four.create(bottomLeft, bottomRight, topRight, topLeft);
}
 
开发者ID:TechShroom,项目名称:EmergencyLanding,代码行数:14,代码来源:Rectangle.java


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