public void DrawLine(FPoint point1, FPoint point2, Color color, float thickness = 1f) { var distance = FPoint.Distance(point1, point2); var angle = FloatMath.Atan2(point2.Y - point1.Y, point2.X - point1.X); DrawLine(point1, distance, angle, color, thickness); }
private void DrawPolygonEdge(TextureRegion2D texture, FPoint point1, FPoint point2, Color color, float thickness) { #if DEBUG IncRenderSpriteCount(); #endif var length = FPoint.Distance(point1, point2); var angle = FloatMath.Atan2(point2.Y - point1.Y, point2.X - point1.X); var scale = new Vector2(length, thickness); internalBatch.Draw( texture: texture.Texture, position: point1.ToVec2D(), sourceRectangle: texture.Bounds, color: color, rotation: angle, scale: scale); }
public static float ToAngle(this Vector2 vector2) { // +-------------------------------> // | // | // | 3*pi/2 // | | // | | // | pi -----+----- 0 // | | // | | // | pi/2 // | // | // v // // = Counterclockwise // = East : Zero // = Radians return((FloatMath.Atan2(vector2.Y, vector2.X) + FloatMath.RAD_POS_360) % FloatMath.RAD_POS_360); }
// @see Vector2Extension.ToAngle() public float ToAngle(FPoint origin) { return((FloatMath.Atan2(Y - origin.Y, X - origin.X) + FloatMath.RAD_POS_360) % FloatMath.RAD_POS_360); }
// @see Vector2Extension.ToAngle() public float ToAngle() { return((FloatMath.Atan2(Y, X) + FloatMath.RAD_POS_360) % FloatMath.RAD_POS_360); }