public static void DrawFilledSquare(OpenGL gl, float fromX = 0.0f, float fromY = 0.0f, float toX = 0.0f, float toY = 0.0f, float sX = 1.0f *BrettDisplay.DISP_RAT_MULT_X_TO_Y, float sY = 1.0f, float r = BrettDisplay.R_DEFAULT, float g = BrettDisplay.G_DEFAULT, float b = BrettDisplay.B_DEFAULT, float linewidth = BrettDisplay.LINEWIDTH_DEFAULT, int?q = null) { float w = (toX - fromX); float h = (toY - fromY); float x = (fromX + w / 2.0f); float y = (fromY + h / 2.0f); Quality = q == null ? Quality : (int)q; gl.LineWidth(linewidth); gl.Color(r, g, b); for (int sample = 0; sample < Quality; sample++) { float y1 = h * sample / Quality; BrettLine.Draw(gl, fromX, (fromY + sY * y1), toX, (fromY + sY * y1), r, g, b, linewidth); } }
public static void DrawFilledCrazy(OpenGL gl, float fromX = 0.0f, float fromY = 0.0f, float toX = 0.0f, float toY = 0.0f, float sX = 1.0f *BrettDisplay.DISP_RAT_MULT_X_TO_Y, float sY = 1.0f, float r = BrettDisplay.R_DEFAULT, float g = BrettDisplay.G_DEFAULT, float b = BrettDisplay.B_DEFAULT, float linewidth = BrettDisplay.LINEWIDTH_DEFAULT, int?q = null) { float w = (toX - fromX) * sX; float h = (toY - fromY) * sY; float x = (fromX + w / 2.0f) * sX; float y = (fromY + h / 2.0f) * sY; Quality = q == null ? Quality : (int)q; gl.LineWidth(linewidth); gl.Color(r, g, b); for (int sample = -Quality; sample < Quality; sample++) { float x1 = -(0.5f * w); float y1 = (h * sample / Quality); float x2 = (0.5f * w); float y2 = (h * sample / Quality); BrettLine.Draw(gl, fromX + sX * x1, fromY + sY * y1, toX + sX * x2, toY + sY * y2, r, g, b, linewidth); } }
public static void DrawFilled(OpenGL gl, float X = 0.0f, float Y = 0.0f, float sX = 1.0f *BrettDisplay.DISP_RAT_MULT_X_TO_Y, float sY = 1.0f, float w = 0.5f, float h = 0.5f, float r = BrettDisplay.R_DEFAULT, float g = BrettDisplay.G_DEFAULT, float b = BrettDisplay.B_DEFAULT, float linewidth = BrettDisplay.LINEWIDTH_DEFAULT, float rotation = 0.0f, int?q = null) { Quality = q == null ? Quality : (int)q; gl.LineWidth(linewidth); gl.Color(r, g, b); for (int sample = -Quality; sample < Quality; sample++) { float x1 = -(0.5f * w); float y1 = (h * sample / Quality); float x2 = (0.5f * w); float y2 = (h * sample / Quality); BrettLine.Draw(gl, X + sX * (x1 * Utilities.Cos(rotation) - y1 * Utilities.Sin(rotation)), Y + sY * (x1 * Utilities.Sin(rotation) + y1 * Utilities.Cos(rotation)), X + sX * (x2 * Utilities.Cos(rotation) - y2 * Utilities.Sin(rotation)), Y + sY * (x2 * Utilities.Sin(rotation) + y2 * Utilities.Cos(rotation)), r, g, b, linewidth); } }
public static void DrawLine(OpenGL gl, float radius = 0.5f, float X = 0.0f, float Y = 0.0f, float sX = 1.0f, float sY = 1.0f, float a1 = 0.0f, float a2 = 360.0f, float r = BrettDisplay.R_DEFAULT, float g = BrettDisplay.G_DEFAULT, float b = BrettDisplay.B_DEFAULT, float linewidth = BrettDisplay.LINEWIDTH_DEFAULT, float rotation = 0.0f, int?q = null) { Quality = q == null ? Quality : (int)q; // TBD rotation for (int sample = 0; sample < Quality + 1; sample++) { BrettLine.Draw(gl, X + sX * radius * Utilities.Cos(a1 + (sample) * (a1 - a2) / Quality + Cosmetic), Y + sY * radius * Utilities.Sin(a1 + (sample) * (a1 - a2) / Quality + Cosmetic), X + sX * radius * Utilities.Cos(a1 + (sample + 1) * (a1 - a2) / Quality - Cosmetic), Y + sY * radius * Utilities.Sin(a1 + (sample + 1) * (a1 - a2) / Quality - Cosmetic), r, g, b, linewidth); } }
public static void DrawFilled(OpenGL gl, float radius = 0.5f, float X = 0.0f, float Y = 0.0f, float sX = 1.0f *BrettDisplay.DISP_RAT_MULT_X_TO_Y, float sY = 1.0f, float a1 = 0.0f, float a2 = 360.0f, float r = BrettDisplay.R_DEFAULT, float g = BrettDisplay.G_DEFAULT, float b = BrettDisplay.B_DEFAULT, float linewidth = BrettDisplay.LINEWIDTH_DEFAULT, float rotation = 0.0f, int?q = null) { Quality = q == null ? Quality : (int)q; // TBD rotation for (int sample = -1; sample < Quality; sample++) { BrettLine.Draw(gl, X, Y, X + sX * radius * Utilities.Cos(a1 + sample * (a2 - a1) / Quality), Y + sY * radius * Utilities.Sin(a1 + sample * (a2 - a1) / Quality), r, g, b, linewidth); } }
public static void DrawLine(OpenGL gl, float X = 0.0f, float Y = 0.0f, float sX = 1.0f *BrettDisplay.DISP_RAT_MULT_X_TO_Y, float sY = 1.0f, float w = 0.5f, float h = 0.5f, float r = BrettDisplay.R_DEFAULT, float g = BrettDisplay.G_DEFAULT, float b = BrettDisplay.B_DEFAULT, float linewidth = BrettDisplay.LINEWIDTH_DEFAULT, float rotation = 0.0f, int?q = null) { gl.LineWidth(linewidth); gl.Color(r, g, b); float x1 = -(0.5f * w); float y1 = -(0.5f * h); float x2 = (0.5f * w); float y2 = -(0.5f * h); float x3 = (0.5f * w); float y3 = (0.5f * h); float x4 = -(0.5f * w); float y4 = (0.5f * h); BrettLine.Draw(gl, X + sX * Utilities.Rot(rotation, x1, y1).X, Y + sY * Utilities.Rot(rotation, x1, y1).Y, X + sX * Utilities.Rot(rotation, x2, y2).X, Y + sY * Utilities.Rot(rotation, x2, y2).Y, r, g, b, linewidth); BrettLine.Draw(gl, X + sX * Utilities.Rot(rotation, x2, y2).X, Y + sY * Utilities.Rot(rotation, x2, y2).Y, X + sX * Utilities.Rot(rotation, x3, y3).X, Y + sY * Utilities.Rot(rotation, x3, y3).Y, r, g, b, linewidth); BrettLine.Draw(gl, X + sX * Utilities.Rot(rotation, x3, y3).X, Y + sY * Utilities.Rot(rotation, x3, y3).Y, X + sX * Utilities.Rot(rotation, x4, y4).X, Y + sY * Utilities.Rot(rotation, x4, y4).Y, r, g, b, linewidth); BrettLine.Draw(gl, X + sX * Utilities.Rot(rotation, x4, y4).X, Y + sY * Utilities.Rot(rotation, x4, y4).Y, X + sX * Utilities.Rot(rotation, x1, y1).X, Y + sY * Utilities.Rot(rotation, x1, y1).Y, r, g, b, linewidth); }