Home Technical Talk

Need Help - Find "reversed edge".

polycounter lvl 14
Offline / Send Message
miauu polycounter lvl 14
HI!
First I want to apologise for my bad english.
Now, the problem.
I'm trying to make a script that connects edges like BandSaw tool in Lightwave. For now I've written the code that divides the edges on the desired locations, and then connects them. Basically, the script works in that way:
1.takes the first edge from edge selection and divides it
2.takes the second edge and divides it
.
.
10. takes the 10th edge and divide it
then:
13. takes the first vert of the first edge, takes the first vert of the second edge .. etc. and connects these verts.
14. takes the second vert of the first edge, takes the second vert of the second edge...etc. and connects these verts.

But I found a problem.
See on the image below.

imagereversededge.png

Why the middle edge is "reversed"? And how to find the "reversed" edges in initial edge selection(selections that will be connected)? This is the 4th day that I am trying to find a solution, but with no success.

Replies

  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi, unfortunately the edge direction is a quite random parameter in 3ds Max meshes. The way I use to overcome this problem in the case of "ring selections" as the one you're showing, is to pick a sort of "loop reference" on one of the two sides.

    Use polyOp.getEdgeVerts which gives an array made of the two extremity vertexes ordered, so you can keep track of edge directions, and compare them with the reference side loop. When adding vertexes to ring edges if new edge has the same direction as previous then the insertion proportion is equal, while if it is reversed, proportion becomes 1-proportion.

    I know it is not trivial, but it could get you started. It is quite old and on some parts a little overcomplicated, but you can take a look at my IC.PolySplitRing code, which makes use of this technique.
  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    Hi, SyncViewS !
    I have and use PolySplitRing and I will look at the code. Thanks for your help. :)
Sign In or Register to comment.