简体   繁体   English

2 Java GeneralPath之间的带状线

[英]stripline between 2 Java GeneralPath

Can anyone give me a hint or help me with my following ( hopefully also interesting :-) ) problem. 任何人都可以给我提示或帮助我解决以下问题(希望也很有趣:-))。

I have 2 GeneralPath in my JavaProgramm and I would like to findout the stripline between them. 我的JavaProgramm中有2个GeneralPath,我想找出它们之间的带状线。

Following situation: 以下情况:

I have 2 GeneralPath A & B 我有2个GeneralPath A和B

A is a yellow triangle with 3 points ( moveto, lineto, lineto , close ) A是一个带有3个点的黄色三角形(moveto,lineto,lineto,close)

B (red) was a triangle and is a result of a substraction BA: B(红色)是一个三角形,是减去BA的结果:

B = new Area(gp_B); // General path B area object
A = new Area(gp_A); // General path A area object
B.subtract(A);

B has 4 points after the substraction. B减去后得到4分。 So there is no intersection between A & B and GeneralPath anymore and A doesn't have any points that matches any points of GeneralPath B. 因此,A和B与GeneralPath之间不再有交集,并且A没有与GeneralPath B的任何点匹配的点。

在此处输入图片说明

How can I findout the stripline between them ? 我如何找出它们之间的带状线?

My example is simplified for better explaining. 我的示例经过简化以更好地解释。 My GeneralPath A & B could also contain Beziercurves with Cubeto: 我的GeneralPath A和B还可以包含带有Cubeto的Beziercurves:

在此处输入图片说明

Regards Andreas 问候安德烈亚斯

i doubt that you would get an desired answer, so i first give you some tipps to limit the complexity of your task: 我怀疑您是否会得到理想的答案,所以我首先给您一些提示以限制您的任务的复杂性:

i would reduce your task to so called simple polygons. 我会将您的任务简化为所谓的简单多边形。 That are non self intersecting polygons. 那是非自相交多边形。 once that works you may try to extend to bezier paths. 一旦可行,您可以尝试扩展到贝塞尔曲线路径。
To do your task for a generall path, this is very demaning (is this a master thesis where you have 6 months time for your job, or a CAD system with a customer willing to pay?) 要在一般路径上完成任务,这是非常需求的(这是硕士论文,您有6个月的工作时间,还是有愿意付款的客户的CAD系统?)

If you still want to do that: 如果您仍然想这样做:
start hand drawing the most complex scenarios: fully overlapping (like a wooden cross). 开始手绘最复杂的场景:完全重叠(如木制的十字架)。

Then who does the subtraction? 那谁减去呢? is that ready working? 准备好了吗? which limitations the subtraction has (simple polygons vs non simple) 减法的局限性(简单多边形与非简单多边形)

One possibility : 一种可能性

get the source code of the subtraction, try to understand, and extend that part that does the cutting, such that it returns an additional stripe path. 获取减法的源代码,尝试理解并扩展执行裁切的部分,以使其返回附加的条纹路径。

The other solution: 另一个解决方案:

A1: compare old objects with the points after cutting. A1:将旧物体与切割后的点进行比较。 Determine the new introduced points. 确定新引入的点。 follow one point on the path until an old point is reached. 沿着路径上的一个点,直到到达一个旧点。 do that in the other direction, too. 也可以朝另一个方向做。 concat both directions. 双向连接。

do that for all new points, and finally you get a list of stripes, probably you have to clean up by removinh duplicate lines. 对所有新点执行此操作,最后得到一个条纹列表,可能您必须通过删除重复的行来进行清理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM