aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-05-02 23:57:37 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-05-02 23:57:37 +0200
commitf07b0c28f6c4c49b742b1dfb315f7fc755edb223 (patch)
tree23c45bb646c29e4b8270d5a1b9b3f7ae96f50495
parent6c6dc92c24fa2aa120c1d85cecf5e97ccefbb96a (diff)
Add ellipse
-rw-r--r--cutter.go20
-rw-r--r--main.go18
2 files changed, 32 insertions, 6 deletions
diff --git a/cutter.go b/cutter.go
index 2e087a4..d02e3f0 100644
--- a/cutter.go
+++ b/cutter.go
@@ -92,9 +92,13 @@ const (
ESC = 0x1b
)
-func (c Cutter) Send(a ...interface{}) {
+func (c Cutter) Add(a ...interface{}) {
fmt.Fprint(c, a...)
c.WriteByte(ETX)
+}
+
+func (c Cutter) Send(a ...interface{}) {
+ c.Add(a...)
c.Flush()
}
@@ -367,3 +371,17 @@ func (c Cutter) Circle(p Point, start, end Polar) {
start.R, ",", end.R, ",",
start.Theta, ",", end.Theta)
}
+
+// Not supported?
+func (c Cutter) Curve(a int, ph Path) {
+ c.Add("Y", a)
+ for _, p := range ph {
+ c.Add(",", p)
+ }
+ c.Flush()
+}
+
+func (c Cutter) Ellipse(a int, p Point, start, end Polar, theta int) {
+ c.Send(")", a, ",", p, ",", start.R, ",", end.R, ",",
+ start.Theta, ",", end.Theta, ",", theta)
+}
diff --git a/main.go b/main.go
index 23cae54..3b8e4ef 100644
--- a/main.go
+++ b/main.go
@@ -17,11 +17,19 @@ func main() {
//cu.Move(Point{300, 300})
//cu.SearchMarks()
//cu.Bezier(1, Point{0,0},Point{0,1000},Point{0,0},Point{1000,0})
- for i := 1; i < 10; i++ {
- cu.Circle(Point{1000, 1000},
- Polar{100 * i, 0},
- Polar{100 * i, 3600})
- }
+
+ /*
+ for i := 1; i < 10; i++ {
+ cu.Circle(Point{1000, 1000},
+ Polar{100 * i, 0},
+ Polar{100 * i, 3600})
+ }
+ */
+
+ //cu.Move(Point{500,500})
+
+ cu.Ellipse(0, Point{3000, 1000},
+ Polar{500, 0}, Polar{200, 3600}, 2000)
/*
for i := 0; i < 9; i++ {