Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
Kent1Cooper
Posts: 5,278
Registered: ‎09-13-2004
Message 1 of 3 (601 Views)

Self-intersecting Polyline/Spline: find both Param/Dist values at intersection?

601 Views, 2 Replies
01-21-2013 10:54 AM

[I did a Search for threads about self-intersecting things, but didn't find this question raised.]

 

See the attached image.  I'm trying to find a way to identify both Parameter or both Distance values, not just one, along a self-intersecting Polyline or Spline at its point of self-intersection.  Given that intersection as the 'point' argument, the (vlax-curve-get...AtPoint) functions "see" [or at least return] only the first (i.e. numerically lower) value, for either Parameter or Distance along the object.  Maybe there's some function that can find them both, that I'm not aware of, or that I haven't realized would be applicable.  Either both Parameters or both Distances would do -- I wouldn't need both kinds.

 

The image shows closed objects, but the same applies if they're open-ended.

 

Some related information follows, in case it helps find an answer.  [The first two bracketed items are incidental to the question, which really comes after the self-intersection point has been defined, but I include them just in case.]

 

[For a self-intersecting Polyline, (vla-intersectwith...) finds all vertices (not including ends if it's open), in addition to the self-intersection point.  That point can be isolated by comparing the results to a list of the vertices, but not if there happens to be a vertex at the self-intersection point.  So it's more reliable to ask the User to pick it, and use INTersection object snap.]

 

[For a Spline, INTersection object snap does not recognize the self-intersection point!  So the User can't pick it, but it can be found using (vla-intersectwith...), giving it the same object twice.  It's "cleaner" than for a Polyline, in that it returns only the one self-intersection point, not any of the fit points or control points.]

 

For a Polyline, if the "B" portion/segment is a line segment, it seems possible to calculate the value along that segment, if there's nothing that will simply return it.  It would require determining on which segment the self-intersection point falls, probably by looking for a pair of adjacent vertices for which the direction from the first to the intersection is the same as that from the intersection to the second.  Then the proportional Parameter or Distance value could be calculated with a few (distance) functions and a division.  But again, that depends on the intersection being in the middle of a segment, not at a vertex.

 

For a Polyline, if the "B" portion/segment is an arc segment [as in the attached image], there may be some way to calculate the values, but even just determining on which segment the self-intersection point falls looks like it would be pretty tricky, and once that's determined, calculating the proportional values would also be far more challenging than for a line segment, but might be possible.

 

I suppose it would be possible, and might be necessary, to reverse the object [I have a routine to do that], get the value at the self-intersection point for the reversed version, and subtract that from the value for the overall original object.  But I'd rather not go through that if there's a more direct way.  And for some Splines [those without fit points, e.g. one that's been Broken], I believe a reversal can only be approximated, so there would be some loss of precision [though maybe not enough to matter to what the result would be used for].

 

So far, for Polylines I've only been thinking in terms of Lightweight ones.  I'm hoping that if there's a solution for those, it will also be applicable to, or adjustable to apply to, "heavy" 2D and 3D Polylines, but that's further down the road.  And I haven't thought about any complications regarding such things as different coordinate systems yet, either.

Kent Cooper
Valued Contributor
marko_ribar
Posts: 93
Registered: ‎12-04-2011
Message 2 of 3 (562 Views)

Re: Self-intersecting Polyline/Spline: find both Param/Dist values at intersecti

01-21-2013 11:38 PM in reply to: Kent1Cooper

Maybe this topic can help you...

 

http://www.theswamp.org/index.php?topic=28438.msg340362#msg340362

 

M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
*Expert Elite*
Kent1Cooper
Posts: 5,278
Registered: ‎09-13-2004
Message 3 of 3 (544 Views)

Re: Self-intersecting Polyline/Spline: find both Param/Dist values at intersecti

01-22-2013 05:49 AM in reply to: marko_ribar

marko_ribar wrote:

Maybe this topic can help you...

....


Thank you -- that looks promising.  It will take a little time to absorb and compare, but I'll delve into it.

Kent Cooper

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community