本文整理汇总了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
);
}
示例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));
}
}
示例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);
}
示例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());
}
示例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);
}
示例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));
}
}
示例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);
}
}
示例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);
}