Color sections of a circular shape

Eve-Marie Grenier shared this question 5 months ago
Answered

d6548ed565415aa002f0b3c3eb6b3418b106f87f85cc6d946205775136c55c59I need help with coloring sections of this circular shape, thanks!

Comments (7)

photo
2

Colouring areas in the 2D-view can be done by describing them with inequalities. Here's an example to get such a circular checker pattern that even allows an arbitrary set of radii.


radii = {0, 1, 2.2, 3.3, 4, 5}
pattern = Join(Sequence(Sequence({x² + y² ≥ (radii(j))² ∧ x² + y² ≤ (radii(j + 1))² ∧ Simplify((-1)^(k + j + 1) x y) ≤ 0 ∧ Simplify((-1)^k x² ≥ (-1)^k y²)}, k, 0, 1), j, 1, Length(radii) - 1))
You might want to go to the properties of "pattern" and set the Line Thickness to 0, because Geogebra also draws the boundary lines for each inequality, and because each inequality is used in multiple areas, those lines are then drawn multiple times and appear very thick.


As for what those commands do:

  • The first command just defines the list of the radii to be used. Should be in ascending order. Also should start with 0 unless you want an empty inner circle.

  • The second command constructs a list containing all the shaded areas (each one as a list of inequalities) that make up the pattern. The "Simplify" commands in there are not strictly necessary, they just make the inequalities a tiny bit simpler and better to read in the output. The "Join" command in there is also just to have a simple list of patterns instead of a list of lists, but doesn't really affect what is drawn in the geometry view.

For a regular sequence of radii you can of course omit defining the radii list and just put the correct expressions in the pattern sequence.

It's also possible to use an arbitrary number of arbitry angles for the pattern, but it's a bit more annoying to do that. I kinda assume you only wanted the regular pattern with 45° angles anyway.

Edit: Removed some unnecessary part of the command (remnant from an arbitrary angle approach).

photo
1

Nice! What's Simplify() for? It seems OK without it

photo
1

As said in my post, the "Simplify" aren't really necessary, but they make the output in the Algebra window nicer. Without them it looks - at least for me in Geogebra 5 - like this

a9d4cfa0c729a080085fe643af8e9d9f


I considered all those non-simplified powers of -1 ugly enough to warrant putting some "Simplify" in.

photo
1

OK, but Simplify() will load the CAS which you might not want to do (especially online...)

photo
1

Oh, good to know. Didn't realize that this is a CAS thing.

photo
photo
1

if you don't want to use Sequence() or you have more complex angles, then you can use this custom tool.

To do this, drag&drop the ggt file (in the attachment) into your applet.

Then write in Inputbox:

{RingSector(<Centerpoint>, <FromPoint>, <ToPoint>)}

and set the properties/Style/LineThikness to 0.

or

<name>_1=RingSector(<Centerpoint>, <FromPoint>, <ToPoint>)

this generate 3 objects has the same name+index: the inequality, the edging and the area

or

use the interactive custom-tool. This works very similar to CircularSector().

this generate 3 objects: the inequality, the edging and the area with different names

----------------------

Note 1: Sector angles >180° are possible. 360° is not possible.

Note 2: this tool also works within a sequence. With this you could realize e.g. sector angles smaller than 45° (or sector angles from a list). Within a sequence only the inequality is generated (without edging and area)

photo
1

I am attaching a similar construction based on inequalities to generate the initial figures and using sequences and rotations to generate the final composition. 16 objects are used to generate it, but it could be easily reduced to 9.a32de8a1f0b810fb0ff60e62fa759cf8

© 2021 International GeoGebra Institute