Compare Smoothing Groups

Hi all, hopefully an easy one here...

-- The short --

I'm looking to compare two polygons' smoothing groups, received as "bitwise integers" (eg. 12 = '001100'… = smoothing groups 3 and 4... and 5 = '101000' = smoothing groups 1 and 3) to see if they have any activated bits in common. Any ideas how to do this?

-- The Long -- (if the above wasnt enough info)

I'm trying to make a script which selects all "hard edges" (an edge where its face-neighbours do not share a smoothing group). I'm stuck on the "share a smoothing group" part...

So I've successfully got two faces' smoothing groups (using polyOp.getFaceSmoothGroup), which returns, from what ive read a "bitwise integer" eg. 001001… = smoothing groups 3 and 6

But I'm not sure how to compare these bitwise integers...

So I guess I'm looking for a way of writing function "SharesSG" in this:

Face1SGs = polyOp.getFaceSmoothGroup(someObject 1)
Face2SGs = polyOp.getFaceSmoothGroup(someObject 2)
 
if SharesSGs(Face1SGs, Face2SGs) == true do
-- ... blah

Many thanks in advance for your time

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mikemike37's picture

please ignore above :)

sorry, answered my own question! admin, please feel free to delete this post!

SharesSG 5 10
 
fn SharesSG a b = (
	CommonSGs = bit.and a b
	if CommonSGs > 0 then
		(return true)
	else
		(return false)
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.