Private
Public Access
Added deg mode to RegularPolygon
This commit is contained in:
1 parent
ef65a52196
commit
48690f463f
1 file changed
+5
-2
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
@@ -165,9 +165,12 @@ namespace Advanced_Software_Engineering {
|
||||
protected double offset;
|
||||
List<Point> points;
|
||||
|
||||
public RegularPolygon(Drawer drawer, int sides, double scale, double offset = 0) {
|
||||
public RegularPolygon(Drawer drawer, int sides, double scale, double offset = 0, bool degMode = true) {
|
||||
points = new List<Point>();
|
||||
|
||||
//if in degMode, convert the offset to radians
|
||||
if (degMode) offset = Math.PI * offset / 180;
|
||||
|
||||
double constantAngleDelta = 2 * Math.PI / sides;
|
||||
for (int side = 0; side < sides; side++) {
|
||||
double angle = (constantAngleDelta * side) + offset;
|
||||
|
||||
Reference in new issue
Block a user