... | ... | @@ -50,7 +50,7 @@ IceSL also extends Lua's types in order to specify shapes and transforms. The ma |
|
|
3. Implicits,
|
|
|
4. Voxels.
|
|
|
|
|
|
## Drawing and Scale
|
|
|
## Drawing and Scale <a name="drawing"></a>
|
|
|
|
|
|
Creating a shape in IceSL does not automatically render it in the final scene. In order to do this, you need to emit it.
|
|
|
|
... | ... | @@ -85,9 +85,9 @@ Notice that, in order to have a visual aid on view orientation, axes are drown i |
|
|
|
|
|
<img src="uploads/b4e0712ea9a780482db48e616e486370/Printing_bed.png" width="200">
|
|
|
|
|
|
## Vectors, Matrices, Constants and Trigonometric Functions
|
|
|
## Vectors, Matrices, Constants and Trigonometric Functions <a name="algebra"></a>
|
|
|
|
|
|
### Vectors
|
|
|
### Vectors <a name="vectors"></a>
|
|
|
|
|
|
Construction
|
|
|
* ```v(x,y,z)``` or ```v{x,y,z}```: creates the vector $`\begin{bmatrix} x \\ y \\ z
|
... | ... | @@ -113,7 +113,7 @@ Let ```v``` and ```u``` be vectors and ```n``` a number. |
|
|
* ```normalize(v)```: returns the unit vector $`\hat{v}`$.
|
|
|
* ```length(v)```: return the norm of ```v``` (i.e. $`||v||`$).
|
|
|
|
|
|
### Matrices
|
|
|
### Matrices <a name="matrices"></a>
|
|
|
|
|
|
Construction:
|
|
|
|
... | ... | @@ -135,7 +135,7 @@ Operations: Let ```M``` and ```Q``` be matrices, let ```v``` be a vector and let |
|
|
* ```M * s```: shape transformation. Returns the shape transformed by ```M```.
|
|
|
* ```inverse(M)```: matrix inversion. Returns the inverse of matrix ```M```.
|
|
|
|
|
|
### Constants, Trigonometric Functions and Angles
|
|
|
### Constants, Trigonometric Functions and Angles <a name="constants"></a>
|
|
|
|
|
|
The following are constants in IceSL:
|
|
|
* ```Pi```: the $`\pi`$ constant.
|
... | ... | @@ -149,8 +149,8 @@ IceSl can calculate the next trigonometric functions: |
|
|
|
|
|
Angles in IceSL are expected to be written in **degrees**.
|
|
|
|
|
|
## Shapes
|
|
|
### Primitive Shapes
|
|
|
## Shapes <a name="shapes"></a>
|
|
|
### Primitive Shapes <a name="primitives"></a>
|
|
|
|
|
|
```load(path)```
|
|
|
|
... | ... | @@ -213,7 +213,7 @@ emit( p ) |
|
|
|
|
|
Creates an empty primitive
|
|
|
|
|
|
### Centered Primitives
|
|
|
### Centered Primitives <a name="centered"></a>
|
|
|
|
|
|
Many primitives can be automatically centered at creation to their center of symmetry with respect to their bounding boxes. The following table lists their centered versions.
|
|
|
|
... | ... | @@ -226,7 +226,7 @@ Many primitives can be automatically centered at creation to their center of sym |
|
|
|
|
|
Additionally, the cube and box primitives have the versions ```ocube(dx,dy,dz)``` and ```cornerbox(dx,dy,dz)``` that position their front lower-left corners at the origin.
|
|
|
|
|
|
### Non-primitive Shapes
|
|
|
### Non-primitive Shapes <a name="nonprimitives"></a>
|
|
|
|
|
|
```linear_extrude(dir, points)```
|
|
|
|
... | ... | @@ -333,7 +333,7 @@ emit(se) |
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
### Implicits
|
|
|
### Implicits <a name="implicits"></a>
|
|
|
|
|
|
IceSL supports implicits by way of the [GL Shading Language](https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language) (GLSL). A comprehensive list of the built-in functions of GLSL can be found [here](http://www.shaderific.com/glsl-functions/)
|
|
|
|
... | ... | @@ -373,7 +373,7 @@ Above, every point in the domain of the implicit is marked as _solid_, therefore |
|
|
|
|
|
Choosing ```implicit_distance_field``` over ```implicit_solid``` can be summarized as follows: The former requires to estimate a distance to the surface, which can prove difficult and prone to artifacts (when the estimate is too far off from reality). The latter is much easier, as the function simply has to return negative for solid and positive for empty.
|
|
|
|
|
|
#### Progressive rendering
|
|
|
#### Progressive rendering <a name="progressive"></a>
|
|
|
|
|
|
IceSL by default progressively renders implicits, consequently all the implicit's geometry may not render in one single frame. The order of rendering is defined by the distance to the camera (i.e. scene's point of view). To disable/enable this behavior use the following:
|
|
|
|
... | ... | @@ -383,7 +383,7 @@ IceSL by default progressively renders implicits, consequently all the implicit' |
|
|
|
|
|
This setting must be set right after the implicit/voxels creation. This is because IceSL clones a shape whenever it is transformed and/or reassigned to another variable. Each clone drags with it the _current_ value of this setting.
|
|
|
|
|
|
#### Uniform variables and file support
|
|
|
#### Uniform variables and file support <a name="uniforms"></a>
|
|
|
|
|
|
It is possible to set values for uniform variables specified inside the implicit's GLSL program via lua commands.
|
|
|
|
... | ... | @@ -454,7 +454,7 @@ emit(scale(5) * shape) |
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
#### 3D Textures
|
|
|
#### 3D Textures <a name="3dtextures"></a>
|
|
|
|
|
|
IceSL features the ability to construct 3D textures programmatically. There is support for single channel textures as well as RGB textures in 8bit and 32bit variants.
|
|
|
|
... | ... | @@ -518,7 +518,7 @@ emit(imp) |
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
## Transformations
|
|
|
## Transformations <a name="transformations"></a>
|
|
|
|
|
|
This section deals with linear transformations. IceSL offers functions to calculate matrices of transformations. To apply a transformation, a transformation matrix is multiplied with a shape. In order to combine more than one transformation, the result of successive multiplications of transformation matrices may also be multiplied with a shape. All applications of transformations should be consistent with a [http://mathworld.wolfram.com/Right-HandedCoordinateSystem.html right-handed coordinate system]. This means the *rightmost transformation* in a combination *takes precedence*.
|
|
|
|
... | ... | @@ -593,7 +593,7 @@ emit( translate(0,-100,0) * mirror(v(0,1,0)) * mesh ) |
|
|
Returns a transformation matrix that orients (i.e. aligns) a shape's [up vector](http://autodeskmaya.wikia.com/wiki/Up_Vector) to the direction ```v```.
|
|
|
* ```v```: a vector specifying the direction to orientate in the transformation.
|
|
|
|
|
|
### Magnets
|
|
|
### Magnets <a name="magnets"></a>
|
|
|
|
|
|
Magnets are volumeless shapes that help building objects by way of assembling parts. Think of a magnet as a fastener that eventually couples with other magnets from different shapes.
|
|
|
|
... | ... | @@ -646,11 +646,11 @@ emit(union(smatrix * head, case)) |
|
|
|
|
|
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
|
|
|
## Operations <a name="operations"></a>
|
|
|
|
|
|
IceSL supports [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
|
|
|
### CSG Operations <a name="csg"></a>
|
|
|
|
|
|
```union(s0,s1)```
|
|
|
|
... | ... | @@ -680,7 +680,7 @@ IceSL supports abbreviated multi-input versions of these operations. Assume ```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```).
|
|
|
|
|
|
### Other Operations
|
|
|
### Other Operations <a name="otherops"></a>
|
|
|
|
|
|
```flip(m)```
|
|
|
|
... | ... | @@ -762,7 +762,7 @@ emit( translate(100,0,0) * linear_offset(mesh,v(0,1,0),10) ) |
|
|
|
|
|
Same as ```linear_offset``` but multiple offsets can be applied at the same time. ```directions``` and ```offsets``` are arrays of vectors and numbers respectively and they have an ordered one-to-one correspondence.
|
|
|
|
|
|
## Shape Representation
|
|
|
## Shape Representation <a name="shaperep"></a>
|
|
|
|
|
|
IceSL offers several functions for calculating representations of shapes (i.e., meshes, voxels, etc).
|
|
|
|
... | ... | @@ -832,7 +832,7 @@ Creates a mesh from ```shape``` using the marching cubes algorithm. Before calcu |
|
|
* ```shape```: input shape
|
|
|
* ```voxSize```: voxel size of space discretization (in mm)
|
|
|
|
|
|
### From assets
|
|
|
### From assets <a name="assets"></a>
|
|
|
|
|
|
```svg_ex(file,dpi)```
|
|
|
|
... | ... | @@ -903,7 +903,7 @@ The format of the file is a continuous chunk of voxels with the following inform |
|
|
3. Color (3 unsigned chars)
|
|
|
4. State (1 bool)
|
|
|
|
|
|
### Distribute
|
|
|
### Distribute <a name="distribute"></a>
|
|
|
|
|
|
Additionally to changing the representations of a shape, IceSL also provides a function to calculate an evenly distributed set of points covering a surface. For each point this function also reports its surface normal and maximum distance to the set of nearest points.
|
|
|
|
... | ... | @@ -937,8 +937,8 @@ emit(merge(centroids)) |
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
## Other Functionality
|
|
|
### Printing settings
|
|
|
## Other Functionality <a name="otherfunc"></a>
|
|
|
### Printing settings <a name="settings"></a>
|
|
|
|
|
|
It is possible for custom printing settings to be shown and modified in IceSL's UI. Currently there is support for two types of settings; booleans and numbers. The following two definitions can be used in file ```features.lua``` of a printer profile:
|
|
|
|
... | ... | @@ -982,7 +982,7 @@ Sets the printing parameter ```setting``` as a _field_ that extends from ```boxM |
|
|
* ```tex3d```: Value of the field as a 3d texture
|
|
|
* ```boxMin,boxMax```: Field extent
|
|
|
|
|
|
### Variable caching
|
|
|
### Variable caching <a name="caching"></a>
|
|
|
|
|
|
It is possible to turn on/off variable caching in IceSL with the system variable ```enable_variable_cache```. Variable caching is useful when editing a script that constructs an object or preforms a calculation that is CPU intensive (i.e. consumes significant time).
|
|
|
|
... | ... | @@ -1005,7 +1005,7 @@ emit(scale(1) * mesh) |
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
### Tweaks
|
|
|
### Tweaks <a name="tweaks"></a>
|
|
|
|
|
|
```ui_scalar(name, default, min, max)```
|
|
|
|
... | ... | @@ -1031,7 +1031,7 @@ emit(sphere(r)) |
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
### Fields
|
|
|
### Fields <a name="fields"></a>
|
|
|
|
|
|
Fields are UI objects for interactively building 3D textures. They are useful for carving, sculpting and specifying surfaces among other things.
|
|
|
|
... | ... | @@ -1108,7 +1108,7 @@ emit(union(shape,merge(cubes))) |
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
### Mesh Information
|
|
|
### Mesh Information <a name="meshinfo"></a>
|
|
|
|
|
|
```bbox(shape)```
|
|
|
|
... | ... | @@ -1135,7 +1135,7 @@ Returns a table containing the normals of a mesh. |
|
|
|
|
|
Returns a table containing the average connecting edge length of every vertex of a mesh.
|
|
|
|
|
|
### Miscellaneous Functions
|
|
|
### Miscellaneous Functions <a name="miscfunc"></a>
|
|
|
|
|
|
```print(str)```
|
|
|
|
... | ... | |