Jump to content
jingyisw

How to perfect fractured a sphere into tetrahedrons ?

Recommended Posts

Hmm, just a thought. What if you were to correct the tetrahedrons as a post action, so to speak, shift the points into creating equilateral triangles..? Now triggering that shift is one thing, but how would you do it?

Now, someone probably know how to do mathematically on the incoming tetrahedron points - I do not, so I tried doing it in a for each...

*

Edit: Update - I managed to fix my positioning issue but alignment is still off. I'm thinking aligning the new tetrahedron primitive 0 normal to the incoming tetrahedron primitive 0 normal, though not sure how to do that - yet. :)

So here I use the explode value as the trigger, at 0 it keeps the original tetrahedron shape, at 1 (or above) it has been forced into a perfect tetrahedron. Due to misalignment, some shapes morph through themselves, so I need to fix that.

tetrasphere.v3.hipnc

Edited by Farmfield

Share this post


Link to post
Share on other sites

LOL, this alignment thingie is messing with me... So the alignment SOP aligns primitives between the objects on a "as close as" per primitive normal, that means, we need to have the primitive order for both tetrahedrons match spatially - easily solved with a sort in one axis...

Well, either the sort SOP doesn't work on tetrahedrons or I'm a moron - I just can't get it to work. :P

tetrasphere.v3.alignment.hipnc

Share this post


Link to post
Share on other sites

The idea is to morph each incoming tetrahedron to a regular tetrahedron based on a trigger - the trigger in this scene file being the the explode SOP, but it could be anything really, like distance to neighbouring tetrahedrons.

But the trigger isn't the issue, the issue is getting a working alignment between the tetrahedrons before the shift - as they are (mis-)aligned now, some tetrahedrons morph through themselves...

LOL, and suddenly I realize I could have use a blend shapes SOP, no need for my wrangle SOP - well, either way I need to align the tetrahedrons before it'll work...

Edited by Farmfield

Share this post


Link to post
Share on other sites

Now I had another hour free to put into this and I just can't seem to find my way out of this issue with the pieces blending through themselves. My problem with sorting on an axis was due to the object being rotated on the object level - so that was me being predictably confused over basic stuff - but still, I can't figure out a way to align the primitives before blending them. I need the pieces roughly aligned per point number to avoid them blending through themselves...

This problem is so tricky to solve, there just has to be a ridiculously simple solution I completely missed. I can almost guarantee it. :D

tetrasphere.v4.alignment.hiplc

Share this post


Link to post
Share on other sites

You may find incenter (coordinates of insphere) of irregular tetrahedron, then compute distances and vector deltas between it and all points, then set positions as center + normalized delta * average distance. It will regularize tetrahedron (in my imagination, at least). I had no luck finding incenter so far.

Share this post


Link to post
Share on other sites

But now you are talking about shifting the incoming tetrahedron points to their regular tetrahedron point positions based on the insphere..? But thinking about it, aligning a regular tetrahedron to an irregular (as best it can) would basically need the same data, right? Damn, my math skills are too friggin rusty for this stuff. :P

Where is Zvezdelina Stankova when you need her? :D

Well, I think I'm gonna try getting Jeff Lait or alike at SESI forums give me some input on this - I bet you can solve this pretty easily if you happen to be a SESI dev with a math Ph.D... :D

Share this post


Link to post
Share on other sites

Oh, that's really cool. I mean, it's all out there, it's just about finding the formula and fitting it into VEX. Great work.

So, what if you calculated the insphere for both tetrahedrons, then aligned the regular tetrahedron insphere to the irregular one and then shifted that rotation back onto the tetrahedron? :D

 

Edit: Doh - LOL, I'm an idiot, the sphere is scaled/translated only, not orientated. :P 

Edited by Farmfield

Share this post


Link to post
Share on other sites

i´m not entirely sure what you are trying to do but if you want to match the transformation of one geometry to another you could use a least squares approach or just rely on the extractTransform-op (which does the same under the hood).

petz

match_tet.hipnc

  • Like 1

Share this post


Link to post
Share on other sites

We want to regularize any irregular tetrahedron, which works perfectly in your solution, thanks!

Share this post


Link to post
Share on other sites

Petz, the easiest way to explain my problem is through this scene file - I'm trying to align two tetrahedrons so I can blend between them. The problem I have is I have a shitload of irregular tetrahedrons coming in, so it's a two step process, first align them, then sort the points so I can blend between them without having pieces blend through themselves - as in this scene file.

Edit - F***! I didn't check your scenefile before posting that - sry. Ignore the above. :)

Edited by Farmfield

Share this post


Link to post
Share on other sites

Petz, that's brilliant. I need to figure out what the heck you are doing, but it works perfectly.

Share this post


Link to post
Share on other sites

Yes, awesomeness. We already knew the alignment doesn't work for regular tetrahedrons as they don't tessellate, but this is a cool setup as you can trigger this shift, like in a RBD sim where you shift every single piece into this shape, creating the appearance of the impossible, regular tetrahedron fragments. :)

Petz - awesome stuff, just awesome.

Edit:

Also new issues to solve. There was something funky with the piece orientation doing an explode, but a fuse in the for each solved that. And I got stray primitives out of the tetrahedralize SOP, dunno what's that about. Funny I haven't noticed that before.

 

Edited by Farmfield

Share this post


Link to post
Share on other sites
On 6/17/2016 at 3:40 PM, jingyisw said:

i recently saw a reel . Some sort of abstract effect . and i just wanna know

 How to perfect fractured a sphere into tetrahedrons ?  Is there anyone have

solutions to do this ? Please help me .:ph34r:

So this basically solves the thread then, because you can't really tessellate "perfect" (regular-) tetrahedrons, but you can fake it. :D

And I'm extremely appreciative for the help with this last thing, Petz & F1. Not that I understand this extract transforms thingie - how are there transforms on the pieces out of the Tetrahedralize sop? Well, I'll figure it out, I hope. ;)

 

Share this post


Link to post
Share on other sites

Let me strike again. I found another method, 5 times slower than petz's (incredibly good result for earthling), and uses simpler overall setup. Just to conclude and archive the files.

regularize_tetrahedron.hipnc

Edited by f1480187
  • Like 1

Share this post


Link to post
Share on other sites

Oh, that point wrangle in the for each is nuts - that was what I was talking about in my initial question about this, shifting the actual points on the object - very cool. I would still want a blend in there to easily be able to "fade" between them - though I guess you could set that up in the wrangle too, create a keyable parameter for it. :)

And I have yet to dig deeper into how the extract transforms thingie works that Petz solved it with - I only come so far as to understand it's actually calculating a transform compared to something else. 

Share this post


Link to post
Share on other sites

For blends I would simply use rest position (or just previous input) and lerp between them, like in insphere file.

Share this post


Link to post
Share on other sites
On 9.7.2016 at 4:36 PM, f1480187 said:

Let me strike again. I found another method, 5 times slower than petz's (incredibly good result for earthling), and uses simpler overall setup. Just to conclude and archive the files.

regularize_tetrahedron.hipnc

nice one!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×