@ prolow you could drastically cut down on the amount of code needed if you would use the point and vector classes from either OpenMaya or from pymel. since that way you would have method available already for adding, subtracting and doing your dot and cross products, and you would have it all implemented with operator overrides.
@ prolow you could drastically cut down on the amount of code needed if you would use the point and vector classes from either OpenMaya or from pymel. since that way you would have method available already for adding, subtracting and doing your dot and cross products, and you would have it all implemented with operator overrides.
indeed you are correct sir, I was pretty comfortable with OpenMaya when I wrote this, don't recall why I didn't use a bit of it then:P, think it was mostly copy pasta from some of my older scripts.
I've been working on something similiar, and like yourself using a similar algorithm, i.e using the avg centre and re-positioning the vert along a vector from this centre a distance of average radius away and intersecting a normalized plane.
Just wondering, have you looked at forcing the initial border selection to create a regular polygon? I'm halfway though doing this, and the maths is getting a bit heavy. Obviously it would only work well if the selection were coplanar, but it might be useful.
@54Strat
If I undetsand what your talking about is regularly spaced boarder points. Then yes I thought about it. That was a feature in the XSI version of the tool that I was basing this one one. I stopped b/c as you said it gets hairy. I'm curious about how your trying to do it though. Feel free to mod this one with your solution.
Run through the existing algorithm, then get the winding order of the border vertices and choose a likely starting point (orthogonally aligned, symmetry or closest radius or edge, or pre-calc and measure least distortion somehow). Then iterate in winding order, and rotate each vertex about the centre so the angle with the previous vertex is (number of vertices)/360. I'm nearly there, just need to find time to finish it.
I did try by calculating what an edge length should be from a circumscribed regular polygon, this worked but only after executing the whole code multiple times as it got closer and closer to it's target lengths. Once you change one edge length, the whole polygon changes and needs to be re calculated.
Not sure how to deal with plane changes though, maybe do it per plane and fix the points on the intersection. Interesting problem.
@54Strat - I starting thinking about how to choose the starting point...then ma head esplod. You talking about solving it iteratively gets me thinking the best way may be a "peltting" type solution.
@passerby - I should catch the error, but I don't think there's a way for the same function to do both scenarios. This function starts by 'spherizing' the points then projects them back to their original vert normal plane along a vector made of the average vert normals. That projection vector gets f'd when it's the average of vert normals pointing in opposite directions. I think thats the case when you include any points that face >= 180 degrees from each other.
I could however catch the case early and skip the projection, leaving it spherical. What do you think?
ah, ya that makes perfect sense, ya i would just check to make sure you don't end up with a vector of 0, 0, 0 and ignore the projection if you do, and just spherize.
update:
- Changed function to skip back projection when appropriate, i.e. - Edge rings round out.
- Recognizes multiple selection sets, i.e. - selecting two unconnected groups of components results in two circles
Replies
indeed you are correct sir, I was pretty comfortable with OpenMaya when I wrote this, don't recall why I didn't use a bit of it then:P, think it was mostly copy pasta from some of my older scripts.
I've been working on something similiar, and like yourself using a similar algorithm, i.e using the avg centre and re-positioning the vert along a vector from this centre a distance of average radius away and intersecting a normalized plane.
Just wondering, have you looked at forcing the initial border selection to create a regular polygon? I'm halfway though doing this, and the maths is getting a bit heavy. Obviously it would only work well if the selection were coplanar, but it might be useful.
If I undetsand what your talking about is regularly spaced boarder points. Then yes I thought about it. That was a feature in the XSI version of the tool that I was basing this one one. I stopped b/c as you said it gets hairy. I'm curious about how your trying to do it though. Feel free to mod this one with your solution.
I did try by calculating what an edge length should be from a circumscribed regular polygon, this worked but only after executing the whole code multiple times as it got closer and closer to it's target lengths. Once you change one edge length, the whole polygon changes and needs to be re calculated.
Not sure how to deal with plane changes though, maybe do it per plane and fix the points on the intersection. Interesting problem.
@passerby - I should catch the error, but I don't think there's a way for the same function to do both scenarios. This function starts by 'spherizing' the points then projects them back to their original vert normal plane along a vector made of the average vert normals. That projection vector gets f'd when it's the average of vert normals pointing in opposite directions. I think thats the case when you include any points that face >= 180 degrees from each other.
I could however catch the case early and skip the projection, leaving it spherical. What do you think?
- Changed function to skip back projection when appropriate, i.e. - Edge rings round out.
- Recognizes multiple selection sets, i.e. - selecting two unconnected groups of components results in two circles
[ame="http://www.youtube.com/watch?v=aPgBjNdCD50"]weight tweaker tool - YouTube[/ame]