Exploring the shapes and dimensions of a truncated Icosahedron in preparation for graphic design purposes

I am attempting to create a truncated icosahedron design with interactive clickable areas using Three.js.

Initially, I came across code for a standard icosahedron:

var t = ( 1 + Math.sqrt( 5 ) ) / 2;

var vertices = [
    [ -1,  t,  0 ], [  1, t, 0 ], [ -1, -t,  0 ], [  1, -t,  0 ],
    [  0, -1,  t ], [  0, 1, t ], [  0, -1, -t ], [  0,  1, -t ],
    [  t,  0, -1 ], [  t, 0, 1 ], [ -t,  0, -1 ], [ -t,  0,  1 ]
];

var faces = [
    [ 0, 11,  5 ], [ 0,  5,  1 ], [  0,  1,  7 ], [  0,  7, 10 ], [  0, 10, 11 ],
    [ 1,  5,  9 ], [ 5, 11,  4 ], [ 11, 10,  2 ], [ 10,  7,  6 ], [  7,  1,  8 ],
    [ 3,  9,  4 ], [ 3,  4,  2 ], [  3,  2,  6 ], [  3,  6,  8 ], [  3,  8,  9 ],
    [ 4,  9,  5 ], [ 2,  4, 11 ], [  6,  2, 10 ], [  8,  6,  7 ], [  9,  8,  1 ]
];

THREE.PolyhedronGeometry.call( this, vertices, faces, radius, detail );

Upon further analysis, I realized that t is φ and the vertices list encompasses all permutations as follows:

(0, ±1, ±φ) (±1, ±φ, 0) (±φ, 0, ±1) - Derived from Here

To modify my vertices accordingly, I made adjustments based on:

(0, ±1, ±3φ) (±2, ±(1+2φ), ±φ) (±1, ±(2+φ), ±2φ) - Referenced from Here

Which resulted in:

var vertices = [
        [-2, (1+2*t,t], [2,(1+2*t), t ], [-2,-(1+2*t),-t], [2,-(1+2*t),-t ],
        [0,-1,3*t], [0,1,3*t], [0,-1,-3*t], [0,1,-3*t],
        [1,-(2+t),-2*t ],[1,(2+t),2*t],[-1,-(2+t),-2*t],[-1,(2+t),2*t]
];

Realizing that the faces must also be modified. An icosahedron comprises 20 triangular faces, therefore constructing any polygon in Three.js involves triangles only.

It appears that I would require coordinates for 5 pentagons and 12 hexagons formatted as:

5 * 12 + 6 * 20 = 180 triangles

If this logic stands correct, what should be my approach in generating these coordinates? Or would there be an alternative perspective worth exploring?

Answer №1

If you're looking to generate various solids, the JSModeler framework is a great option. One interesting solid it can create is the truncated icosahedron, which might be just what you need.

To access the code for generating a truncated icosahedron, simply search for GenerateTruncatedIcosahedron in the source code. You can find the specific file here: https://github.com/kovacsv/JSModeler/blob/master/src/extras/solidgenerator.js

The provided code initially creates polygons with five and six vertices, but it's straightforward to modify them into triangles as needed.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Encountering a 404 Error on all routes except the home page when working with the Express Application Generator

While working on developing a day planner, I encountered an issue with the routes. I am consistently receiving a 404 error for any route other than the main Home page route (index or "/"). Below is the content of the app.js file: var express = require(&ap ...

Creating unique content is important and beneficial for your SEO strategy. Here is a revised version of your text:"

Is there a way to place a decal inside a specific section of a tube geometry, particularly on the backface? The current approach involves using TubeGeometry as the decal geometry. Displayed below is the current setup: https://i.sstatic.net/5BVUE.jpg Asp ...

Conceal language identifier upon initial page load in Angular

Using Angular-translate with partial-loader, I am looking to hide the translate key upon page load in app.js. var app = angular.module('myapp', [ 'ngRoute', 'appRoutes', 'pascalprecht.translate', ...

Stop JavaScript Injection Attacks

Let's consider a scenario where a user inputs information into a form that is then submitted to the server using PHP. In the PHP code, we have: $data = $_POST['data']; // or $data = strip_tags(@$_POST['data']); I am curious t ...

Obtain the orientation of the threejs scene and camera to establish the initial perspective

Currently, I am facing challenges in configuring the default camera position and orientation for my THREE.JS demo. I aim to manually adjust the view/scene/camera through trackball interaction and then find a way to set the correct camera settings to establ ...

What is causing my divs to behave as if I set a margin-top/margin-bottom of one and a half centimeters?

I'm currently developing an AngularJS application and I've encountered some issues with unnecessary whitespace. <div class='user' ng-repeat='session in sessions'> <div class='text' ng-bind='monolog ...

Ensure the Image URL is valid before modifying the State in React/Next

This code snippet is written in React/Next.js with styled-components. Hey there, I have a component that displays a blog banner using a background-image. The URL for the image comes from a state variable that currently holds a default image path. const [b ...

Can you explain the distinction between these two AngularJS controllers?

In my experience, when defining a controller I often come across these two ways: University.controller('ClassroomController', function($scope){ //do stuff }); What separates the first way from this alternative method? var classroomController = ...

Angular: facing difficulty displaying static html pages on server, although they render correctly when run locally

Within my Angular project, I have stored a few static html files (specifically sampleText.html) in the src/assets/html folder. In one of my components, I am attempting to fetch and display this file. The following code is being used for this purpose. Every ...

Issue with jQuery AJAX Event Handling

I'm currently struggling to solve a bug in an existing ASP.NET MVC website. One of the views includes a set of text boxes where users input data. Each text box triggers some JavaScript on the blur event to send changes back to the server. Specificall ...

What is the best way to display hover-over text pop ups on menu list items in jsTreeR?

As a dedicated user of the jsTreeR package within Shiny, I have been exploring the functionality it offers. By executing the code below, users are presented with a draggable menu at the top, allowing them to drag items down to the designated list labeled " ...

Knex is requesting the installation of sqlite3, but I am actually utilizing a MySQL database

While attempting to execute a query on my local MySQL database using knex, I encountered an issue where it prompted me to install the SQLite3 driver, even though my database is MySQL. To troubleshoot, I installed the SQLite3 driver to see if it would reso ...

Encountering NPM Abortion Issue in Node.js

I am a beginner in node.js and have successfully installed it. However, when I try to initialize npm, I encounter an error that causes it to abort. My system has high memory capacity with 32GB RAM and 1TB HD. Although the 'npm -v' command works ...

Initial function call to modify the state does not result in any field updates

As I delve into integrating GraphQL with a React web application for testing and educational purposes, I am humbly admitting to being a newbie in this domain. To provide a brief overview, I am working on a book library application, where we have a compila ...

Issue with Cordova keyboard plugin: the native.keyboardopen event is not being triggered. Is there a way to prevent scrolling when the

I'm currently working on a hybrid app using Cordova and Angular. My goal is to prevent users from scrolling when the keyboard is open. Although the cordova keyboard plugin from ionic, ionic-plugin-keyboard, offers events for both opening and closing ...

What is the most effective method for fetching images from MongoDB?

I'm currently working on a web application that uses MongoDB's GridFS to store and retrieve images. However, I'm facing an issue where retrieving images from the database takes significantly longer than expected when a user makes a request. ...

The fusion of Combining Forms, JSON, AJAX, PHP, and Google graphs

I'm completely new to integrating JScript, Ajax, and Google Graphs. Although I've managed to get each of them working separately, combining them has proven to be quite challenging. Google Graph Part of my code (Form is inactive here): <html& ...

Raising the css value for each element that is impacted

I am faced with an infinite number of elements that I need to arrange next to each other. Each element has a class called "box". My goal is to separate each box by 10px increments, meaning the first element will have a left property of 0px, the second 10px ...

Using AngularJS to hide elements within a nested dictionary structure

My dictionary structure is as follows: var data = { a: [1, 2, 3, 4, 5], b: [ [1, 2], [3, 4], [5, 6] ] }; Currently, I am using ng-hide to hide an element if the value 2 exists in data->a. Here's how it's implemented: <i ...

Google Sheets displaying blank values after submission via an AJAX call

I have been working on transferring data from my web app to a Google spreadsheet and I am encountering some issues. I followed the script provided by Martin Hawksey, which can be found here: https://gist.github.com/mhawksey/1276293 Despite setting everyth ...