Skip to main content
added 1050 characters in body
Source Link
Neil
  • 177.2k
  • 12
  • 74
  • 281

Charcoal, 162 146 bytes

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧ηFυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκFΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧FηF…¹θ⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μFηFΦυ⬤ι№η⟦μκ⟧F…²θF…¹λ⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξIEυ∕ι₂ΣXι²

Try it online! Link is to verbose version of code. Explanation:

Nθ

Input b.

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧ηFυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκFΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧η

Generate the verticesStart with one vertex and no edges of a regularan icosahedron of side 2.

FηF…¹θ⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μFυ

ExtrapolateProcess all vertices as they are discovered.

FE²⊞OΦιν×⊖⊗κ§ι⁰

Generate more vertices by rotating about the line x=y=z and reflecting in the xy plane. (This is the same procedure as for the regular dodecahedron in the linked question.)

F¬№υκ

Ignore previously discovered vertices.

FΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧

Save the new vertex and also discover any edges by checking for previously found vertices that are 2 away. (Very fortunately, ϕ²+1²+(ϕ-1)²=2² under floating-point arithmetic.) Since only previously found vertices are checked, each edge is only detected once, and has a specific direction.

Fη

Loop over the edges.

F…¹θ

Loop over the intermediate points.

⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μ

Extrapolate a point along the edge. (Sadly Charcoal doesn't have a way of adding two vectors which would really simplify this. Maybe if it had octonions...)

Fη

Loop over the edges again.

FηFΦυ⬤ι№η⟦μκ⟧F…²θF…¹λ⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξFΦυ⬤ι№η⟦μκ⟧

ExtrapolateLoop over the vertices that have edges to both vertices of that edge. (Note that because the edges have a specific direction, each face can only be detected once.)

F…²θF…¹λ

Loop over the interior points of the face.

⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξ

Extrapolate a point inside the facesface. (Due to the normalisation, it's not necessary to interpolate.)

IEυ∕ι₂ΣXι²

Normalise all the points.

Charcoal, 162 146 bytes

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧ηFυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκFΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧FηF…¹θ⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μFηFΦυ⬤ι№η⟦μκ⟧F…²θF…¹λ⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξIEυ∕ι₂ΣXι²

Try it online! Link is to verbose version of code. Explanation:

Nθ

Input b.

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧ηFυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκFΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧

Generate the vertices and edges of a regular icosahedron of side 2.

FηF…¹θ⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μ

Extrapolate the points along the edges.

FηFΦυ⬤ι№η⟦μκ⟧F…²θF…¹λ⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξ

Extrapolate the points inside the faces. (Due to the normalisation, it's not necessary to interpolate.)

IEυ∕ι₂ΣXι²

Normalise all the points.

Charcoal, 162 146 bytes

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧ηFυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκFΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧FηF…¹θ⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μFηFΦυ⬤ι№η⟦μκ⟧F…²θF…¹λ⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξIEυ∕ι₂ΣXι²

Try it online! Link is to verbose version of code. Explanation:

Nθ

Input b.

⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧η

Start with one vertex and no edges of an icosahedron of side 2.

Fυ

Process all vertices as they are discovered.

FE²⊞OΦιν×⊖⊗κ§ι⁰

Generate more vertices by rotating about the line x=y=z and reflecting in the xy plane. (This is the same procedure as for the regular dodecahedron in the linked question.)

F¬№υκ

Ignore previously discovered vertices.

FΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧

Save the new vertex and also discover any edges by checking for previously found vertices that are 2 away. (Very fortunately, ϕ²+1²+(ϕ-1)²=2² under floating-point arithmetic.) Since only previously found vertices are checked, each edge is only detected once, and has a specific direction.

Fη

Loop over the edges.

F…¹θ

Loop over the intermediate points.

⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μ

Extrapolate a point along the edge. (Sadly Charcoal doesn't have a way of adding two vectors which would really simplify this. Maybe if it had octonions...)

Fη

Loop over the edges again.

FΦυ⬤ι№η⟦μκ⟧

Loop over the vertices that have edges to both vertices of that edge. (Note that because the edges have a specific direction, each face can only be detected once.)

F…²θF…¹λ

Loop over the interior points of the face.

⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξ

Extrapolate a point inside the face. (Due to the normalisation, it's not necessary to interpolate.)

IEυ∕ι₂ΣXι²

Normalise all the points.

deleted 107 characters in body
Source Link
Neil
  • 177.2k
  • 12
  • 74
  • 281

Charcoal, 162162 146 bytes

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧FυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκ⊞υκF¹²«≔§υιηFι«≔§υκζ¿⁼⁴ΣXEη⁻λ§ζ첫F…¹θ⊞υEη⁺×λμ×⁻θλ§ζνF…υκ¿⁼⁴ΣXEη⁻μ§λν²¿⁼⁴ΣXEζ⁻μ§λν²F…²θF…¹μ⊞υEη⁺⁺×νξ×⁻μν§ζπ×⁻θμ§λπ»»»IEυ∕ι₂ΣXι²Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧ηFυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκFΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧FηF…¹θ⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μFηFΦυ⬤ι№η⟦μκ⟧F…²θF…¹λ⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξIEυ∕ι₂ΣXι²

Try it online!Try it online! Link is to verbose version of code. Explanation:

Nθ

Input b.

⊞υ⟦⁰¦¹⊘⊕₂⁵⟧FυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκ⊞υκNθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧ηFυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκFΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧

Generate the vertices and edges of a regular icosahedron of side 2.

F¹²«≔§υιηFι«≔§υκζ¿⁼⁴ΣXEη⁻λ§ζ첫F…¹θ⊞υEη⁺×λμ×⁻θλ§ζνFηF…¹θ⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μ

Extrapolate between each pair of vertices that are distance 2 apart, plus..the points along the edges.

F…υκ¿⁼⁴ΣXEη⁻μ§λν²¿⁼⁴ΣXEζ⁻μ§λν²F…²θF…¹μ⊞υEη⁺⁺×νξ×⁻μν§ζπ×⁻θμ§λπ»»»FηFΦυ⬤ι№η⟦μκ⟧F…²θF…¹λ⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξ

... each triplet of vertices that are pairwise distance 2 apart Extrapolate the points inside the faces. (Due to the normalisation, it's not necessary to interpolate.)

IEυ∕ι₂ΣXι²

Normalise all the points.

Charcoal, 162 bytes

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧FυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκ⊞υκF¹²«≔§υιηFι«≔§υκζ¿⁼⁴ΣXEη⁻λ§ζ첫F…¹θ⊞υEη⁺×λμ×⁻θλ§ζνF…υκ¿⁼⁴ΣXEη⁻μ§λν²¿⁼⁴ΣXEζ⁻μ§λν²F…²θF…¹μ⊞υEη⁺⁺×νξ×⁻μν§ζπ×⁻θμ§λπ»»»IEυ∕ι₂ΣXι²

Try it online! Link is to verbose version of code. Explanation:

Nθ

Input b.

⊞υ⟦⁰¦¹⊘⊕₂⁵⟧FυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκ⊞υκ

Generate the vertices of a regular icosahedron of side 2.

F¹²«≔§υιηFι«≔§υκζ¿⁼⁴ΣXEη⁻λ§ζ첫F…¹θ⊞υEη⁺×λμ×⁻θλ§ζν

Extrapolate between each pair of vertices that are distance 2 apart, plus...

F…υκ¿⁼⁴ΣXEη⁻μ§λν²¿⁼⁴ΣXEζ⁻μ§λν²F…²θF…¹μ⊞υEη⁺⁺×νξ×⁻μν§ζπ×⁻θμ§λπ»»»

... each triplet of vertices that are pairwise distance 2 apart. (Due to the normalisation, it's not necessary to interpolate.)

IEυ∕ι₂ΣXι²

Normalise all the points.

Charcoal, 162 146 bytes

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧ηFυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκFΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧FηF…¹θ⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μFηFΦυ⬤ι№η⟦μκ⟧F…²θF…¹λ⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξIEυ∕ι₂ΣXι²

Try it online! Link is to verbose version of code. Explanation:

Nθ

Input b.

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧≔⟦⟧ηFυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκFΦ⊞Oυκ⁼⁴ΣXEμ⁻ξ§κπ²⊞η⟦κμ⟧

Generate the vertices and edges of a regular icosahedron of side 2.

FηF…¹θ⊞υE§ι⁰⁺×κλ×⁻θꧧι¹μ

Extrapolate the points along the edges.

FηFΦυ⬤ι№η⟦μκ⟧F…²θF…¹λ⊞υE§ι⁰⁺⁺×μν×⁻λ짧ι¹ξ×⁻θλ§κξ

Extrapolate the points inside the faces. (Due to the normalisation, it's not necessary to interpolate.)

IEυ∕ι₂ΣXι²

Normalise all the points.

Source Link
Neil
  • 177.2k
  • 12
  • 74
  • 281

Charcoal, 162 bytes

Nθ⊞υ⟦⁰¦¹⊘⊕₂⁵⟧FυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκ⊞υκF¹²«≔§υιηFι«≔§υκζ¿⁼⁴ΣXEη⁻λ§ζ첫F…¹θ⊞υEη⁺×λμ×⁻θλ§ζνF…υκ¿⁼⁴ΣXEη⁻μ§λν²¿⁼⁴ΣXEζ⁻μ§λν²F…²θF…¹μ⊞υEη⁺⁺×νξ×⁻μν§ζπ×⁻θμ§λπ»»»IEυ∕ι₂ΣXι²

Try it online! Link is to verbose version of code. Explanation:

Nθ

Input b.

⊞υ⟦⁰¦¹⊘⊕₂⁵⟧FυFE²⊞OΦιν×⊖⊗κ§ι⁰F¬№υκ⊞υκ

Generate the vertices of a regular icosahedron of side 2.

F¹²«≔§υιηFι«≔§υκζ¿⁼⁴ΣXEη⁻λ§ζ첫F…¹θ⊞υEη⁺×λμ×⁻θλ§ζν

Extrapolate between each pair of vertices that are distance 2 apart, plus...

F…υκ¿⁼⁴ΣXEη⁻μ§λν²¿⁼⁴ΣXEζ⁻μ§λν²F…²θF…¹μ⊞υEη⁺⁺×νξ×⁻μν§ζπ×⁻θμ§λπ»»»

... each triplet of vertices that are pairwise distance 2 apart. (Due to the normalisation, it's not necessary to interpolate.)

IEυ∕ι₂ΣXι²

Normalise all the points.