diff options
author | Andrew Cady <d@jerkface.net> | 2019-03-13 01:58:08 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2019-03-13 01:58:08 -0400 |
commit | ee8373d9a9175f5f4f6553b9e253daf62e76610c (patch) | |
tree | adb0201a3245ff0f40b30e52f7e4fbb01c28502f /openscad/Graphics/OpenSCAD/Unicode.hs | |
parent | eee0ea179902152ed2431adae99a15507eb1fc94 (diff) |
bring in OpenSCAD (forward-ported)
Diffstat (limited to 'openscad/Graphics/OpenSCAD/Unicode.hs')
-rw-r--r-- | openscad/Graphics/OpenSCAD/Unicode.hs | 51 |
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 | {- | ||
4 | Module : Graphics.OpenSCAD.Unicode | ||
5 | Description : Unicode operators so you can write 'Model' expressions. | ||
6 | Copyright : © Mike Meyer, 2014 | ||
7 | License : BSD4 | ||
8 | Maintainer : mwm@mired.org | ||
9 | Stability : experimental | ||
10 | -} | ||
11 | |||
12 | module Graphics.OpenSCAD.Unicode where | ||
13 | |||
14 | import Data.Semigroup ((<>)) | ||
15 | import Graphics.OpenSCAD | ||
16 | |||
17 | infixl 6 ∪ | ||
18 | infixr 6 ∩ | ||
19 | infixl 9 ∖ | ||
20 | infixl 9 ⊖ | ||
21 | infixl 9 ⊕ | ||
22 | |||
23 | -- | (∪) = 'union' | ||
24 | -- | ||
25 | -- U+222A, UNION | ||
26 | (∪) :: Vector v => Model v -> Model v -> Model v | ||
27 | (∪) = (<>) | ||
28 | |||
29 | -- | (∩) = 'intersection' | ||
30 | -- | ||
31 | -- U+2229, INTERSECTION | ||
32 | (∩) :: Vector v => Model v -> Model v -> Model v | ||
33 | a ∩ b = intersection [a, b] | ||
34 | |||
35 | -- | (∖) = 'difference' | ||
36 | -- | ||
37 | -- U+2216, SET MINUS | ||
38 | (∖):: Vector v => Model v -> Model v -> Model v | ||
39 | (∖) = difference | ||
40 | |||
41 | -- | (⊖) = Symmetric difference | ||
42 | -- | ||
43 | -- U+2296, CIRCLED MINUS | ||
44 | (⊖) :: Vector v => Model v -> Model v -> Model v | ||
45 | a ⊖ b = (a ∖ b) ∪ (b ∖ a) | ||
46 | |||
47 | -- | (ࣷ) = 'minkowski' | ||
48 | -- | ||
49 | -- U+2295, CIRCLED PLUS | ||
50 | (⊕) :: Vector v => Model v -> Model v -> Model v | ||
51 | a ⊕ b = minkowski [a, b] | ||