... | ... | @@ -19,10 +19,11 @@ IceSL also extends Lua's types in order to specify shapes and transforms. The ma |
|
|
|
|
|
Creating a shape in IceSL does not automatically render it in the final scene. In order to do this, you need to emit it.
|
|
|
|
|
|
`emit( shape, brush )`
|
|
|
|
|
|
* `shape`: the shape to render
|
|
|
* `brush`: the brush's index to render the shape with. 0 by default
|
|
|
```lua
|
|
|
emit( shape, brush )
|
|
|
```
|
|
|
* ```shape```: the shape to render
|
|
|
* ```brush```: the brush's index to render the shape with. 0 by default
|
|
|
|
|
|
Brushes are an internalized concept of IceSL, there are a total of 128 indexes starting from 0. Their use is meant to group shapes under a set of parameters (usually printing parameters like _infill percentage_). In case of overlapping, the group with the lower index takes priority. The next code exemplifies the use of <code>emit</code>:
|
|
|
|
... | ... | @@ -115,4 +116,74 @@ The following are constants in IceSL: |
|
|
IceSl can calculate the next trigonometric functions:
|
|
|
```sin```, ```asin```, ```cos```, ```acos```, ```tan```, ```atan```, ```atan2```.
|
|
|
|
|
|
Angles in IceSL are expected to be written in **degrees**. |
|
|
\ No newline at end of file |
|
|
Angles in IceSL are expected to be written in **degrees**.
|
|
|
|
|
|
# Shapes
|
|
|
## Primitive Shapes
|
|
|
```lua
|
|
|
load(path)
|
|
|
```
|
|
|
Loads the 3d mesh at ```path```. The mesh must be watertight.
|
|
|
* ```path```: Absolute path to a 3d mesh. It supports the following extensions:
|
|
|
* **stl**
|
|
|
* **obj**
|
|
|
* **3ds**
|
|
|
|
|
|
```lua
|
|
|
sphere(r, c)
|
|
|
```
|
|
|
Creates a sphere of radius ```r``` centered on ```c```. ```sphere(r)``` is syntactic sugar for ```sphere(r,v(0,0,0))``` -a centered sphere.
|
|
|
* ```r```: the sphere's radius
|
|
|
* ```c```: the sphere's center
|
|
|
|
|
|
```lua
|
|
|
cube(dx, dy, dz)
|
|
|
```
|
|
|
Creates a cube with with sides ```dx```, ```dy```, ```dz``` with its bottom face centered on the origin. ```cube(d)``` and ```cube(v)``` are syntactic sugars for ```cube(d,d,d)``` and ```cube(v.x,v.y,v.z)``` respectively.
|
|
|
* ```dx```: length of the face perdendicular to the X-axis
|
|
|
* ```dy```: length of the face perpendicular to the Y-axis
|
|
|
* ```dz```: length of the face perpendicular to the Z-axis
|
|
|
|
|
|
```lua
|
|
|
cone(r0, r1, c0, c1)
|
|
|
```
|
|
|
Creates a cone with base radius ```r0```, top radius ```r1```, base center ```c0``` and top center ```c1```. Moreover, ```cone(r0,r1,h)``` is syntactic sugar for ```cone(r0,r1,v(0,0,0),v(0,0,h))```.
|
|
|
* ```r0```: the cone's base radius
|
|
|
* ```r1```: the cone's top radius
|
|
|
* ```c0```: the cone's base center
|
|
|
* ```c1```: the cone's top center
|
|
|
|
|
|
```lua
|
|
|
cylinder(r, c0, c1)
|
|
|
```
|
|
|
Creates a cylinder with radius ```r```, base center ```c0``` and top center ```c1```. It is syntactic sugar for ```cone(r,r,c0,c1)```. Additionally, ```cylinder(r,h)``` is also syntactic sugar for ```cone(r,r,h)```.
|
|
|
|
|
|
```lua
|
|
|
polyhedron(points,indices)
|
|
|
```
|
|
|
Creates a polyhedron with ```points``` as its vertex and ```indices``` to specify its faces.
|
|
|
* ```points```: an array of vectors containing the polyhedron's vertex
|
|
|
* ```indices```: an array of vectors specifying the polyhedron's faces. Each vector specifies a face constructed from three vertex indices represented by the vector's compotnents. Indices start from 0 and faces point outwards whenever the orientation of the vertices to which the indices refer to is counterclockwise.
|
|
|
|
|
|
<table>
|
|
|
<tr>
|
|
|
<td>
|
|
|
|
|
|
```lua
|
|
|
p = polyhedron(
|
|
|
{ v(0,0,0), v(1,0,0), v(0,1,0), v(1,1,0), v(0.5,0.5,1) },
|
|
|
{ v(0,3,1), v(0,2,3), v(0,1,4), v(1,3,4), v(3,2,4), v(2,0,4) } )
|
|
|
emit( p )
|
|
|
```
|
|
|
|
|
|
</td>
|
|
|
<td>
|
|
|
<img src="uploads/384b83224915015bc3e3238dff4845b0/Example_polyhedron.png" width="200">
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
```lua
|
|
|
Void
|
|
|
```
|
|
|
Creates an empty primitive |
|
|
\ No newline at end of file |