public float getInterpolation(float input) { return (float) Math.sin(input * (Math.PI / 2f)); } };
public static double sin(double a){ return Math.sin(a); }
/** Sets the rotation of this transform * @param angle angle in radians */ public void setRotation (float angle) { float c = (float)Math.cos(angle), s = (float)Math.sin(angle); vals[COS] = c; vals[SIN] = s; }
/** Rotates the Vector2 by the given angle, counter-clockwise assuming the y-axis points up. * @param radians the angle in radians */ public Vector2 rotateRad (float radians) { float cos = (float)Math.cos(radians); float sin = (float)Math.sin(radians); float newX = this.x * cos - this.y * sin; float newY = this.x * sin + this.y * cos; this.x = newX; this.y = newY; return this; }
/** Rotates the Vector2 by the given angle, counter-clockwise assuming the y-axis points up. * @param radians the angle in radians */ public Vector2 rotateRad (float radians) { float cos = (float)Math.cos(radians); float sin = (float)Math.sin(radians); float newX = this.x * cos - this.y * sin; float newY = this.x * sin + this.y * cos; this.x = newX; this.y = newY; return this; }
/** Sets the rotation of this transform * @param angle angle in radians */ public void setRotation (float angle) { float c = (float)Math.cos(angle), s = (float)Math.sin(angle); vals[COS] = c; vals[SIN] = s; }
@Override public float getInterpolation(float t) { if (t == 0) return 0; if (t >= 1) return 1; float p=.3f; float s=p/4; return ((float)Math.pow(2,-10*t) * (float)Math.sin( (t-s)*(2*(float)Math.PI)/p) + 1); } }
var rad = function(x) { return x * Math.PI / 180; }; var getDistance = function(p1, p2) { var R = 6378137; // Earth’s mean radius in meter var dLat = rad(p2.lat() - p1.lat()); var dLong = rad(p2.lng() - p1.lng()); var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) * Math.sin(dLong / 2) * Math.sin(dLong / 2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); var d = R * c; return d; // returns the distance in meter };
public float getInterpolation(float input) { if (input == 0) { return 0f; } else if (input == 1) { return 1f; } float p = 0.3f; float s = p / DOUBLE_PI * (float) Math.asin(1f); return -((float) Math.pow(2f, 10f * (input -= 1f)) *(float) Math.sin((input - s) * DOUBLE_PI / p)); } };
public float getInterpolation(float input) { if (input == 0) { return 0f; } else if (input == 1) { return 1f; } float p = 0.3f; float s = p / DOUBLE_PI * (float) Math.asin(1f); return 1f + (float) Math.pow(2f, -10f * input) * (float) Math.sin((input - s) * DOUBLE_PI / p); } };
public static void getPosition(MPPointF center, float dist, float angle, MPPointF outputPoint){ outputPoint.x = (float) (center.x + dist * Math.cos(Math.toRadians(angle))); outputPoint.y = (float) (center.y + dist * Math.sin(Math.toRadians(angle))); }
public void getPosition(MPPointF center, float dist, float angle, MPPointF outputPoint) { outputPoint.x = (float) (center.x + dist * Math.cos(Math.toRadians(angle))); outputPoint.y = (float) (center.y + dist * Math.sin(Math.toRadians(angle))); }
private GreatCircleDistanceToPoint(double latitude, double longitude) { double radianLatitude = toRadians(latitude); this.sinLatitude = sin(radianLatitude); this.cosLatitude = cos(radianLatitude); this.radianLongitude = toRadians(longitude); }
private static void squigglyHorizontalPath(Path path, float left, float right, float centerY, float amplitude, float periodDegrees) { path.reset(); float y; path.moveTo(left, centerY); float period = (float) (2 * Math.PI / periodDegrees); for (float x = 0; x <= right - left; x += 1) { y = (float) (amplitude * Math.sin(40 + period * x) + centerY); path.lineTo(left + x, y); } } }
private static int longitudeToTileY(double latitude, long mapSize) { double sinLatitude = Math.sin(latitude * Math.PI / 180); double y = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI); return axisToCoordinates(y, mapSize); }
@Override protected ExprEval eval(double param) { return ExprEval.of(Math.sin(param)); } }
/** Sets the quaternion components from the given axis and angle around that axis. * @param x X direction of the axis * @param y Y direction of the axis * @param z Z direction of the axis * @param radians The angle in radians * @return This quaternion for chaining. */ public Quaternion setFromAxisRad (final float x, final float y, final float z, final float radians) { float d = Vector3.len(x, y, z); if (d == 0f) return idt(); d = 1f / d; float l_ang = radians < 0 ? MathUtils.PI2 - (-radians % MathUtils.PI2) : radians % MathUtils.PI2; float l_sin = (float)Math.sin(l_ang / 2); float l_cos = (float)Math.cos(l_ang / 2); return this.set(d * x * l_sin, d * y * l_sin, d * z * l_sin, l_cos).nor(); }
/** Sets the quaternion components from the given axis and angle around that axis. * @param x X direction of the axis * @param y Y direction of the axis * @param z Z direction of the axis * @param radians The angle in radians * @return This quaternion for chaining. */ public Quaternion setFromAxisRad (final float x, final float y, final float z, final float radians) { float d = Vector3.len(x, y, z); if (d == 0f) return idt(); d = 1f / d; float l_ang = radians < 0 ? MathUtils.PI2 - (-radians % MathUtils.PI2) : radians % MathUtils.PI2; float l_sin = (float)Math.sin(l_ang / 2); float l_cos = (float)Math.cos(l_ang / 2); return this.set(d * x * l_sin, d * y * l_sin, d * z * l_sin, l_cos).nor(); }
@Description("sine") @ScalarFunction @SqlType(StandardTypes.DOUBLE) public static double sin(@SqlType(StandardTypes.DOUBLE) double num) { return Math.sin(num); }