Given a circular pie chart divided into colored wedges, we want to overlay a grid of buttons and determine which color each button should display based on which wedge it overlaps the most.
Circle with radius r divided into wedges
N×M buttons colored by wedge overlap
| Parameter | Symbol | Description | Example |
|---|---|---|---|
| Circle Radius | r | Radius of the circular pie chart | 200 pixels |
| Grid Rows | N | Number of button rows (vertical) | 15 |
| Grid Columns | M | Number of button columns (horizontal) | 15 |
| Button Width | w | Width of each button = 2r/M | 26.7 px |
| Button Height | h | Height of each button = 2r/N | 26.7 px |
| Sample Size | S | Sample points per button dimension | 7 (49 total samples) |
| Threshold | T | Minimum overlap fraction for color assignment | 0.5 (50%) |
| Angle Offset | θ₀ | Rotation of circle (0 = 3 o'clock) | π/2 (12 o'clock) |
For button at grid location (i, j):
Where i ∈ [0, N-1], j ∈ [0, M-1], and origin is at top-left of bounding box.
For each sample index (si, sj) where si, sj ∈ [0, S-1]:
Sample points at center of each sub-cell (shown as dots)
Check if sample point is inside the circle:
If inside circle, calculate angle from center:
Angle measurement with offset θ₀ = 90° (12 o'clock)
Determine which wedge contains this angle:
Assign button color based on wedge with maximum overlap:
Given:
Step-by-step: