arscan / hexasphere.js Goto Github PK
View Code? Open in Web Editor NEW🌐Generate a sphere covered (mostly) in hexagons.
Home Page: https://www.robscanlon.com/hexasphere
🌐Generate a sphere covered (mostly) in hexagons.
Home Page: https://www.robscanlon.com/hexasphere
Hello, it's a very nice work. I happend to need a program to generate hexaspere. I am not good at mathmatics. Can you help to point me the reationamong edge length of hexagon and radius, subdivisions and tilesize? That is , is there a mathmatics form like edge length = f(radius, subdivisions, tilesize)?
Each tile has a:
Each centerPoint has an array of Faces.
Are the Faces the same? What do they represent?
I'm trying to build something using THREE.js and Hexasphere. I've based my code of your example found here: https://www.robscanlon.com/hexasphere/
But I 'can't wrap my head around how I'd modify the vertice/face loops to make the tiles into hexagonal/pentagonal prisms. Can you give me a hint?
HI, arscan.
These days, I'm making a web music player and I would like to add music visualization function using hexaphere.js.
Could I use and reference this library?
Thanks 🙂
Hi There. Firstly I'd like to say that this is a nifty project;
I am currently trying to build a little game which uses this library to create the game world. However I have run into an issue where I need the neighbours to be in the same order as the boundary points so that I am able to determine what tile is in a particular direction from the current tile.
Any chance that would be something you would be able to add into the library? I have tried making changes to a local copy of the library myself by using the face index as a kind of sorting key to the neighborHash
but that didn't seem to work:
// tile.js
var neighborHash = {};
for(var f=0; f< this.faces.length; f++){
// build boundary
this.boundary.push(this.faces[f].getCentroid().segment(this.centerPoint, hexSize));
// get neighboring tiles
var otherPoints = this.faces[f].getOtherPoints(this.centerPoint);
for(var o = 0; o < 2; o++){
neighborHash[otherPoints[o]] = f;
}
}
this.neighborIds = Object.entries(neighborHash).sort(([n1, f1], [n2, f2]) => f1 - f2).map(([n])=> n);
Hello
What's the most efficient way to find n-level neighbors?
I need to find find neighbors up to 4 levels.
There's a center, there are 4 level of neighbors, the further the neighbors the more their transparency.
1 level neighbors implemented by default.
What's the best way to find 2-4 level neighbors?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.