Initial commit
This commit is contained in:
commit
0119dae9ff
11 changed files with 4360 additions and 0 deletions
73
readme.adoc
Normal file
73
readme.adoc
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
:sectnums:
|
||||
:nofooter:
|
||||
:toc: left
|
||||
:icons: font
|
||||
|
||||
= Exercise Rep.03 -- Simple Drawing
|
||||
|
||||
In this exercise you are going to work with the `Turtle` to draw a few simple shapes.
|
||||
|
||||
Remember what a turtle can do:
|
||||
|
||||
* Teleport to a specific location
|
||||
* Turn with a certain angle (left or right)
|
||||
* Move a certain distance drawing a line
|
||||
|
||||
WARNING: We always want a _general_ solution which would also work with other input values. So try to _not_ assume (hard code) values except for those listed below, calculate the rest.
|
||||
|
||||
== Eulerian Path
|
||||
|
||||
An https://en.wikipedia.org/wiki/Eulerian_path[Eulerian path] is a finite graph which visits each edge exactly once.
|
||||
|
||||
Put simply: you are going to draw a shape 'in one go' (= no 'lifting' of the pencil until done) while not drawing one line more than once.
|
||||
So you may visit nodes (points) multiple time, but _not_ the edges (lines).
|
||||
|
||||
In German there is a little saying which is often taught to kids which, actually, is an Eulerian path: 'Das ist das Haus des Nikolaus' -- one line being drawn for each syllable.
|
||||
|
||||
image::pics/nikolaus.png[width=600]
|
||||
|
||||
There are actually multiple possible paths which lead to a valid result.
|
||||
|
||||
Your task is to use the `Turtle` to properly draw this shape.
|
||||
Use the following measurements and choose a good starting position:
|
||||
|
||||
* normal length = `60`
|
||||
* short length = `42.2`
|
||||
* long length = `84.9`
|
||||
|
||||
== Shapes
|
||||
|
||||
Your next task is to draw some shapes:
|
||||
|
||||
image::pics/shapes.png[Shapes to draw]
|
||||
|
||||
Make sure to select starting positions which do not let the shapes overlap.
|
||||
|
||||
=== Octagon
|
||||
|
||||
An https://en.wikipedia.org/wiki/Octagon[octagon] has, unsurprisingly, 8 corners.
|
||||
Use a side length of `40`.
|
||||
|
||||
=== Rhombus
|
||||
|
||||
A https://en.wikipedia.org/wiki/Rhombus[rhombus] has two pairs of equal angles and four sides of the same length.
|
||||
|
||||
Use a side length of `60` and one of the angles has to be `82°`.
|
||||
|
||||
=== Triangle
|
||||
|
||||
The last shape actually consists of two triangles: one inner and one outer.
|
||||
|
||||
image::pics/triangles.png[]
|
||||
|
||||
* Both are isosceles triangles
|
||||
* The inner one has the following measurements:
|
||||
** short side = `6.0`
|
||||
** long side = `8.0`
|
||||
* Angles ares:
|
||||
** `48.19°`
|
||||
** `83.621°`
|
||||
* The _sides_ of the outer one are _offset_ by `1.5`
|
||||
* Could some code reuse be possible here 🤔
|
||||
|
||||
TIP: In case you are bad at Maths: https://en.wikipedia.org/wiki/Law_of_sines[Law of sines] & https://en.wikipedia.org/wiki/Kite_(geometry)[Deltoids] could be useful
|
||||
Loading…
Add table
Add a link
Reference in a new issue