Help Faking Ambient Occlusion!
-
Added the following code to the one above one to make script work on some solid objects that are simple but I need to find a solution that works every time.
znormal = face.normal.z if znormal == 1 || znormal == -1 next end
Note: Ok the above code is too bad of an idea and will not use it at all.
-
Hi, here is my progress so far...
model = Sketchup.active_model sel = model.selection ents = model.active_entities faces = ents.grep(Sketchup;;Face) outer_edge = [] faces.each do |face| loop = face.outer_loop borders = loop.edges outer_edge << borders outer_edge.flatten! end outer_edge.each do |edge| status = sel.contains? edge if (status) edge.hidden = false sel.remove edge else edge.hidden = true sel.add edge end end
What I need now is to find a way to hide the lines that are facing outward...Any ideas?
Note Update: I was testing code with non solid objects only and was not aware that it doesn't work with solid objects. Need to rethink this through again...oh well!
-
@renderiza said:
What I need now is to find a way to hide the lines that are facing outward...Any ideas?
Maybe this will help: Highlight edges in profile
-
Thank you Anton_S I will take a look at it!
-
Hi, here is another WIP and I am happy with the progress so far. The following code does an ok job with vertical line and now I need to work on horizontal lines.
Anton_S the code you posted by TIG helpd me find this "faces = edge.faces " which was very usefull so thank you.
model = Sketchup.active_model sel = model.selection ents = model.active_entities edges = ents.grep(Sketchup;;Edge) edges.each do |edge| faces = edge.faces faceone = faces.first facetwo = faces.last f1nx = faceone.normal.x f1ny = faceone.normal.y f1nz = faceone.normal.z f2nx = facetwo.normal.x f2ny = facetwo.normal.y f2nz = facetwo.normal.z ####################### ## NE Vertical Lines ## ####################### if f1nx == 1 and f2ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y edge.hidden = true else edge.hidden = false end end if f2nx == 1 and f1ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y edge.hidden = true else edge.hidden = false end end ####################### ## SE Vertical Lines ## ####################### if f1nx == 1 and f2ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y edge.hidden = true else edge.hidden = false end end if f2nx == 1 and f1ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y edge.hidden = true else edge.hidden = false end end ####################### ## SW Vertical Lines ## ####################### if f1nx == -1 and f2ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y edge.hidden = true else edge.hidden = false end end if f2nx == -1 and f1ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y edge.hidden = true else edge.hidden = false end end ####################### ## NW Vertical Lines ## ####################### if f1nx == -1 and f2ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y edge.hidden = true else edge.hidden = false end end if f2nx == -1 and f1ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y edge.hidden = true else edge.hidden = false end end end
If anyone has any suggestions to better my code I am all ears...cheers!
-
WIP - 7/26/2013
Hi, this is an update to deal with all vertical lines and it should now work 100% of the time. I still need to work of top & bottom horizontal lines but I imaging it should be easier than vertical lines. Ok here is the code so far...
model = Sketchup.active_model sel = model.selection ents = model.active_entities edges = ents.grep(Sketchup;;Edge) edges.each do |edge| faces = edge.faces faceone = faces.first facetwo = faces.last areaone = faceone.area areatwo = facetwo.area f1nx = faceone.normal.x f1ny = faceone.normal.y f1nz = faceone.normal.z f2nx = facetwo.normal.x f2ny = facetwo.normal.y f2nz = facetwo.normal.z ####################### ## NE Vertical Lines ## ####################### if f1nx == 1 and f2ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y and centerone.x > centertwo.x edge.hidden = true else edge.hidden = false end ####### ## N ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end ####### ## E ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end end if f2nx == 1 and f1ny == 1 and boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y and centerone.x < centertwo.x edge.hidden = true else edge.hidden = false end ####### ## N ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end ####### ## E ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end end ####################### ## SE Vertical Lines ## ####################### if f1nx == 1 and f2ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y and centerone.x > centertwo.x edge.hidden = true else edge.hidden = false end ####### ## E ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end ####### ## S ## ####### if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end end if f2nx == 1 and f1ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y and centerone.x < centertwo.x edge.hidden = true else edge.hidden = false end ####### ## E ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end ####### ## S ## ####### if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end end ####################### ## SW Vertical Lines ## ####################### if f1nx == -1 and f2ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y and centerone.x < centertwo.x edge.hidden = true else edge.hidden = false end ####### ## W ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end ####### ## S ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end end if f2nx == -1 and f1ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y and centerone.x > centertwo.x edge.hidden = true else edge.hidden = false end ####### ## W ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end ####### ## S ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end end ####################### ## NW Vertical Lines ## ####################### if f1nx == -1 and f2ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y and centerone.x < centertwo.x edge.hidden = true else edge.hidden = false end ####### ## W ## ####### if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end ####### ## N ## ####### if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end end if f2nx == -1 and f1ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y and centerone.x > centertwo.x edge.hidden = true else edge.hidden = false end ####### ## W ## ####### if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end ####### ## N ## ####### if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end end ###################################### ## Edges with more than three faces ## ###################################### if faces[2] edge.hidden = false end ######################### ## Edges with one face ## ######################### if faces[1] == nil edge.hidden = true end end
-
Hi, this is another attempt and it seems to be working quite well with the test I have made so far. I am now wondering how to make the code work with faces that are on an angle in respect to the xyz axis.
If anyone has a clue I am all ears...here is the code so far
model = Sketchup.active_model sel = model.selection ents = model.active_entities edges = ents.grep(Sketchup;;Edge) edges.each do |edge| faces = edge.faces faceone = faces.first facetwo = faces.last areaone = faceone.area areatwo = facetwo.area f1nx = faceone.normal.x f1ny = faceone.normal.y f1nz = faceone.normal.z f2nx = facetwo.normal.x f2ny = facetwo.normal.y f2nz = facetwo.normal.z boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center ############################# ## ZN Top Horizontal Lines ## ############################# if f1nz == 1 and f2ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z > centertwo.z and centerone.y < centertwo.y edge.hidden = true end if centerone.z < centertwo.z and centerone.y < centertwo.y edge.hidden = true end if centerone.z > centertwo.z and centerone.y > centertwo.y edge.hidden = true end end if f2nz == 1 and f1ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z < centertwo.z and centerone.y > centertwo.y edge.hidden = true end if centerone.z > centertwo.z and centerone.y > centertwo.y edge.hidden = true end if centerone.z < centertwo.z and centerone.y < centertwo.y edge.hidden = true end end ############################# ## ZE Top Horizontal Lines ## ############################# if f1nz == 1 and f2nx == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z > centertwo.z and centerone.x < centertwo.x edge.hidden = true end if centerone.z < centertwo.z and centerone.x < centertwo.x edge.hidden = true end if centerone.z > centertwo.z and centerone.x > centertwo.x edge.hidden = true end end if f2nz == 1 and f1nx == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z < centertwo.z and centerone.x > centertwo.x edge.hidden = true end if centerone.z > centertwo.z and centerone.x > centertwo.x edge.hidden = true end if centerone.z < centertwo.z and centerone.x < centertwo.x edge.hidden = true end end ############################# ## ZS Top Horizontal Lines ## ############################# if f1nz == 1 and f2ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z > centertwo.z and centerone.y > centertwo.y edge.hidden = true end if centerone.z < centertwo.z and centerone.y > centertwo.y edge.hidden = true end if centerone.z > centertwo.z and centerone.y < centertwo.y edge.hidden = true end end if f2nz == 1 and f1ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z < centertwo.z and centerone.y < centertwo.y edge.hidden = true end if centerone.z > centertwo.z and centerone.y < centertwo.y edge.hidden = true end if centerone.z < centertwo.z and centerone.y > centertwo.y edge.hidden = true end end ############################# ## ZW Top Horizontal Lines ## ############################# if f1nz == 1 and f2nx == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z > centertwo.z and centerone.x > centertwo.x edge.hidden = true end if centerone.z < centertwo.z and centerone.x > centertwo.x edge.hidden = true end if centerone.z > centertwo.z and centerone.x < centertwo.x edge.hidden = true end end if f2nz == 1 and f1nx == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z < centertwo.z and centerone.x < centertwo.x edge.hidden = true end if centerone.z > centertwo.z and centerone.x < centertwo.x edge.hidden = true end if centerone.z < centertwo.z and centerone.x > centertwo.x edge.hidden = true end end ###################################### ###################################### ###################################### ################################ ## ZE Bottom Horizontal Lines ## ################################ if f1nz == -1 and f2nx == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z < centertwo.z and centerone.x < centertwo.x edge.hidden = true end if centerone.z > centertwo.z and centerone.x < centertwo.x edge.hidden = true end if centerone.z < centertwo.z and centerone.x > centertwo.x edge.hidden = true end end if f2nz == -1 and f1nx == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z > centertwo.z and centerone.x > centertwo.x edge.hidden = true end if centerone.z < centertwo.z and centerone.x > centertwo.x edge.hidden = true end if centerone.z > centertwo.z and centerone.x < centertwo.x edge.hidden = true end end ################################ ## ZN Bottom Horizontal Lines ## ################################ if f1nz == -1 and f2ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z < centertwo.z and centerone.y < centertwo.y edge.hidden = true end if centerone.z > centertwo.z and centerone.y < centertwo.y edge.hidden = true end if centerone.z < centertwo.z and centerone.y > centertwo.y edge.hidden = true end end if f2nz == -1 and f1ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z > centertwo.z and centerone.y > centertwo.y edge.hidden = true end if centerone.z < centertwo.z and centerone.y > centertwo.y edge.hidden = true end if centerone.z > centertwo.z and centerone.y < centertwo.y edge.hidden = true end end ################################ ## ZW Bottom Horizontal Lines ## ################################ if f1nz == -1 and f2nx == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z < centertwo.z and centerone.x > centertwo.x edge.hidden = true end if centerone.z > centertwo.z and centerone.x > centertwo.x edge.hidden = true end if centerone.z < centertwo.z and centerone.x < centertwo.x edge.hidden = true end end if f2nz == -1 and f1nx == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z > centertwo.z and centerone.x < centertwo.x edge.hidden = true end if centerone.z < centertwo.z and centerone.x < centertwo.x edge.hidden = true end if centerone.z > centertwo.z and centerone.x > centertwo.x edge.hidden = true end end ################################ ## ZS Bottom Horizontal Lines ## ################################ if f1nz == -1 and f2ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z < centertwo.z and centerone.y > centertwo.y edge.hidden = true end if centerone.z > centertwo.z and centerone.y > centertwo.y edge.hidden = true end if centerone.z < centertwo.z and centerone.y < centertwo.y edge.hidden = true end end if f2nz == -1 and f1ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.z > centertwo.z and centerone.y < centertwo.y edge.hidden = true end if centerone.z < centertwo.z and centerone.y < centertwo.y edge.hidden = true end if centerone.z > centertwo.z and centerone.y > centertwo.y edge.hidden = true end end ###################################### ###################################### ###################################### ####################### ## NE Vertical Lines ## ####################### if f1nx == 1 and f2ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y and centerone.x > centertwo.x edge.hidden = true end ####### ## N ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end ####### ## E ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end end if f2nx == 1 and f1ny == 1 and boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y and centerone.x < centertwo.x edge.hidden = true end ####### ## N ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end ####### ## E ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end end ####################### ## SE Vertical Lines ## ####################### if f1nx == 1 and f2ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y and centerone.x > centertwo.x edge.hidden = true end ####### ## E ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end ####### ## S ## ####### if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end end if f2nx == 1 and f1ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y and centerone.x < centertwo.x edge.hidden = true end ####### ## E ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end ####### ## S ## ####### if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end end ####################### ## SW Vertical Lines ## ####################### if f1nx == -1 and f2ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y and centerone.x < centertwo.x edge.hidden = true end ####### ## W ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end ####### ## S ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end end if f2nx == -1 and f1ny == -1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y and centerone.x > centertwo.x edge.hidden = true end ####### ## W ## ####### if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end ####### ## S ## ####### if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end end ####################### ## NW Vertical Lines ## ####################### if f1nx == -1 and f2ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y < centertwo.y and centerone.x < centertwo.x edge.hidden = true end ####### ## W ## ####### if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end ####### ## N ## ####### if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y < centertwo.y and centerone.x < centertwo.x if areaone < areatwo edge.hidden = true end end end if f2nx == -1 and f1ny == 1 boundboxone = faceone.bounds centerone = boundboxone.center boundboxtwo = facetwo.bounds centertwo = boundboxtwo.center if centerone.y > centertwo.y and centerone.x > centertwo.x edge.hidden = true end ####### ## W ## ####### if centerone.y < centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone < areatwo edge.hidden = true end end ####### ## N ## ####### if centerone.y > centertwo.y and centerone.x < centertwo.x if areaone > areatwo edge.hidden = true end end if centerone.y > centertwo.y and centerone.x > centertwo.x if areaone > areatwo edge.hidden = true end end end ###################################### ###################################### ###################################### ###################################### ###################################### ## Edges with more than three faces ## ###################################### if faces[2] edge.hidden = false end ######################### ## Edges with one face ## ######################### if faces[1] == nil edge.hidden = true end ####################### ## Edges inside face ## ####################### if f1nz == 1 and f2nz == 1 edge.hidden = true end if f1nz == -1 and f2nz == -1 edge.hidden = true end ### if f1nx == 1 and f2nx == 1 edge.hidden = true end if f1nx == -1 and f2nx == -1 edge.hidden = true end ### if f1ny == 1 and f2ny == 1 edge.hidden = true end if f1ny == -1 and f2ny == -1 edge.hidden = true end end
-
If anyone is interest I updated the code above with much better one...cheers!
-
I would be interested. Could you post the new version?
Thanks!
Chris
-
I still plan to keep working on this and will post future progress. The best case scenario will be to make it work on faces that have angle...so far my attempts have failed in solving this but will keep trying.
Advertisement