... | @@ -600,3 +600,35 @@ emit(union(smatrix * head, case)) |
... | @@ -600,3 +600,35 @@ emit(union(smatrix * head, case)) |
|
</table>
|
|
</table>
|
|
|
|
|
|
Snap matrices are not commutative with respect to their connecting magnets. Notice in the previous example that multiplying ```smatrix``` with ```case``` does not yield the same result.
|
|
Snap matrices are not commutative with respect to their connecting magnets. Notice in the previous example that multiplying ```smatrix``` with ```case``` does not yield the same result.
|
|
|
|
|
|
|
|
# Operations
|
|
|
|
IceSL suports [Constructive Solid Geometry](https://en.wikipedia.org/wiki/Constructive_solid_geometry) (hereafter referred to as CSG). The following is a list of CSG operations:
|
|
|
|
|
|
|
|
## CSG Operations
|
|
|
|
```union(s0,s1)```
|
|
|
|
|
|
|
|
Returns a shape as the union of shape ```s0``` and shape ```s1```. This operation is commutative.
|
|
|
|
* ```s0```: A shape
|
|
|
|
* ```s1```: A shape
|
|
|
|
|
|
|
|
```intersection(s0,s1)```
|
|
|
|
|
|
|
|
Returns a shape as the intersection of shape ```s0``` and shape ```s1```. This operation is commutative.
|
|
|
|
* ```s0```: A shape
|
|
|
|
* ```s1```: A shape
|
|
|
|
|
|
|
|
```difference(s0,s1)```
|
|
|
|
|
|
|
|
Returns a shape as the difference of shape ```s0``` and shape ```s1```. This operation is **not** commutative.
|
|
|
|
* ```s0```: A shape
|
|
|
|
* ```s1```: A shape
|
|
|
|
|
|
|
|
IceSL supports abbreviated multi-input versions of these operations. Assume ```s``` is a shape and ```S``` is a table of shapes. The following table summarizes these operations.
|
|
|
|
|
|
|
|
| Operation | N-Argument Version | Short Version |
|
|
|
|
| --------- | ------------------ | ------------- |
|
|
|
|
| ```union(s0,s1)``` | ```union{s0,...,sn}, union(S)``` | ```U(s0,s1), U{s0,...,sn}, U(S)``` |
|
|
|
|
| ```intersection(s0,s1)``` | ```intersection{s0,...,sn}, intersection(S)``` | ```I(s0,s1), I{s0,...,sn}, I(S)``` |
|
|
|
|
| ```difference(s0,s1)``` | ```difference{s0,...,sn}, difference(S)``` | ```D(s0,s1), D{s0,...,sn}, D(S)``` |
|
|
|
|
|
|
|
|
N-ary versions from the above table are associative to the left. For example ```D{s0,s1,s2,s3}``` is equivalent to ```D(D(D(s0,s1),s2),s3)```. For this to be computationally sound [1](https://proofwiki.org/wiki/Union_of_Singleton) [2](https://proofwiki.org/wiki/Intersection_of_Singleton), the result of n-ary operations over a single shape is defined as the shape itself (i.e. ```U{s} = s```, ```I{s} = s``` and ```D{s} = s```). |