Notifications
Clear all

[Closed] Break Non Planar Polygons into Triangulated Polygons

unfixed author’s bugs sometimes help others to understand how the code works
that’s the main difference between bugs and errors.

Well many of us are gracious. Extremely.

here is it:


fn hasNonPlanarFaces node threshold:0.0001 = if iskindof node GeometryClass do 
(
	mesh = snapshotasmesh node
	done = #{}
	has = off 
	for f=1 to mesh.numfaces while not has where not done[f] do
	(
		ff = meshop.getPolysUsingFace mesh f
		join done ff
		if ff.numberset > 1 do
		(
			ff = ff as array
			n = getfacenormal mesh ff[1]
			for k=2 to ff.count while not has do 
			(
				has = (abs (1.0 - (dot n (getfacenormal mesh ff[k]))) > threshold)
				-- if has do format "%: % != %
" ff n (getfacenormal mesh ff[k])
			)
		)
	)
	 free mesh
	has
)

btw… i found in documentation:
meshop.getPolysUsingEdge
<Mesh mesh> <edgelist> ignoreVisEdges:<boolean=false> threshhold:<float=45.>

Thanks for the function… I’ll test it later today.

I did test with with meshop.getPolysUsingEdge but was failing… will look at it again.

Page 2 / 2