How to detect if two faces are EXACTLY coplanar or not?

How to detect if two faces are EXACTLY coplanar or not?

Postby architectboy » Wed Nov 28, 2007 12:54 am

So, I've made a script that erases any lines in-between coplanar faces. The only way that I could think of detecting if they are coplanar is by checking their normals for equality, but the returned normal is an approximation, not the true value :? . And thus my script erases lines in-between faces that are close - but not absolutely - co-planar and destroys the faces in the process. Any ideas on how to detect if they are ABSOLUTELY co-planar?
I've got one... hehe
0

architectboy 
PluginStore Author
PluginStore Author
 

Re: How to detect if two faces are EXACTLY coplanar or not?

Postby Krisidious » Wed Nov 28, 2007 1:01 am

yeah see that's one thing I know nothing about ruby... and I mean nothing.
hopefully someone will save us from stumpage.
0
By: Kristoff Rand
Home Designer
Unique House Plans
User avatar
Krisidious 
 

Re: How to detect if two faces are EXACTLY coplanar or not?

Postby todd burch » Wed Nov 28, 2007 1:01 am

Well, define your use of "coplanar". Coplanar means "on the same plane". So:

if face1.plane == face2.plane then puts "faces are coplanar" ; end ;

Now, if you also mean 100% "coincident", then the defined bounding box of each face will match.

If you mean partially overlapping, then tests would have to be made with various points (vertices) on one face with the bounding box of the other face, and then vice versa as well.

Todd
0

todd burch 
 

Re: How to detect if two faces are EXACTLY coplanar or not?

Postby architectboy » Wed Nov 28, 2007 1:02 am

Well, are plane values exact? That I will check tomorrow. As for stumpage you might still be in it.
0

architectboy 
PluginStore Author
PluginStore Author
 

Re: How to detect if two faces are EXACTLY coplanar or not?

Postby Gaieus » Wed Nov 28, 2007 1:02 am

ArchitectBoy wrote:...As for stumpage you might still be in it.

Yeah, by 4 minutes...
:D
0
User avatar
Gaieus 
 

Re: How to detect if two faces are EXACTLY coplanar or not?

Postby RickW » Wed Nov 28, 2007 1:03 am

ArchitectBoy wrote:I've got one... hehe
What's that about? What do you have? Can everyone have one? :D
I had to pull out my superhero eyeglasses to read that!
0

RickW 
 

Re: How to detect if two faces are EXACTLY coplanar or not?

Postby Jim » Wed Nov 28, 2007 1:04 am

This may not be the best solution, but the logic is sound..

Check for deleted faces just after erasing the edge, and if the face is also deleted, undo and continue with the next edge in the loop.

It may not be too costly because the trash loop is already a limited set containing only edges that are candidates for removal. But then again, I've noticed skin.rb can get slow already (not your fault.)
0
Hi

Jim 
Global Moderator
 

Re: How to detect if two faces are EXACTLY coplanar or not?

Postby architectboy » Wed Nov 28, 2007 1:04 am

Ok, I must admit that not knowing how to fix this was pretty stupid. It was the second method I wrote on my first script and I wasn't - and I still am not - very knowledgeable about the API. The only reason that I thought it would stump you guys is that the STUPID google employee at the sketchup help group (not pro) told me that an approximation was as close as I could get :| ! Now I know that he is wrong, because planes do give acurite data! And as for the idea that I had I was thinking that if creating a face with the two faces edges (minus the in-between edge) was successful than I could erase the line. And Jim, you said that skin.rb runs slowly, well it does because of how many nested iterations through arrays I had (every face was processed once for every edge it had, every edge was processed twice, and every vertex was processed at least twice for every line attached to it!), it should run faster with the next version.
0

architectboy 
PluginStore Author
PluginStore Author
 

Re: How to detect if two faces are EXACTLY coplanar or not?

Postby robint » Mon Oct 01, 2018 8:40 pm

Yeehaaa

here's a dummy way with a tetrahedron

fudge your model with a face on x,y plane and one edge on the x axis - you hope. this face must be filled

draw a flat rectangle joining this edge at both end and extend along the flat plane y. It should fill by itself. the line in between can be removed and it should all fill - if not you screwed up placing your model

I think this is fundamental to any modelling (would you start a 2d drg without an origin, scale and xy directions

coplanarity.jpg
0
As one door closes another one slams in your face
User avatar
robint 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: No registered users and 12 guests

Visit our sponsors: