[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.
Maybe this topic can help you...
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.