> For the complete documentation index, see [llms.txt](https://b-hub.gitbook.io/faze/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://b-hub.gitbook.io/faze/v2.0.0/research/renderers/circle-edge-renderer.md).

# Circle Edge Renderer

Research

### Core rules

* Each node in the tree is represented with a circle.
* Child nodes are spaced equally along the parent circle's edge.

**Additional rules**

[Maintaining proportional area](https://github.com/b-faze/Faze.Rendering/wiki/Circle-Edge-Renderer-Research#proportionalArea)\
[Defining the gap between children](https://github.com/b-faze/Faze.Rendering/wiki/Circle-Edge-Renderer-Research#definingGap)

### Maintaining proportional area

One restriction could be to make sure the area of the children, directly under the parent, sums to the parent's area.

> $$A\_c = \frac{A\_p}{n}$$&#x20;

This can be then written in terms of the radius of parent 'R' and child 'r'. Where n is the number of children R has.

> $$\pi r^2 = \frac{\pi R^2}{n}$$&#x20;

> $$r = \frac{R}{\sqrt{n}}$$&#x20;

Given the above restrictions, the results for 1 - 4 children are listed below

&#x20;<img src="https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaLwxkAFCZ-MRSd4bU%2F-Mdb767RZzq552axi49Y%2Fproportional_1.png?alt=media&amp;token=8e73cb59-fd23-4889-b83a-9b47d0fb9ae2" alt="" data-size="original"><img src="https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaLwxkAFCZ-MRSd4bU%2F-Mdb7LGvh7D5YeaQf0dC%2Fproportional_2.png?alt=media&amp;token=7dd76972-028a-4265-a49d-afed1c469717" alt="" data-size="original"> <img src="https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaLwxkAFCZ-MRSd4bU%2F-Mdb7R3fKlCP9rXp-CMI%2Fproportional_3.png?alt=media&amp;token=fb923cc2-fdc2-47de-9f92-5dca3ef5d56f" alt="" data-size="original"> <img src="https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaLwxkAFCZ-MRSd4bU%2F-Mdb7W4VNKnTibdQZD37%2Fproportional_4.png?alt=media&amp;token=3f4f7883-8b4f-45a9-a856-812d3aed28c2" alt="" data-size="original">&#x20;

One question is to ask how does this render with more children, particularly if the children ever overlap. To find out we can draw the following diagram.

![](https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaBtaic_zHqF-piTdS%2F-MdaFGqFP-e3odW_GdON%2FxGapDiagram.png?alt=media\&token=ebf7364f-a463-419d-ad59-e39a37f511a7)

As stated by one of the core rules, children are equally spaced along the edge of the parent and so the angle between each child is given by theta where...

> $$\theta = \frac{2\pi}{n}$$&#x20;

The distance between adjacent children center point is can be seen to have the following equality

> $$2r + x = \sqrt{2R^2(1 - \cos(\frac{2\pi}{n}))}$$&#x20;

where the right hand side comes from the cosine rule ![](https://camo.githubusercontent.com/2f778af09740f25c481db0de269f2709152a01d5d92ffbc7d2e00174dc2daa4a/68747470733a2f2f656e2e77696b6970656469612e6f72672f77696b692f4c61775f6f665f636f73696e6573)

> $$c^2 = a^2 + b^2 - 2ab\cos{C}$$&#x20;

> $$(2r + x)^2 = 2R^2 - 2R^2\cos(\frac{2\pi}{n})$$&#x20;

> $$(2r + x)^2 = 2R^2(1 - \cos(\frac{2\pi}{n}))$$&#x20;

> $$2r + x = \sqrt{2R^2(1 - \cos(\frac{2\pi}{n}}))$$&#x20;

Refactoring the equation gives us the following equation for x

> $$x = \sqrt{2R^2(1 - \cos(\frac{2\pi}{n}))} - 2r$$&#x20;

> $$x = \sqrt{2R^2(1 - \cos(\frac{2\pi}{n}))} - \frac{2R}{\sqrt{n}}$$&#x20;

> $$x = (\sqrt{2(1 - \cos(\frac{2\pi}{n}))} - \frac{2}{\sqrt{n}})R$$&#x20;

Plotting the equation shows us x is positive for n < 10

> $$y = \sqrt{2(1 - \cos(\frac{2\pi}{x}))} - \frac{2}{\sqrt{x}}$$&#x20;

![](https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaBtaic_zHqF-piTdS%2F-MdaF_HUATWj9Sf6Jfrc%2Fproportional_gap_small.png?alt=media\&token=ce5b370a-6cd3-4359-810e-811f0ec54c76)

![](https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaBtaic_zHqF-piTdS%2F-MdaFcW4r600cBakD091%2Fproportional_gap_big.png?alt=media\&token=d938d22b-05f4-4bc4-b431-baa55c3eb119)

For values of x < 0, the edges of the child circles will overlap. See below for zoomed in image for n=10...

![](https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaBtaic_zHqF-piTdS%2F-MdaFjTzuo6i9Z8CnIK1%2Fproportional_10_operlap.png?alt=media\&token=6f1b6598-6b7f-49c2-8cdf-ff08e2ec5051)

### Defining the gap between children

This method tweaks the equation for the child radius to achieve a desired gap between circle edges. The result of this would be a loss of proportional area, but could be used in conjunction with the previous section to define a lower limit for the gap e.g. limit so x >= 0 where the proportion is only lost in the case of n > 10 where x drops below 0.

![](https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaBtaic_zHqF-piTdS%2F-MdaFGqFP-e3odW_GdON%2FxGapDiagram.png?alt=media\&token=ebf7364f-a463-419d-ad59-e39a37f511a7)

> $$2r + x = \sqrt{2R^2(1 - \cos(\frac{2\pi}{n}))}$$&#x20;

we can modify the equation for x to fix the value

> $$r = \frac{1}{\sqrt{2}}R\sqrt{1 - \cos(\frac{2\pi}{n})} - x$$&#x20;

Setting the gap size to zero

<img src="https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaLwxkAFCZ-MRSd4bU%2F-Mdb96qToSnRSUmF4ODh%2FzeroGap_1.png?alt=media&amp;token=e40d9e9a-1378-4ae4-a6cd-3d721a041147" alt="" data-size="original"> <img src="https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaLwxkAFCZ-MRSd4bU%2F-Mdb9A81bWymhX7sD0U_%2FzeroGap_2.png?alt=media&amp;token=3a3cffec-df9d-4f13-9ae0-b531143bf0e4" alt="" data-size="original"> <img src="https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaLwxkAFCZ-MRSd4bU%2F-Mdb9GEa0f2x9KV-qwPq%2FzeroGap_3.png?alt=media&amp;token=733ecb12-92f0-446a-a969-dfc1e074c452" alt="" data-size="original"> <img src="https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaLwxkAFCZ-MRSd4bU%2F-Mdb9KRAg6t8TUczDOx3%2FzeroGap_4.png?alt=media&amp;token=589cdbbc-d9ea-4132-b950-2b042d529f6f" alt="" data-size="original">&#x20;

![Adjusting the gap size](https://2502734374-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdM8iXEiSa6vIC3EFqT%2F-MdaBtaic_zHqF-piTdS%2F-MdaGAwQhHkJpagxBPvs%2FgapChange.gif?alt=media\&token=ce186dcc-320b-47b0-86bc-4be8179ba782)
