public static Vector2 DirectionFromAngle(float angle) { //float _x = (float)Math.Cos(angle); //float _y = (float)Math.Sin(angle); angle = DevMath.DegToRad(angle); return(new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle))); }
public static Vector2 DirectionFromAngle(float angle) { var x = (float)Math.Cos(DevMath.DegToRad(angle)); var y = (float)Math.Sin(DevMath.DegToRad(angle)); return(new Vector2(x, y)); }
public static Vector2 DirectionFromAngle(float angle) { // Cos en sin. Hier dan dus devmath gebruiken ipv math? sinds ik de DegToRad toch al heb geschreven int dX = (float)Math.Cos(DevMath.DegToRad(angle)); int dY = (float)Math.Sin(DevMath.DegToRad(angle)); return(new Vector2(dX, dY)); }
public static Vector2 DirectionFromAngle(float angle) { float x = 1f; float y = 0f; return(new Vector2(x * ( float )Math.Cos(DevMath.DegToRad(angle)) - y * ( float )Math.Sin(DevMath.DegToRad(angle)), x * ( float )Math.Sin(DevMath.DegToRad(angle)) - y * ( float )Math.Cos(DevMath.DegToRad(angle)))); }
public static Vector2 DirectionFromAngle(float angle) { float radians = DevMath.DegToRad(angle); float newX = (float)Math.Cos(radians); float newY = (float)Math.Sin(radians); return(new Vector2(newX, newY)); }
public static float Lerp(float a, float b, float t) { t = DevMath.Clamp(t, 0, 1); //eerst clampen dan lerpen return(a + (b - a) * t); //andere optie: //return(a *(1 - t) + b * t); }
public static Matrix4x4 RotateZ(float rotation) { Matrix4x4 mat = new Matrix4x4(); float cos = (float)Math.Cos(DevMath.DegToRad(rotation)); float sin = (float)Math.Sin(DevMath.DegToRad(rotation)); mat.m[0][0] = cos; mat.m[0][1] = -sin; mat.m[1][0] = sin; mat.m[1][1] = cos; mat.m[2][2] = 1; mat.m[3][3] = 1; return mat; }
public static Vector4 Lerp(Vector4 a, Vector4 b, float t) { return(new Vector4(DevMath.Lerp(a.x, b.x, t), DevMath.Lerp(a.y, b.y, t), DevMath.Lerp(a.z, b.z, t), DevMath.Lerp(a.w, b.w, t))); }
public static Vector2 DirectionFromAngle(float angle) { double rad = DevMath.DegToRad(angle); return(new Vector2((float)Math.Cos(rad), (float)Math.Sin(rad))); }
public static float Angle(Vector2 lhs, Vector2 rhs) { Vector2 v = lhs - rhs; return(DevMath.RadToDeg((float)Math.Atan2(v.x, v.y))); }
public static Vector4 Lerp(Vector4 a, Vector4 b, float t) { DevMath.Clamp(t, 0, 1); return(a * (1 - t) + b * t); }
public static Vector2 DirectionFromAngle(float angle) //in radians { angle = DevMath.DegToRad(angle); return(new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle))); }
public static Vector2 Lerp(Vector2 a, Vector2 b, float t) { t = DevMath.Clamp01(t); Vector2 v = new Vector2((b.x - a.x), (b.y - a.y)); return a + (v * t); }
public static Vector2 DirectionFromAngle(float angle) { return(new Vector2((float)Math.Cos(DevMath.DegToRad(angle)), (float)Math.Sin(DevMath.DegToRad(angle)))); //throw new NotImplementedException(); }
public static Vector3 Lerp(Vector3 a, Vector3 b, float t) { return(new Vector3(DevMath.Lerp(a.x, b.x, t), DevMath.Lerp(a.y, b.y, t), DevMath.Lerp(a.z, b.z, t))); }
public static Vector2 Lerp(Vector2 a, Vector2 b, float t) { return(new Vector2(DevMath.Lerp(a.x, b.x, t), DevMath.Lerp(a.y, b.y, t))); }
public static Vector2 DirectionFromAngle(float angle) { //Insert degrees and get a vector2 float a = DevMath.DegToRad(angle); return new Vector2((float)Math.Cos(a), (float)Math.Sin(a)); }
public static Vector4 Lerp(Vector4 a, Vector4 b, float t) { t = DevMath.Clamp(t, 0, 1); return(a + (b - a) * t); }
public static Vector2 DirectionFromAngle(float angle) { float r_angle = DevMath.DegToRad(angle); return(new Vector2((float)Math.Cos(r_angle), (float)Math.Sin(r_angle))); }