magneto Posted September 28, 2012 Share Posted September 28, 2012 Hi, I want to calculate the segment lengths on a curve, but couldn't find a way to do it. I know the arclen expression but it requires a uv parameter. I don't know the u. I thought of splitting the curve but then the shape of the segments change obviously. I also tried UV Texture SOP with arclen option and normalized the values but not sure if they are correct. Is this possible to do? Thanks Quote Link to comment Share on other sites More sharing options...
rafaelfs Posted September 28, 2012 Share Posted September 28, 2012 (edited) With a foreach SOP you could break the curve into 2-point segments and then measure their length with the measure SOP. Or, even better, you could do the same in a VOP SOP, by subtracting P(n) and P(n-1) and doing a length of that. Of course, you will have to set a conditional to handle the initial or the final point, depending on how you plug your nodes. Cheers segment_lenght_01.hip Edited September 28, 2012 by rafaelfs Quote Link to comment Share on other sites More sharing options...
magneto Posted September 28, 2012 Author Share Posted September 28, 2012 Thanks Rafael. I looked at your file. I should mentioned NURBS in my post Quote Link to comment Share on other sites More sharing options...
zarti Posted September 28, 2012 Share Posted September 28, 2012 hi , if you can split ( Carve SOP ) the NURB curve exactly in a 'segment' defined by those two points , you can use the Measure SOP . ( theoretically you Can set as start and end values of carve , values read from the Us from Arclength method of a UV Texture SOP ) theoretically .. =) 1 Quote Link to comment Share on other sites More sharing options...
rafaelfs Posted September 28, 2012 Share Posted September 28, 2012 Thanks Rafael. I looked at your file. I should mentioned NURBS in my post HAHAHAHAH! yeah, that would have made a big difference... 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted September 28, 2012 Author Share Posted September 28, 2012 (edited) Thanks zarti, I was thinking of the same idea but the problem is I don't know what values to use for the Carve's U start and U end parameters Using Texture SOP's MAPU doesn't give actual segments when used in Carve SOP. I tried with a simple curve where the second point is very close to the first point, and the 3rd points is very far, but the MAPU values are still about 0.1, 0.2 as if they are evenly spaced. This is by using the Arc Length option of the Texture SOP. I had another idea to resample the curve into maybe 0.001 Again the problem becomes where to split? You can't use the function that returns the closest point on the curve because the curve might be self intersecting and basically all jumbled up. But I am sure this can be done Edited September 28, 2012 by magneto Quote Link to comment Share on other sites More sharing options...
rafaelfs Posted September 28, 2012 Share Posted September 28, 2012 This is the closest I could get. Doesn't look quite right to me though, as I think the segment should end at the perpendicular to the curve on the CV... segment_lenght_02.hip Quote Link to comment Share on other sites More sharing options...
magneto Posted September 28, 2012 Author Share Posted September 28, 2012 Thanks Rafael, I just looked at it. If you move the second point much closer to first point, then you will see it much better that it carves way longer than the first segment Quote Link to comment Share on other sites More sharing options...
zarti Posted September 28, 2012 Share Posted September 28, 2012 the points ( almost ) never exist over a NURB curve , but here is another suggestion .. -- zegNURBLen.hipnc -- 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted September 28, 2012 Author Share Posted September 28, 2012 Thanks zarti, that's the best so far. Although if the curve intersects with itself many times, then this method might fail. It's still pretty good though I think there should have been another arclen expression that takes point numbers, because if you want to sweep only a few segments of a NURBS curve, you would end up with the same problem. Or the Carve should support point numbers. Quote Link to comment Share on other sites More sharing options...
zarti Posted September 28, 2012 Share Posted September 28, 2012 i do not believe if the curve selfinterects many times that should be a problem . you can expose somewhere the length of line which is used by curvescet SOPs , to act like a tolerance / accuracy controler . fortunately in this case you need just 2 points =) -- agree on Carve suggestion about adding more options to it . also , i wish SESI could add more 'micro-utitlities' to Measure SOP . "measure" is a very generic term , so many things could be measured making our 'life' easier =). .cheers 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted September 29, 2012 Author Share Posted September 29, 2012 Thanks zarti. I just tried it on a complex curve and it created weird results. Paste this into your Curve SOP and try to extract the segment between point 14 and 15: 0.147121,0,1.27816 0.263539,0,1.12725 0.0975361,0,0.989274 -0.240938,0,1.08198 -0.180573,0,1.28032 0.0177683,0,1.13372 0.000521223,0,0.864233 -0.266809,0,0.700385 -0.603127,0,0.571032 -0.519047,0,0.279988 -0.365979,0,0.435211 -0.525515,0,0.616306 -0.499644,0,0.717632 -0.342265,0,0.730568 -0.306454,0,0.607684 -0.45229,0,0.56512 -0.637621,0,0.549473 -0.6484,0,0.437367 -0.467306,0,0.474017 -0.312082,0,0.560253 -0.100805,0,0.6508 0.0113007,0,0.756438 -0.122364,0,0.838362 -0.16117,0,0.894415 -0.0555318,0,0.946156 0.0910684,0,0.99143 0.177304,0,1.02161 0.140654,0,1.08413 0.0867566,0,1.12294 0.00914477,0,1.11863 -0.0663112,0,1.06904 -0.111585,0,1.00221 -0.159014,0,0.935377 -0.191353,0,0.810336 -0.148235,0,0.7241 -0.128832,0,0.605526 -0.0986495,0,0.474017 -0.0835583,0,0.377003 -0.0749348,0,0.277832 -0.139611,0,0.204532 -0.258185,0,0.219623 -0.266809,0,0.437367 -0.262497,0,0.648644 -0.266809,0,0.721944 -0.27112,0,0.80818 -0.215067,0,0.836206 -0.0986495,0,0.793088 -0.290523,0,0.478329 -0.316394,0,0.45677 -0.30777,0,0.407185 -0.238782,0,0.409341 -0.12452,0,0.465394 -0.0684671,0,0.54085 -0.141767,0,0.590435 -0.232314,0,0.609838 -0.320706,0,0.627085 -0.422032,0,0.60337 -0.570788,0,0.523603 -0.65918,0,0.482641 -0.564321,0,0.586123 -0.51258,0,0.525759 -0.443591,0,0.424432 -0.415565,0,0.46755 -0.383226,0,0.525759 -0.385382,0,0.583968 -0.383226,0,0.640021 -0.372447,0,0.668047 -0.333641,0,0.700385 -0.251717,0,0.696074 -0.187041,0,0.676671 -0.126676,0,0.665891 -0.0878701,0,0.663735 -0.00379055,0,0.719788 -0.0555318,0,0.752127 -0.105117,0,0.777997 -0.163326,0,0.812491 -0.193508,0,0.838362 -0.180573,0,0.933221 -0.130988,0,0.941845 -0.0339729,0,0.939689 0.024236,0,0.928909 0.080289,0,0.924598 0.0522625,0,0.99143 0.0436389,0,1.01946 0.0328595,0,1.04102 -0.0339729,0,1.02808 -0.090026,0,1.02808 -0.109429,0,1.04748 -0.12452,0,1.08413 -0.107273,0,1.11863 -0.0835583,0,1.14881 -0.00163466,0,1.2178 0.0651978,0,1.21349 0.112627,0,1.20055 0.181616,0,1.19624 0.24198,0,1.22858 [/CODE]Also what suggestions are you thinking for the measure sop? I would like to hear them Quote Link to comment Share on other sites More sharing options...
zarti Posted September 29, 2012 Share Posted September 29, 2012 =) you can expose somewhere the length of line which is used by curvescet SOPs , to act like a tolerance / accuracy controler . maybe i wasnt clear enough , but here i did it with the reqs from your latest post .. ( the null's UI has a new parameter ) -- zegNURBLen_wAccura.hipnc -- 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted September 29, 2012 Author Share Posted September 29, 2012 Thanks zarti, that's pretty good solution, it works great Quote Link to comment Share on other sites More sharing options...
rafaelfs Posted October 2, 2012 Share Posted October 2, 2012 Very cool indeed! 1 Quote Link to comment Share on other sites More sharing options...
kgoossens Posted October 16, 2012 Share Posted October 16, 2012 Out of respect to Milo's children for bringing their sacrifice, I share the point segments system I've added in my extended carve tool. NurbsCurvePointCarve.hipnc 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted October 16, 2012 Author Share Posted October 16, 2012 Thanks kgoossens, that's very good. Although I just checked but not sure if it actually carves from point to point accurately. Basically this is what I did. I used the first curve (curve1) and then set your NurbsCarve's Start to 1, and then compared the positions of curve1.point[1] to NurbsCarve.point[0] and they are different, except Y of course since the curve is flat. What do you think? Quote Link to comment Share on other sites More sharing options...
kgoossens Posted October 16, 2012 Share Posted October 16, 2012 (edited) I'm not sure if I follow you, I've added a comparative example with zarti. I think I do get the same results. The only difference I made now is that the End slider is not counting backwards. NurbsCurvePointCarve2.hipnc Edited October 16, 2012 by kgoossens Quote Link to comment Share on other sites More sharing options...
magneto Posted October 16, 2012 Author Share Posted October 16, 2012 Sorry I didn't mean your result is different from zarti's, but this was something I realized later on. Basically I wrote something like this: You can say that the sweep shows the curve is being carved correctly but I think this might one of the strange things about carve/sweep as zarti mentioned before about carve. So the questions is should the point positions between the original and the carved curve match? I am not sure myself Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.