Skip to content

Commit

Permalink
Merge pull request #96 from Schulich-Ignite/rotate_docs
Browse files Browse the repository at this point in the history
Bumped version number and added docs for rotate() function
  • Loading branch information
AlphaRLee authored Feb 18, 2021
2 parents b1cd098 + c670008 commit b978f51
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
Binary file added docs/img/rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/rotation_explanation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 39 additions & 1 deletion docs/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,42 @@ def setup():

Results in:

![random demo](img/randint.png)
![random demo](img/randint.png)



### Rotation

![rotation explanation](rotation_explanation.png)

Transformations are always done to the **canvas**, not the individual shapes themselves. Rotation is done around the origin, point (0, 0) and affects all shapes drawn afterwards. You can use our built-in `pi` variable to express radians, or convert from degrees to radians by multiplying your number of degrees by `pi / 180`.

Note that canvas transformations are not removed automatically. In other words, if you want to rotate just one shape in your `draw()` function, you should rotate the canvas by `r` radians, draw your shape, and then rotate by `-r` radians to undo the effect.

To rotate the canvas clockwise around the origin, use:

```python
rotate(r)
```

**Parameters**

- r: (float) The angle, in radians to rotate the canvas

**Example(s):**

*Rotating a rectangle by 30 degrees clockwise*

```python hl_lines="6"
%%ignite

def setup():
size(300, 300)

rotate(pi / 6) # Rotate pi/6 radians (30 degrees) clockwise
rect(100, 0, 80, 50)
```

Results in:

![rotate demo](img/rotate.png)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="schulich-ignite",
version="0.1.1",
version="0.1.2",
author="Schulich Ignite",
author_email="info@shulichignite.com",
description="Spark library for Shulich Ignite sessions",
Expand Down

0 comments on commit b978f51

Please sign in to comment.