I have an array of TPoints
and I want to draw the trellis
that passes through all these points without intersecting itself
.
Is there any algorithm available?
-
2First, I think you need to clarify what you mean. What exactly is a "trellis" in this case? Second, if you think about it, this is not a Delphi question, but a pure mathematics (algorithm) question.– Andreas RejbrandSep 26 at 12:59
-
@AndreasRejbrand,"trellis" is another word for polyline. I'm looking for a Delphi coded algorithm. I suppose that somebody/somewhere could have/been developed one.– JimPapasSep 26 at 13:39
-
I still don't get it. If the input is any arbitrary array of points, "the trellis" may not exist, i.e., it is not at all certain that there exists a unique polyline that (1) passes through every point and (2) does not self intersect. I mean, if the points are (0, 0) and (1, 1), one possibility is the line from (0, 0) to (1, 1); another is the line from (-1, -1) to (55, 55). So which do you want? Maybe you mean "a trellis" instead of "the trellis"? (This is not grammatical nitpicking. When you discuss algorithms, mathematical precision is absolutely necessary.) Or do you also require...– Andreas RejbrandSep 26 at 13:44
-
...that the polyline only starts, ends, and "turns" at a point? If so, you need to make that clear! But even in this case, neither existence nor uniqueness is guaranteed. And in every case, this absolutely is a math Q, not a Delphi Q. The algorithm could be implemented in any language, and trivially converted between languages. The only reason one could insist on a particular language in a case like this is if your real Q is "please write the code for me" or "please recommend a library". In both cases, the Q would be off-topic at SO.– Andreas RejbrandSep 26 at 13:46
-
(Well, existence probably isn't an issue. But uniqueness certainly is.)– Andreas RejbrandSep 26 at 14:08
|
Show 7 more comments