At My Fingertips

Documentation

Sliced Citrus

Compose a graphic of an orange, lemon, and lime.

Citrus Fruit

Citrus Sector

The inside of a sliced citrus fruit is composed of a ring of circular sectors.

orange sector

Implement the citrus_sector function. Use circular_sector to create the sector and use rotate to rotate it so it is centered along the x-axis.

Loading...

Circle

Create a function circle that produces a circle. Use ellipse.

Loading...

Compose multiple graphics into one

Create a function composes that takes a list of graphics and composes them into a single graphic. Use repetition, starting with an empty_graphic and combining graphics with compose.

Loading...

Ring

Create a function ring that produces a ring of count graphics, evenly spread across the 360 degrees of a circle. The inside diameter of the ring should correspond to diameter (the citrus segments should form a ring just outside the diameter).

Hint: If you need help, check out the Sliced Pitaya activity.

Loading...

Sliced citrus

Implement a function sliced_citrus that composes a sliced citrus from:

  • core pith circle - 0.15 * fruit diameter
  • ring of citrus sectors - ring diameter of 0.1 * fruit diameter, sector diameter of 0.7 * fruit diameter
  • outer pith circle - 0.9 * fruit diameter
  • skin circle - 1.0 * fruit diameter

Use your composes function.

Loading...

Putting it all together

Let's create convenience functions to create a sliced orange, lemon, or lime. The functions call sliced_citrus with the predefined colors of the corresponding citrus fruit.

Loading...

Now compose an arrangement of citrus fruit, including at least one orange, one lemon, and one lime.

Loading...

This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.

Sliced Citrus

Logo of PyTamaro

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI

Privacy PolicyPlatform Version c08406b (Wed, 20 Nov 2024 12:30:00 GMT)