Skip to main content
Tweeted twitter.com/StackCodeGolf/status/694552333557075969
added 8 characters in body
Source Link
lirtosiast
  • 21.5k
  • 5
  • 52
  • 127

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in the +X+Z quarterplane. Input/output formats can be anything reasonable. To allow for rounding error, Your code does not have to give correct answers for points within 10^-6 units of the boundary

Example inputs / outputs:

0, 0, 0 => true
1, 1, 1 => false
0.7, 0.5, -0.4 => true
-0.152053, -0.46797, 0.644105 => false
-0.14609, -0.449618, 0.618846 => true

To be absolutely clear on the orientation of the icosahedron, the coordinates of the vertices are approximately

{{0., 0., -1.}, 
{0., 0., 1.}, 
{-0.894427190999916, 0., -0.447213595499958}, 
{0.894427190999916, 0., 0.447213595499958}, 
{0.723606797749979, -0.5257311121191336, -0.447213595499958}, 
{0.723606797749979, 0.5257311121191336, -0.447213595499958}, 
{-0.723606797749979, -0.5257311121191336, 0.447213595499958}, 
{-0.723606797749979,  0.5257311121191336, 0.447213595499958}, 
{-0.27639320225002106, -0.85065080835204, -0.447213595499958}, 
{-0.27639320225002106,  0.85065080835204, -0.447213595499958}, 
{0.27639320225002106, -0.85065080835204, 0.447213595499958}, 
{0.27639320225002106,  0.85065080835204, 0.447213595499958}}

ScoreScoring is standard Code-Golf,; the fewest charactersbytes wins.

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in the +X+Z quarterplane. Input/output formats can be anything reasonable. To allow for rounding error, Your code does not have to give correct answers for points within 10^-6 units of the boundary

Example inputs / outputs:

0, 0, 0 => true
1, 1, 1 => false
0.7, 0.5, -0.4 => true
-0.152053, -0.46797, 0.644105 => false
-0.14609, -0.449618, 0.618846 => true

To be absolutely clear on the orientation of the icosahedron, the coordinates of the vertices are approximately

{{0., 0., -1.}, 
{0., 0., 1.}, 
{-0.894427190999916, 0., -0.447213595499958}, 
{0.894427190999916, 0., 0.447213595499958}, 
{0.723606797749979, -0.5257311121191336, -0.447213595499958}, 
{0.723606797749979, 0.5257311121191336, -0.447213595499958}, 
{-0.723606797749979, -0.5257311121191336, 0.447213595499958}, 
{-0.723606797749979,  0.5257311121191336, 0.447213595499958}, 
{-0.27639320225002106, -0.85065080835204, -0.447213595499958}, 
{-0.27639320225002106,  0.85065080835204, -0.447213595499958}, 
{0.27639320225002106, -0.85065080835204, 0.447213595499958}, 
{0.27639320225002106,  0.85065080835204, 0.447213595499958}}

Score is standard Code-Golf, fewest characters wins

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in the +X+Z quarterplane. Input/output formats can be anything reasonable. To allow for rounding error, Your code does not have to give correct answers for points within 10^-6 units of the boundary

Example inputs / outputs:

0, 0, 0 => true
1, 1, 1 => false
0.7, 0.5, -0.4 => true
-0.152053, -0.46797, 0.644105 => false
-0.14609, -0.449618, 0.618846 => true

To be absolutely clear on the orientation of the icosahedron, the coordinates of the vertices are approximately

{{0., 0., -1.}, 
{0., 0., 1.}, 
{-0.894427190999916, 0., -0.447213595499958}, 
{0.894427190999916, 0., 0.447213595499958}, 
{0.723606797749979, -0.5257311121191336, -0.447213595499958}, 
{0.723606797749979, 0.5257311121191336, -0.447213595499958}, 
{-0.723606797749979, -0.5257311121191336, 0.447213595499958}, 
{-0.723606797749979,  0.5257311121191336, 0.447213595499958}, 
{-0.27639320225002106, -0.85065080835204, -0.447213595499958}, 
{-0.27639320225002106,  0.85065080835204, -0.447213595499958}, 
{0.27639320225002106, -0.85065080835204, 0.447213595499958}, 
{0.27639320225002106,  0.85065080835204, 0.447213595499958}}

Scoring is standard ; the fewest bytes wins.

improved formatting of vertices (one vertex per line)
Source Link
Level River St
  • 26.7k
  • 4
  • 37
  • 105

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in the +X+Z quarterplane. Input/output formats can be anything reasonable. To allow for rounding error, Your code does not have to give correct answers for points within 10^-6 units of the boundary

Example inputs / outputs:

0, 0, 0 => true
1, 1, 1 => false
0.7, 0.5, -0.4 => true
-0.152053, -0.46797, 0.644105 => false
-0.14609, -0.449618, 0.618846 => true

To be absolutely clear on the orientation of the icosahedron, the coordinates of the vertices are approximately

{{0., 0., -1.},  
{0., 0., 1.},  
{-0.894427190999916, 
 0., -0.447213595499958},  
{0.894427190999916, 0., 
 0.447213595499958},  
{0.723606797749979, -0.5257311121191336, 
 -0.447213595499958},  
{0.723606797749979, 
 0.5257311121191336, -0.447213595499958},  
{-0.723606797749979, 
 -0.5257311121191336, 0.447213595499958},  
{-0.723606797749979, 
  0.5257311121191336, 
 0.447213595499958},  
{-0.27639320225002106, -0.85065080835204, 
 -0.447213595499958},  
{-0.27639320225002106, 
  0.85065080835204, -0.447213595499958},  
{0.27639320225002106, 
 -0.85065080835204, 0.447213595499958},  
{0.27639320225002106, 
  0.85065080835204, 0.447213595499958}}

Score is standard Code-Golf, fewest characters wins

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in the +X+Z quarterplane. Input/output formats can be anything reasonable. To allow for rounding error, Your code does not have to give correct answers for points within 10^-6 units of the boundary

Example inputs / outputs:

0, 0, 0 => true
1, 1, 1 => false
0.7, 0.5, -0.4 => true
-0.152053, -0.46797, 0.644105 => false
-0.14609, -0.449618, 0.618846 => true

To be absolutely clear on the orientation of the icosahedron, the coordinates of the vertices are approximately

{{0., 0., -1.}, {0., 0., 1.}, {-0.894427190999916, 
 0., -0.447213595499958}, {0.894427190999916, 0., 
 0.447213595499958}, {0.723606797749979, -0.5257311121191336, 
 -0.447213595499958}, {0.723606797749979, 
 0.5257311121191336, -0.447213595499958}, {-0.723606797749979, 
 -0.5257311121191336, 0.447213595499958}, {-0.723606797749979, 
  0.5257311121191336, 
 0.447213595499958}, {-0.27639320225002106, -0.85065080835204, 
 -0.447213595499958}, {-0.27639320225002106, 
  0.85065080835204, -0.447213595499958}, {0.27639320225002106, 
 -0.85065080835204, 0.447213595499958}, {0.27639320225002106, 
  0.85065080835204, 0.447213595499958}}

Score is standard Code-Golf, fewest characters wins

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in the +X+Z quarterplane. Input/output formats can be anything reasonable. To allow for rounding error, Your code does not have to give correct answers for points within 10^-6 units of the boundary

Example inputs / outputs:

0, 0, 0 => true
1, 1, 1 => false
0.7, 0.5, -0.4 => true
-0.152053, -0.46797, 0.644105 => false
-0.14609, -0.449618, 0.618846 => true

To be absolutely clear on the orientation of the icosahedron, the coordinates of the vertices are approximately

{{0., 0., -1.},  
{0., 0., 1.},  
{-0.894427190999916, 0., -0.447213595499958},  
{0.894427190999916, 0., 0.447213595499958},  
{0.723606797749979, -0.5257311121191336, -0.447213595499958},  
{0.723606797749979, 0.5257311121191336, -0.447213595499958},  
{-0.723606797749979, -0.5257311121191336, 0.447213595499958},  
{-0.723606797749979,  0.5257311121191336, 0.447213595499958},  
{-0.27639320225002106, -0.85065080835204, -0.447213595499958},  
{-0.27639320225002106,  0.85065080835204, -0.447213595499958},  
{0.27639320225002106, -0.85065080835204, 0.447213595499958},  
{0.27639320225002106,  0.85065080835204, 0.447213595499958}}

Score is standard Code-Golf, fewest characters wins

added 55 characters in body
Source Link

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in the +X+Z quarterplane. Input/output formats can be anything reasonable. To allow for rounding error, Your code does not have to give correct answers for points within 10^-6 units of the boundary

Example inputs / outputs:

0, 0, 0 => true
1, 1, 1 => false
0.7, 0.5, -0.4 => true
-0.152053, -0.46797, 0.644105 => false
-0.14609, -0.449618, 0.618846 => true

To be absolutely clear on the orientation of the icosahedron, the coordinates of the vertices are approximately

{{0., 0., -1.}, {0., 0., 1.}, {-0.894427190999916, 
 0., -0.447213595499958}, {0.894427190999916, 0., 
 0.447213595499958}, {0.723606797749979, -0.5257311121191336, 
-0.447213595499958}, {0.723606797749979, 
 0.5257311121191336, -0.447213595499958}, {-0.723606797749979, 
-0.5257311121191336, 0.447213595499958}, {-0.723606797749979, 
 0.5257311121191336, 
 0.447213595499958}, {-0.27639320225002106, -0.85065080835204, 
-0.447213595499958}, {-0.27639320225002106, 
 0.85065080835204, -0.447213595499958}, {0.27639320225002106, 
-0.85065080835204, 0.447213595499958}, {0.27639320225002106, 
 0.85065080835204, 0.447213595499958}}

Score is standard Code-Golf, fewest characters wins

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in the +X+Z quarterplane. Input/output formats can be anything reasonable. To allow for rounding error, Your code does not have to give correct answers for points within 10^-6 units of the boundary

Example inputs / outputs:

0, 0, 0 => true
1, 1, 1 => false
0.7, 0.5, -0.4 => true
-0.152053, -0.46797, 0.644105 => false
-0.14609, -0.449618, 0.618846 => true

To be absolutely clear on the orientation of the icosahedron, the coordinates of the vertices are approximately

{{0., 0., -1.}, {0., 0., 1.}, {-0.894427190999916, 
 0., -0.447213595499958}, {0.894427190999916, 0., 
 0.447213595499958}, {0.723606797749979, -0.5257311121191336, 
-0.447213595499958}, {0.723606797749979, 
 0.5257311121191336, -0.447213595499958}, {-0.723606797749979, 
-0.5257311121191336, 0.447213595499958}, {-0.723606797749979, 
 0.5257311121191336, 
 0.447213595499958}, {-0.27639320225002106, -0.85065080835204, 
-0.447213595499958}, {-0.27639320225002106, 
 0.85065080835204, -0.447213595499958}, {0.27639320225002106, 
-0.85065080835204, 0.447213595499958}, {0.27639320225002106, 
 0.85065080835204, 0.447213595499958}}

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in the +X+Z quarterplane. Input/output formats can be anything reasonable. To allow for rounding error, Your code does not have to give correct answers for points within 10^-6 units of the boundary

Example inputs / outputs:

0, 0, 0 => true
1, 1, 1 => false
0.7, 0.5, -0.4 => true
-0.152053, -0.46797, 0.644105 => false
-0.14609, -0.449618, 0.618846 => true

To be absolutely clear on the orientation of the icosahedron, the coordinates of the vertices are approximately

{{0., 0., -1.}, {0., 0., 1.}, {-0.894427190999916, 
 0., -0.447213595499958}, {0.894427190999916, 0., 
 0.447213595499958}, {0.723606797749979, -0.5257311121191336, 
-0.447213595499958}, {0.723606797749979, 
 0.5257311121191336, -0.447213595499958}, {-0.723606797749979, 
-0.5257311121191336, 0.447213595499958}, {-0.723606797749979, 
 0.5257311121191336, 
 0.447213595499958}, {-0.27639320225002106, -0.85065080835204, 
-0.447213595499958}, {-0.27639320225002106, 
 0.85065080835204, -0.447213595499958}, {0.27639320225002106, 
-0.85065080835204, 0.447213595499958}, {0.27639320225002106, 
 0.85065080835204, 0.447213595499958}}

Score is standard Code-Golf, fewest characters wins

Source Link
Loading