How do you check to see if a curve intersects itself?

   13225   19   2
User Avatar
Member
49 posts
Joined: July 2006
Offline
Howdo all,

I am still relatively new to all this and have got myself into a bit of a fix.

How do you see if a curve intersects itself and extract the xyz co ordinates at that point?

I started in vex trying to compare the curve with a section of the curve which carves along the length of the curve. If the intersection happens then the angle between the curves should be greater than zero, but I cant seem to get the angle between the curves.

This also seems a long way round if anyone has a better solution. I did try checking for a collision on the loop with itself but if is always colliding with itself

Any help greatly appreciated
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
curvesect sop.

Can have it set to generate a single point: the intersection point.
There's at least one school like the old school!
User Avatar
Member
49 posts
Joined: July 2006
Offline
Thanks for the reply,

I have tried the curvesect sop, but as the carve is animated through the path of the curve it is always intersecting the curve.

This is the setup I was working with. the carve hase a first and second u at a distance of 0.001 from each other


User Avatar
Member
49 posts
Joined: July 2006
Offline
let me try that again

heres the images

Attachments:
curvesec1.jpg (12.4 KB)
curve.jpg (29.7 KB)

User Avatar
Member
311 posts
Joined: July 2005
Offline
ok, i have a solution for you, but it's a dirty lttle hack.
it presumes your curve is on one plane.
I didn't check for a non-plananr curve, but this might work with some tweaking.

duplicate and offset the curve, then skin it.
feed it into both inputs of surfsect and set that to intersect. It'll give you a bunch of mess, but somewhere in there is an intersection curve. use a profile SOP to extract the profiles. you'll have 4, so select one of them which you can either carve down to the intersection point or use a point expression to get the value you want.

as I said, it's a little dirty, but it worked for the example you iluustrated.

hope that helps

jerry
User Avatar
Member
49 posts
Joined: July 2006
Offline
well im willing to try anything once. will let you know
User Avatar
Member
49 posts
Joined: July 2006
Offline
i dont think I have got it quite right

I sweeped the nurbs curve with an opened arc nurb circle, feed both into the surfsect node on intersect but I have been left with the solid shape of the swept curve!!? Changing the options havn't given anything except for the shape ot the curve?

if I have got it right how do i extract the information of the points?
User Avatar
Member
49 posts
Joined: July 2006
Offline
heres the hip to have a look at

Attachments:
intersecttest.hip (174.2 KB)

User Avatar
Member
49 posts
Joined: July 2006
Offline
I have solved my curve intersection over a time range. If you use the HUD slider the green section will travel the curve so you can do a collision test.

It still dosnt do it instanttaniously though as it might with the surfsect sop though. doesde mine not work as the curve dosnt have a surface to bolean?

Ed

Attachments:
intersecttest2.hip (77.7 KB)
network1.jpg (18.6 KB)
loop1.jpg (14.0 KB)

User Avatar
Member
311 posts
Joined: July 2005
Offline
ok.

pipe your curve into both inputs of the curvesect SOP.
turn off “find all intersections”, and check “Extract”.
leave everything else unchanged.
that should be it!
User Avatar
Member
49 posts
Joined: July 2006
Offline
thanks for your time and patience jesta but I still cant seem to get anything .

if you have the time could you send me the hip or jpg of the network just to see if i've missed anything

thanks
User Avatar
Member
311 posts
Joined: July 2005
Offline
sure. here you go.

as you can see there's one point which represents your intersection P.

Attachments:
intersecttest2_889.hip (77.7 KB)

User Avatar
Member
49 posts
Joined: July 2006
Offline
BIngo!!!!!

I see it, and it seems to do it for the whole ark no matter what the carve is doing.

Thanks for your help
User Avatar
Member
49 posts
Joined: July 2006
Offline
Ah well! Close but no cigar.

it works ok on small curves but if you break the curve up even more or have a more complex curve the points dont corilate as well

I think its close though I think I might need to rethink it a bit. :?

Attachments:
intersecttest3.hip (94.7 KB)

User Avatar
Member
8083 posts
Joined: July 2005
Offline
I might be too late on this but an idea just occured to me. The idea is to just resample the curve to within the desired tolerance, fuse the points using this same tolerance, and then delete all the resulting points which have <= 2 neighbours with the help of VOPs.

Attachments:
intersecttest_curve.zip (11.1 KB)

User Avatar
Member
49 posts
Joined: July 2006
Offline
Its never too late

That is brilliant I even think I know how it works

I was working on compating xyz and u values. I'll post it when I finish it. It still might be useful to someone

Thanks for the help
User Avatar
Member
8083 posts
Joined: July 2005
Offline
Oh wait, I just realized where my method would fail. If the endpoints of the curve touch each other, then the intersection won't be noticed. That case could be detected separately and the result merged in though.
User Avatar
Member
49 posts
Joined: July 2006
Offline
HI Edward,

I have a question about your solution. If you have fixed the length of the resampling why does part of the curve disappear after the consolidate in the fuse sop, espacially as it is linked to the resample size?

I think I can follow every thing else.

Thanks

Ed
User Avatar
Member
8083 posts
Joined: July 2005
Offline
I think it's because the points are consolidated consecutively? So that free flowing portion of the curve is successively collapsed because the distance between them is within the threshold. So to make it not collapse, you can multiply the Fuse threshold by 0.5.
User Avatar
Member
49 posts
Joined: July 2006
Offline
Thanks. I was explaining it to a friend and realised I had no idea exactly what the fuse part did.
  • Quick Links