Choose the Hexagonal Surface within the Octahedral Structure in THREE.js

My current project involves working with a geodesic sphere that was initially created using THREE.OctahedronGeometry. I am looking to group the triangular faces into hexagonal faces for easier selection, but I am unsure of the best approach to solving this problem or if it is even possible. Any advice or insights on this matter would be greatly appreciated.

For reference, below is an example of the code I am currently using:

createGeodesicSphere =->
        geometry = new THREE.OctahedronGeometry(200, 3)
        material = new THREE.MeshBasicMaterial({
            color        : 0xFFFFFF,
            shading      : THREE.FlatShading,
            side         : THREE.DoubleSide,
            vertexColors : THREE.FaceColors,
            overdraw     : true 
            })

        # Explode geometry so each face has unique vertices
        explodeModifier = new THREE.ExplodeModifier()
        explodeModifier.modify(geometry)

        geodesicMesh = new THREE.Mesh(geometry , material)
        geodesicFaces = geometry.faces  

        for i in [0..geodesicFaces.length-1]
            geodesicFaces[i].color.setRGB(Math.random(), Math.random(), Math.random())

        geodesicMesh.position.x = 0
        geodesicMesh.position.y = 0
        geodesicMesh.position.z = 0

        scene.add(geodesicMesh)

Answer №1

While it may seem unlikely, there is a potential solution using a voronoi diagram that closely resembles a hexagon. You can explore more about this concept through this link:Spherical Voronoi Tessellation with Java 7: need fix for winding vertices around faces.

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

Creating a unique input box using CSS and HTML

Could someone help me achieve an input box like the one shown in the image below? https://i.stack.imgur.com/XtVNj.png Since I am new to CSS, I am not sure how to put text inside the border of an input box. Should I style the input directly or create a di ...

Next.js app encounters a BSON error when using TypeORM

Currently, I am in the process of integrating TypeORM into my Next.js application. Despite utilizing the mysql2 driver and configuring 5 data sources, I am encountering a persistent BSON error: ./node_modules/typeorm/browser/driver/mongodb/bson.typings.js ...

React's UseEffect can cause an endless loop of renders, leading to the error message "Maximum update

My Cart component contains an array of Cards. Whenever a user removes a product from the cart, it is removed from both the local storage and the UI. import React, { useState, useEffect } from 'react'; import { Link } from 'react-router-dom&a ...

Building multi-dimensional array checkboxes in AngularJS - a step-by-step guide

I am working with a multi-dimensional array and I need to display all the data using checkboxes. The array below contains dietary requirements, and I want to create checkboxes for each entry where the value is true. How can I use ng-repeat to iterate over ...

Focus on programmatically generated elements by utilizing refs

I need to set focus on the Input within a custom component by creating dynamic refs. This is how I'm currently rendering the elements: const createRefForCountRow = denom => { this[`${denom.id}-ref`] = React.createRef(); return ( <Count ...

Tips for passing dynamic latitude and longitude values to a JavaScript function within an AngularJS framework

I am facing an issue with displaying a dynamic marker on Google Maps. I can show a static lat long marker, but I am struggling to pass dynamic lat long values to the function. How can I pass {{names.lat}}, {{names.longitude}} to the function so that I can ...

Distinguishing between resolving a promise in a service/factory as opposed to in a controller within AngularJS

After experimenting with resolving a promise in both a service and a controller, I have found that I prefer to resolve it in the service so that I can reuse the variable without having to resolve it multiple times. However, I am encountering an issue where ...

A modern CSS solution for a fixed columns and header layout in a scrollable table

How can I create a table with minimal JavaScript using modern CSS? I am aiming to include the following features: Fixed column(s) (positioning and width) Scrollable in both X and Y axes Responsive in the X axis (for non-fixed width columns). https://i. ...

Custom transaction settings for Mongoose

When conducting transactions, we often have the ability to customize certain options. For example, we can specify transaction options like the ones shown below: const transactionOptions = { readPreference: 'primary', readConcern: { level: &ap ...

How do you go about installing the most recent version of a module through Private NPM?

When using a private npm registry, I have noticed that some common commands do not seem to be functioning properly: npm install without specifying a specific @version :: issue npm outdated :: issue npm update :: issue npm view <private-packag ...

When an item in the accordion is clicked, the modal's left side scroll bar automatically scrolls to the top. Is there a solution to prevent this behavior and

When I first load the page and click on the Sales accordion, then proceed to click on Total reported and forecasted sales, the scrollbar jumps back up to the top The marked ng-container is specifically for the UI of Total reported and forecasted sales He ...

Utilizing Jquery to pass two classes along

I am looking for assistance on how to pass multiple classes within if-else statements and jQuery. My goal is to have both divs and divs2 change when the next button is clicked. Can someone please provide guidance on achieving this? --code not mine-- ...

The toolbar button in the Froala WYSIWYG editor is mysteriously missing from view

Embarking on a project with Froala editor and Angular 1, I meticulously followed the documentation to show the insertImage button and insertTable, but they are not appearing. Here is my code: var tb = ["bold", "italic", "insertTable", "insertImage"]; $sc ...

Encountering the error message "myFunction variable is not declared" when using Google Closure Compiler

When attempting to compile two JavaScript files that both use a function declared in only one of the files, an "undeclared" error is returned. To solve this issue, I added the function declaration to my externs file like this: var myFunction = function() ...

Rename multiple files in bulk

With 10000 files consisting of php, html, css, and png formats that are interconnected to operate the website's engine, I am looking for a way to perform bulk renaming in order to ensure proper functionality. Not only do I need to rename the actual fi ...

There appears to be an issue with Google Analytics not generating __utm.gif requests, yet no error messages are

I'm encountering an issue with implementing Google Analytics. Despite extensive research, I haven't been able to find a resolution. My objective is to include the user's email address as a custom variable in Google Analytics. I have integra ...

Using Node and Express to handle form submissions, we can create a POST request that sends data to the server

Despite my ongoing learning journey, I am feeling a bit frustrated as I struggle to find a solution for this particular issue using ES6 Javascript. Currently, I have a straightforward todo-list web-app where everything is managed and displayed through the ...

Tips on how to showcase particular keys from json information in React

Here is a sample of Json data that I have: [ { "serial_number": "test1", "added_at": "2021-02-05T18:58:43.382943Z", "ser_mod": [ { "added_at": "2021-02-06T02: ...

Could the absence of an external style sheet for CSS be hindering the execution of my code?

A generous Stack Overflow user provided me with the code you see here and their JSFiddle can be accessed at http://jsfiddle.net/f18513hw/. The code functions properly in JSFiddle. I copied and pasted the code into my Textpad, saved it in my htdocs folder o ...

What is the best way to change the "MuiPaper-elevation1" attribute in a Card element within Material-UI?

My Card component in HTML looks like this: <div class="MuiPaper-root MuiCard-root makeStyles-Card-5 MuiPaper-elevation1 MuiPaper-rounded"> I want to change MuiPaper-elevation1 to MuiPaper-elevation0 to remove the shadow. I attempted: ...