如何使用 Conrec 组装轮廓线的连续点数组
我有一个 Conrec 噩梦。我正在尝试使用 Conrec 在 ActionScript 中实现轮廓线。我已经查看了 java 和 javascript 实现,但仍然陷入困境。这些可以在这里找到:http://paulbourke.net/papers/conrec/
Conrec 将获取网格数据并组装连续的轮廓线。问题在于它不一定以连续的方式绘制这些线。例如,它将绘制 A->B,然后 C->B,然后 C->D,而不是 A、B、C、D 等
。javascript 实现似乎正在考虑这一点并序列化指令到绘制点数组中。这也是我最终想要实现的目标。也就是说,它从核心 Conrec 逻辑获取指令(例如:A->B、C->B、C->D 等)并将其组织成 A、B、C、D 系列。我认为它还会将系列作为多维数组返回以容纳折线(例如:[[A, B, C, D], [E, F, G]])。最后一个功能是我需要在 Actionscript 中执行的操作。
最后一部分是我陷入困境的地方。暂时忽略Conrec(我已经放弃寻找Actionscript实现),我如何将这些指令组织成串行点的集合?当 Conrec 给我“从 X->Y 绘制点”时,我如何首先检查 X 或 Y 是否已经在系列中,并将 X 或 Y(以不在系列中的为准)附加到系列中?如果两者都不在系列中,则开始一个以 X、Y 作为起始集的新系列。然后检查所有现有系列的后续说明,并连接系列是否现在在同一点开始和停止?另外,我需要能够允许一系列自行关闭(例如:A、B、C、A)——一个循环(这可能吗?!)。
我希望这是有道理的。我不确定除了“串联”之外是否有一个技术术语来描述我想做的事情。我也希望有人已经使用 Conrec 完成了这项工作,并且可以给我一些指导。
与此同时,我将继续努力,看看我是否能想出一些东西,但我对自己的能力没有信心。我真的很感谢一些资深人士或专业人士的建议。
附: 如果您知道从网格数据绘制轮廓线的另一种方法,我愿意接受替代方案。但我必须能够在 Actionscript 中实现它。
I have a Conrec nightmare. I am trying to implement contour lines in ActionScript using Conrec. I have looked at both the java and javascript implementation and am still stuck. These are found here: http://paulbourke.net/papers/conrec/
Conrec will take grid data and assemble continuous contour lines. The problem is that it does not necessarily draw those lines in a continuous fashion. For example, it will draw A->B and then C->B and then C->D instead of A, B, C, D, etc.
The javascript implementation seems to be accounting for this and serializing the instructions into an array of draw points. Which is what I too want to accomplish in the end. That is it takes the instructions from the core Conrec logic (eg: A->B, C->B, C->D, etc) and organizes it into an A, B, C, D series. I think it will also return the series as a multi-dimensional array to accommodate broken lines (eg: [[A, B, C, D], [E, F, G]]). This last functionality is what I need to do in Actionscript.
This last part is where I am stuck. Ignore Conrec for now (I have given up on finding an Actionscript implementation), how can I organize these instructions into a collection of serial points? When Conrec gives me "draw point from X->Y" how can I first check if X or Y are already in a series and append either X or Y (whichever is not in the series) into the series? AND if neither are in the series, start a NEW series with X, Y as the starting set. Then check subsequent instructions against all existing series and connect series if they now start and stop on the same point? Also, I need to be able to allow for a series to close itself (eg: A, B, C, A) -- a loop (is that even possible?!).
I hope this makes sense. I'm not sure if there is a technical term for what I want to do beyond "concatenation". I also hope someone out there has done this with Conrec and can give me some pointers.
In the meantime, I am going to continue to plug away at this and see if I can come up with something but I am not confident in my abilities. I would really be thankful for some veteran or professional advice.
PS:
If you know another way to draw contour lines from grid data, I am open to alternatives. But I have to be able to implement it in Actionscript.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好的,这是我第一次尝试完成我需要做的事情。我对结果不是很满意,但它似乎有效。
这将给出以下结果:
A1,G1,F1,E1,D1,C1,B1,A1
G2,A2,B2,C2,D2,E2,F2,G2
G3,A3,B3,C3,D3,E3,F3 ,G3
G4,A4,B4,C4,D4,E4,F4,G4
我仍然非常感谢我能得到的任何建议/反馈。 没有人使用Conrec吗?!
编辑:哎呀!我原来的 splice() 有一个错误!对不起!现已修复
Ok, here is my first attempt at getting what I need done. I am not terribly happy with the result, but it seems to work.
This will give the following results:
A1,G1,F1,E1,D1,C1,B1,A1
G2,A2,B2,C2,D2,E2,F2,G2
G3,A3,B3,C3,D3,E3,F3,G3
G4,A4,B4,C4,D4,E4,F4,G4
I would still really appreciate any advice/feedback I can get. Does no one use Conrec?!
Edit: woops! I had a bug with the original splice()! sorry! fixed now
我刚刚将ConRec移植到Actionscript3并且似乎工作正常,我还没有彻底测试它,
但它按照我期望的方式绘制了我的轮廓。如果愿意的话请尝试一下,我很好奇它是否是正确的端口。它在这里:
http://www.jvanderspek.com/DEV/ConRec/ConRec.as< /a>
I just ported ConRec to Actionscript3 and seems to work fine, I haven't tested it thoroughly,
but it draws my contours the way I expect. Try it out if you will, I'm curious if it's a correct port. it's here:
http://www.jvanderspek.com/DEV/ConRec/ConRec.as
好的,Flash 可能有更好的替代方案。我刚刚找到这个链接,它看起来令人印象深刻。如果这有效,它就可以消除原来的问题...
隔离包对于 ActionScript 3
Ok, so there may be a much better alternative for Flash. I just found this link and it looks impressive. If this works, it obviates the original problem...
isolining package for ActionScript 3