At My Fingertips

Documentation

Sliced Pitaya

Compose a graphic of a sliced Pitaya, a fruit also known as "dragon fruit".

Pitaya

Pitaya Seed

The small seeds of a pitaya are distributed all throughout the fruit. They are dark (the color is already defined in SEED_COLOR) and have an elliptical shape (about half as wide as long).

Implement the pitaya_seed function, using ellipse.

Loading...

Sliced Pitaya without Seeds

Compose a sliced pitaya without any seeds. Use the given colors for the skin (SKIN_COLOR) and the flesh (FLESH_COLOR). The sliced pitaya should have the given overall diameter, and the flesh should be 90% of that diameter.

Loading...

Ring of Seeds

Create a function ring that produces a ring of count seeds, evenly spread across the 360 degrees of a circle. The inside diameter of the ring should correspond to diameter (the seeds should form a ring just outside the diameter). Repetitively call pitaya_seed to produce the ring of seeds.

Here is an example of calling ring(8, 100, pitaya_seed(20)):

ring of 8 seeds

Hint: The seeds must be placed half the diameter away from the center of the ring. To do that, create a rectangle that is as wide as the radius of the ring, and that has a height of 0 (it will not be visible but acts as a gap). Place that rectangle on the left of the seed. Then pin that composition on its center_left, and rotate by the necessary amount.

ring of seeds with visible gaps

Above is an example of a ring with 5 seeds, showing this approach. To make the rectangles visible, here they have a height of 1 instead of 0, and they are colored in red.

Loading...

Sliced Pitaya with Seeds

Create three rings of seeds:

  • 10% of diameter - 4 seeds
  • 40% of diameter - 8 seeds
  • 70% of diameter - 12 seeds

Place them on top of a sliced pitaya without seeds.

Loading...

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

Sliced Pitaya

Logo of PyTamaro

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

Privacy PolicyPlatform Version 1cd5229 (Tue, 05 Nov 2024 16:55:57 GMT)