//private constructors private GraphObject(Point center, double radius, Color c, string type) { if (type == "circle") { this._startPoint = center; this._radius = radius; this._baseColor = c; this._isCircle = true; return; } throw new Exception("Unhandled region"); }
public static GraphObject CreateCircle(Point center, double radius, Color c) { return new GraphObject(center, radius, c, "circle"); }
public void DrawSquare(Point upperLeft, double length, Color c) { //SEt Color Gl.glColor3d(c.RedScaled, c.GreenScaled, c.BlueScaled); //Set Line Width Gl.glLineWidth((float)1.0); //Set GlDrawType //Gl.glBegin(Gl.GL_LINE_STRIP); Gl.glBegin(Gl.GL_TRIANGLE_FAN); //Cycle //for (int i = 0; i < ps.Count - 1; i++) //{ var p1 = new Point(upperLeft.X, upperLeft.Y); var p2 = new Point(upperLeft.X + length, upperLeft.Y); var p3 = new Point(upperLeft.X + length, upperLeft.Y - length); var p4 = new Point(upperLeft.X, upperLeft.Y - length); //If is worth Drawing // (!ps[i].IsWithin(this._windowPos, this._windowPos.Add(this._windowSize)) && // !(ps[i + 1].IsWithin(this._windowPos, this._windowPos.Add(this._windowSize)))) //{ continue; } //Add Line Points Gl.glVertex2d(upperLeft.X, upperLeft.Y); Gl.glVertex2d(upperLeft.X + length, upperLeft.Y); Gl.glVertex2d(upperLeft.X + length, upperLeft.Y - length); Gl.glVertex2d(upperLeft.X, upperLeft.Y - length); //} //End Draw Gl.glEnd(); }
//Constructor public GraphObject(Point startPoint, Point graphSize, Color c) { this._startPoint = startPoint; this._graphSize = graphSize; this.MyColors = new List<Color> { c }; }
public void DrawPolygon(Point[] pts, Color c, double thick, bool fill, double rfill) { //set Color Gl.glColor3d(c.RedScaled, c.GreenScaled, c.BlueScaled); //Gl.glColor4f(c.redf(), c.greenf(), c.bluef(), .1f); //Set Thickness if (thick >= 1) { Gl.glLineWidth((float)thick); } //Set Fill if (!fill) { Gl.glBegin(Gl.GL_LINE_STRIP); } else { Gl.glBegin(Gl.GL_TRIANGLE_FAN); c = c.Multiply(rfill); } Gl.glColor3d(c.RedScaled, c.GreenScaled, c.BlueScaled); //Cycle Through Points around circle for (int i = 0; i < pts.Length; i++) Gl.glVertex2d(pts[i].X, pts[i].Y); Gl.glVertex2d(pts[0].X, pts[0].Y); Gl.glEnd(); Gl.glLineWidth(1f); }
public void DrawPolygonShadow(Point[] pts, Color c, double thick, double rfill) { this.DrawPolygon(pts, c, thick, true, rfill); this.DrawPolygon(pts, c, thick, false, 0); }
public void DrawLines(List<Point> ps, Color c, double thick) { this.DrawLines(ps, c, thick, false); }
public void DrawLines(List<Point> ps, Color c, double thick, bool overideDrawCheck) { //If not enough Poitns, return if (ps.Count < 2) { return; } //SEt Color Gl.glColor3d(c.RedScaled, c.GreenScaled, c.BlueScaled); //Set Line Width Gl.glLineWidth((float)thick); //Set GlDrawType Gl.glBegin(Gl.GL_LINE_STRIP); //Cycle for (int i = 0; i < ps.Count - 1; i++) { //If is worth Drawing if (!overideDrawCheck) { if (!ps[i].IsWithin(this._windowPos, this._windowPos.Add(this._windowSize)) && !(ps[i + 1].IsWithin(this._windowPos, this._windowPos.Add(this._windowSize)))) { if (!this._drawOverride) continue; } } //Add Line Points Gl.glVertex2d(ps[i].X, ps[i].Y); Gl.glVertex2d(ps[i + 1].X, ps[i + 1].Y); } //End Draw Gl.glEnd(); }
public void DrawLine(Point p1, Point p2, Color c, double thick) { //If is worth Drawing if (!p1.IsWithin(this._windowPos, this._windowPos.Add(this._windowSize)) && !p2.IsWithin(this._windowPos, this._windowPos.Add(this._windowSize))) { return; } //SEt Color Gl.glColor3d(c.RedScaled, c.GreenScaled, c.BlueScaled); //Set Line Width Gl.glLineWidth((float)thick); //Set GlDrawType Gl.glBegin(Gl.GL_LINE_STRIP); //Add Line Points Gl.glVertex2d(p1.X, p1.Y); Gl.glVertex2d(p2.X, p2.Y); //End Draw Gl.glEnd(); }
public void DrawCircleShadow(Point p, Double r, Color c) { DrawCircleShadow(p, r, c, c); }
public void DrawCircleShadow(Point p, Double r, Color c, Color fc) { DrawCircle(p, r, fc.Multiply(.25), true, 1); DrawCircle(p, r, c, false, r); }
public void DrawCircle(Point p, Double r, Color c, bool fill, double rfill) { //If is worth Drawing //if (!p.IsWithin(this._windowPos, this._windowPos.Add(this._windowSize))) //{ return; } //Set radius double radius = r; //set Color Gl.glColor3d(c.RedScaled, c.GreenScaled, c.BlueScaled); //Gl.glColor4f(c.redf(), c.greenf(), c.bluef(), .1f); //Set Thickness if (rfill >= 1) { Gl.glLineWidth((float)rfill); } //Set Fill if (!fill) { Gl.glBegin(Gl.GL_LINE_STRIP); } else { Gl.glBegin(Gl.GL_TRIANGLE_FAN); } //Get Start Points double nx = p.X; double ny = p.Y; //Cycle Through Points around circle for (double angle = 0; angle <= 360; angle += 3) { Angle da = new Angle(angle); nx = (p.X + Math.Cos(da.Radians) * radius); ny = (p.Y + Math.Sin(da.Radians) * radius); Gl.glVertex2d(nx, ny); } Gl.glEnd(); Gl.glLineWidth(1f); }
public void DrawCircle(Point p, Double r, Color c) { DrawCircle(p, r, c, false, r); ; }