Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static G_Object getIcosahedron(int r)
- {
- const double GoldenRatio = 1.61803398874989484820458683436;
- double shorter = (2 * r) / (Math.Sqrt(GoldenRatio + 1));
- double longer = GoldenRatio * shorter;
- double halfLonger = longer / 2;
- double halfShorter = shorter / 2;
- G_Point3D A = new G_Point3D(0, -halfLonger, -halfShorter);
- G_Point3D B = new G_Point3D(0, -halfLonger, halfShorter);
- G_Point3D L = new G_Point3D(0, halfLonger, halfShorter);
- G_Point3D J = new G_Point3D(0, halfLonger, -halfShorter);
- G_Point3D E = new G_Point3D(halfShorter, 0, -halfLonger);
- G_Point3D D = new G_Point3D(-halfShorter, 0, -halfLonger);
- G_Point3D H = new G_Point3D(-halfShorter, 0, halfLonger);
- G_Point3D G = new G_Point3D(halfShorter, 0, halfLonger);
- G_Point3D F = new G_Point3D(halfLonger, -halfShorter, 0);
- G_Point3D K = new G_Point3D(halfLonger, halfShorter, 0);
- G_Point3D I = new G_Point3D(-halfLonger, halfShorter, 0);
- G_Point3D C = new G_Point3D(-halfLonger, -halfShorter, 0);
- List<G_Face> faces = new List<G_Face>();
- faces.Add(new G_Face(A, B, C));
- faces.Add(new G_Face(A, C, D));
- faces.Add(new G_Face(A, D, E));
- faces.Add(new G_Face(A, E, F));
- faces.Add(new G_Face(A, F, B));
- faces.Add(new G_Face(F, G, B));
- faces.Add(new G_Face(B, G, H));
- faces.Add(new G_Face(B, H, C));
- faces.Add(new G_Face(C, H, I));
- faces.Add(new G_Face(C, I, D));
- faces.Add(new G_Face(D, I, J));
- faces.Add(new G_Face(D, J, E));
- faces.Add(new G_Face(E, J, K));
- faces.Add(new G_Face(E, K, F));
- faces.Add(new G_Face(F, K, G));
- faces.Add(new G_Face(L, G, K));
- faces.Add(new G_Face(L, H, G));
- faces.Add(new G_Face(L, I, H));
- faces.Add(new G_Face(L, J, I));
- faces.Add(new G_Face(L, K, J));
- G_Object icosahedron = new G_Object(faces.ToArray());
- return icosahedron;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement