summaryrefslogtreecommitdiff
path: root/openscad/Graphics/OpenSCAD/Unicode.hs
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-03-13 01:58:08 -0400
committerAndrew Cady <d@jerkface.net>2019-03-13 01:58:08 -0400
commitee8373d9a9175f5f4f6553b9e253daf62e76610c (patch)
treeadb0201a3245ff0f40b30e52f7e4fbb01c28502f /openscad/Graphics/OpenSCAD/Unicode.hs
parenteee0ea179902152ed2431adae99a15507eb1fc94 (diff)
bring in OpenSCAD (forward-ported)
Diffstat (limited to 'openscad/Graphics/OpenSCAD/Unicode.hs')
-rw-r--r--openscad/Graphics/OpenSCAD/Unicode.hs51
1 files changed, 51 insertions, 0 deletions
diff --git a/openscad/Graphics/OpenSCAD/Unicode.hs b/openscad/Graphics/OpenSCAD/Unicode.hs
new file mode 100644
index 0000000..e630941
--- /dev/null
+++ b/openscad/Graphics/OpenSCAD/Unicode.hs
@@ -0,0 +1,51 @@
1{-# LANGUAGE UnicodeSyntax #-}
2
3{-
4Module : Graphics.OpenSCAD.Unicode
5Description : Unicode operators so you can write 'Model' expressions.
6Copyright : &#xa9; Mike Meyer, 2014
7License : BSD4
8Maintainer : mwm@mired.org
9Stability : experimental
10-}
11
12module Graphics.OpenSCAD.Unicode where
13
14import Data.Semigroup ((<>))
15import Graphics.OpenSCAD
16
17infixl 6 ∪
18infixr 6 ∩
19infixl 9 ∖
20infixl 9 ⊖
21infixl 9 ⊕
22
23-- | (&#x222A;) = 'union'
24--
25-- U+222A, UNION
26(∪) :: Vector v => Model v -> Model v -> Model v
27(∪) = (<>)
28
29-- | (&#x2229;) = 'intersection'
30--
31-- U+2229, INTERSECTION
32(∩) :: Vector v => Model v -> Model v -> Model v
33a ∩ b = intersection [a, b]
34
35-- | (&#x2216;) = 'difference'
36--
37-- U+2216, SET MINUS
38(∖):: Vector v => Model v -> Model v -> Model v
39(∖) = difference
40
41-- | (&#x2296;) = Symmetric difference
42--
43-- U+2296, CIRCLED MINUS
44(⊖) :: Vector v => Model v -> Model v -> Model v
45a ⊖ b = (a ∖ b) ∪ (b ∖ a)
46
47-- | (&#2295;) = 'minkowski'
48--
49-- U+2295, CIRCLED PLUS
50(⊕) :: Vector v => Model v -> Model v -> Model v
51a ⊕ b = minkowski [a, b]