Why should “miter” joints be slower than others?

时间秒杀一切 提交于 2019-12-11 01:48:02

问题


I'm having a graphics problem on drawing lines in Flash Player, where two lines drawn on top of each other with different thickness don't align properly if I use any other JointStyle than MITER. For pictures of the effect, and for the graphics oriented part of the question, see my post over on doctype.

However, there's also a second angle on this problem, which is: why should drawing the "mitered" joints be so much slower than others? This seems to be a problem since at least FP 8, but I couldn't find any detailed info on what the problem might be. Is this just an ordinary bug that didn't get fixed yet, or is there something inherently slower about drawing these joints? For example, they seem to have something to do with square roots, but I seriously lack understanding of what this joint style thing is all about, technically. It just looks like some minor detail a graphic designer might worry about.

I'm asking because I'm wondering if I can do something to mitergate, er, mitigate, the problem.


回答1:


There are various ways to join two lines:

  • none: free
  • round: draw a circle of radius line width/2
  • cap: fill in the gap between the lines
  • miter: extrapolate the lines and fill that

Miter is the most expensive. If the lines are meeting at an outer angle that is greater than 90, they need to be extrapolated, intersected and filled.

From the screenshots at your linked post you shouldn't need any joints for drawing a graph. Joints are only important with large stroke widths and for drawing a graph, round or cap joints should be perfectly fine.

In flash rendering miters is quite fast - it's just the most complicated join to pick.



来源:https://stackoverflow.com/questions/2806753/why-should-miter-joints-be-slower-than-others

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!