summaryrefslogtreecommitdiff
path: root/gerberex/utility.py
diff options
context:
space:
mode:
authoropiopan <opiopan@gmail.com>2019-03-23 21:59:13 +0900
committeropiopan <opiopan@gmail.com>2019-03-23 21:59:13 +0900
commit690df56bb71020901167605a87ec451081fa18d7 (patch)
treec1faba9ba0cb75d64d8353a94d87edbcbb8174c3 /gerberex/utility.py
parent9febca7da6a730b3b3ca3a54129a9f88e5c44d14 (diff)
downloadgerbonara-690df56bb71020901167605a87ec451081fa18d7.tar.gz
gerbonara-690df56bb71020901167605a87ec451081fa18d7.tar.bz2
gerbonara-690df56bb71020901167605a87ec451081fa18d7.zip
add rotation fuction
Diffstat (limited to 'gerberex/utility.py')
-rw-r--r--gerberex/utility.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/gerberex/utility.py b/gerberex/utility.py
new file mode 100644
index 0000000..852519a
--- /dev/null
+++ b/gerberex/utility.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright 2019 Hiroshi Murayama <opiopan@gmail.com>
+
+from math import cos, sin, pi
+
+def rotate(x, y, angle, center):
+ x0 = x - center[0]
+ y0 = y - center[1]
+ angle = angle * pi / 180.0
+ return (cos(angle) * x0 - sin(angle) * y0 + center[0],
+ sin(angle) * x0 + cos(angle) * y0 + center[1])