public static void DrawSolidTriangle(SpriteBatch spriteBatch, float width, Color color, Vector2 pointA, Vector2 pointB, Vector2 pointC) { float[] arrX = { pointA.X, pointB.X, pointC.X }; float[] arrY = { pointA.Y, pointB.Y, pointC.Y }; float minX = arrX.Min(); float maxX = arrX.Max(); float minY = arrY.Min(); float maxY = arrY.Max(); for (int Pointy = (int)minY; Pointy <= maxY; Pointy++) { for (int Pointx = (int)minX; Pointx < maxX; Pointx++) { if (IsInTriangle(new Vector2(Pointx, Pointy), pointA, pointB, pointC)) { LineDrawer.DrawPixel(spriteBatch, color, new Vector2(Pointx, Pointy)); } } } }
public static void DrawArc(SpriteBatch spriteBatch, float width, Color color, Vector2 Position, float OuterRadius, float InnerRadius, float Arc, float Rotation, int Sides) { float degrees = Arc / Sides; Vector2 OuterStart = AngleToV2(Rotation - Arc / 2, OuterRadius); Vector2 OuterEnd = AngleToV2(Rotation + Arc / 2, OuterRadius); Vector2 InnerStart = AngleToV2(Rotation - Arc / 2, InnerRadius); Vector2 InnerEnd = AngleToV2(Rotation + Arc / 2, InnerRadius); if (Sides < 3) { Sides = 12; } // Draw the Side of the Arc LineDrawer.DrawLine(spriteBatch, width, color, Position + OuterStart, Position + InnerStart); LineDrawer.DrawLine(spriteBatch, width, color, Position + OuterEnd, Position + InnerEnd); if (InnerRadius > 0) { LineDrawer.DrawLine(spriteBatch, width, color, Position + InnerStart, Position + InnerEnd); } Vector2 Next; Vector2 Previous = OuterStart; for (int i = 1; i < Sides; i++) { /// This is drawing the circle Counter Clock Wise) Next = AngleToV2((i * degrees) + (Rotation - Arc / 2), OuterRadius); LineDrawer.DrawLine(spriteBatch, width, color, Position + Previous, Position + Next); // Debug Line //Console.WriteLine(i+"*" + (i * degrees) + "::" + Previous + "::" + Next); Previous = Next; } LineDrawer.DrawLine(spriteBatch, width, color, Position + Previous, Position + OuterEnd); }
public static void DrawSolidTriangle(SpriteBatch spriteBatch, float width, Color color, Vector2 pointA, Vector2 pointB, Vector2 pointC) { float[] arrayX = { pointA.X, pointB.X, pointC.X }; float[] arrayY = { pointA.Y, pointB.Y, pointC.Y }; float xMin = arrayX.Min(); float xMax = arrayX.Max(); float yMin = arrayY.Min(); float yMax = arrayY.Max(); for (int yPt = (int)yMin; yPt <= yMax; yPt++) { for (int xPt = (int)xMin; xPt <= xMax; xPt++) { if (InTriangle(new Vector2(xPt, yPt), pointA, pointB, pointC)) { LineDrawer.DrawPixel(spriteBatch, color, new Vector2(xPt, yPt)); } } } }
public static void DrawEllipse(SpriteBatch spriteBatch, float width, Color color, Vector2 Position, Vector2 Axis, float Rotation, Vector2 Center, int Sides) { Vector2 RoationCenter = Vector2.Zero; if (Center != Vector2.Zero) { RoationCenter = Center - Position; } Vector2 Starting = RotatePoint(RoationCenter, Rotation, new Vector2(Axis.X, 0)); Vector2 Next; Vector2 Previous = Starting; float degrees = 360 / Sides; //Console.WriteLine(degrees); if (Sides < 3) { Sides = 36; } for (int i = 1; i < Sides; i++) { /// This is drawing the circle Counter Clock Wise) Next = RotatePoint(RoationCenter, Rotation, AngleToEllipseV2((i * degrees), 1.0f, Axis)); LineDrawer.DrawLine2(spriteBatch, width, color, Position + Previous, Position + Next); // Debug Line //Console.WriteLine(i+"*" + (i * degrees) + "::" + Previous + "::" + Next); Previous = Next; } LineDrawer.DrawLine2(spriteBatch, width, color, Position + Previous, Position + Starting); }
public static void DrawSolidRectangle(SpriteBatch spriteBatch, Color color, Rectangle Rec, float Roation, Vector2 Center) { float width = Rec.Width; LineDrawer.DrawLine(spriteBatch, width, color, RotatePoint(Center, Roation, new Vector2(Rec.Center.X, Rec.Bottom)), RotatePoint(Center, Roation, new Vector2(Rec.Center.X, Rec.Top))); }
public static void DrawSolidRectangle(SpriteBatch spriteBatch, Color color, Rectangle Rec) { float width = Rec.Width; LineDrawer.DrawLine(spriteBatch, width, color, new Vector2(Rec.Center.X, Rec.Bottom), new Vector2(Rec.Center.X, Rec.Top)); }
public static void DrawTriangle(SpriteBatch spriteBatch, float width, Color color, Vector2 pointA, Vector2 pointB, Vector2 pointC) { LineDrawer.DrawLine(spriteBatch, width, color, pointA, pointB); LineDrawer.DrawLine(spriteBatch, width, color, pointB, pointC); LineDrawer.DrawLine(spriteBatch, width, color, pointC, pointA); }
public void Draw(SpriteBatch spriteBatch, Vector2 Offset, float Rotation, Vector2 Scale) { // TO DO: Add in code for Rotation around a Point that is not the Origin LineDrawer.DrawLine(spriteBatch, width, color, LinePrimatives.RotatePoint(Vector2.Zero, Rotation, startPoint * Scale) + Offset, LinePrimatives.RotatePoint(Vector2.Zero, Rotation, endPoint * Scale) + Offset); }
public void Draw(SpriteBatch spriteBatch, Vector2 Offset) { // TO DO: Add in code for Rotation around a Point that is not the Origin LineDrawer.DrawLine(spriteBatch, width, color, startPoint + Offset, endPoint + Offset); }
public void Draw(SpriteBatch spriteBatch) { LineDrawer.DrawLine(spriteBatch, width, color, startPoint, endPoint); }