ahhhahah i think were doing the same thing. Roughly speaking .
gotta sleepp…cubic bsplines on brain…
eek
Thank you for the answers !
I have a new idea:
1- Initially we select a face randomly. The face 1 for example.
2- We collect all the adjacent faces to this face, until the outline or the border of the object (the open edges). That is like the routine of Stuh but with 2 outlines.
3- We deduce the inverse selection. We thus have two selections of faces: internal and external.
4- A routine determines which is inside the outline : we can calculate the average of the distance between each face and the center of the outline. The one who has the smallest distance is probably the internal selection.
What do you think about that ?
Hey I have just added this feature to Orionflame, and it works great.
It might take a while before I post the code here as I have used alot of predefined fns of Orionflame. At least I will be sure to explain my method.
Thanks for the idea!
Light
I am delighted that my idea was able to help you.
Here is my version.
If You know a means to optimize it, please let me know.
fn getFirstItem theBitArray = (for i in theBitArray do return i)
fn getContinuousFaces obj outlineEdges firstFace =
(
continuousFaces=#{}
facesToInspect=#{firstFace}
while facesToInspect.numberset!=0 do (
currentFace=getFirstItem facesToInspect
adjacentEdges=polyOp.getEdgesUsingFace obj #{currentFace}
for thisEdge in adjacentEdges where ( (outlineEdges*#{thisEdge}).numberset==0 ) do (
newFace=(polyOp.getFacesUsingEdge obj #{thisEdge})-continuousFaces
continuousFaces+=newFace
facesToInspect+=newFace
)--for
facesToInspect[currentFace]=false
)--while
continuousFaces
)--fn
fn getEdgesCenter obj theEdges =
(
theVerts=polyOp.getVertsUsingEdge obj theEdges
theCenter=[0,0,0]
for v in theVerts do theCenter+=polyOp.getVert obj v
theCenter/=theVerts.numberset
)
fn getAverageDistMultiArea obj theFaces theCenter =
(
dist=0.0
for f in theFaces do ( dist+=(distance (polyOp.getFaceCenter obj f) theCenter)*(polyOp.getFaceArea obj f) )
dist/=theFaces.numberset
)
obj=selection[1]
outlineEdges=polyOp.getEdgeSelection obj
theFaces1=getContinuousFaces obj outlineEdges 1
theFaces2=#{1..polyOp.getNumFaces obj}-theFaces1
theOutlineCenter=getEdgesCenter obj outlineEdges
distMultiArea1=getAverageDistMultiArea obj theFaces1 theOutlineCenter
distMultiArea2=getAverageDistMultiArea obj theFaces2 theOutlineCenter
if distMultiArea1<distMultiArea2 then polyOp.setFaceSelection obj theFaces1 else polyOp.setFaceSelection obj theFaces2
subObjectLevel=4
max views redraw
For my function “getFirstItem” … I am not sure that is the right means. Do you know an another means to get the first Item in a bitarray ?
Do you mean something like (bitArray as array)[1]?
I have tried your code in a few cases but it didnt work. It might be because of my selections.
Here is the video of Select Inside I have added to the reference. Selects polygons inside a closed edge selection. If the edge selection is open and splits the model all along, it will select the polygons of one side.
I will give a break down of the code, but now it is quite late here and I should get some sleep.
Light
Unfortunately the conversion into an array is slower.
Oh That does not have any importance.
I don’t know. With my function the outline must be closed. Otherwise nothing is selected. And the system based on the center might not work in 3D space.
Good work !
I tested the same examples as on your video without encountering problems.
When we select edges, we often select edges behind the object. We do not see them. That could be that.
Another thing: script will not function if there are dead faces in the object because I suppose that the faces are
#{1…polyOp.getNumFaces obj}
Light: Video looks good, interested in your method does it work just as easily with concave selections and looping selections?
I don’t know if anyone else has noticed the other thread where I mentioned a mouse tool that works like the Pelt mapping thing, but the idea was to make a select-inside function like this work much easier, to improve my original matID fill script…I still haven’t got that mouse tool working though. Pretty pixel, you can determine which section to fill by using the section that uses the least amount of border edges of the object.
Thanks alot! It works with concave selections. Looping selections like prettyPixel’s second example?
Light