如何绘制不同厚度的圆弧 [英] How to draw an arc with varying thickness

查看:167
本文介绍了如何绘制不同厚度的圆弧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在android中绘制一个变化厚度的弧,如下图所示,

I need to draw an arc in android with varying thickness, as represented in the below image,

是否可以绘制圆弧并对其进行修剪?由于弧线可以在任意角度之间(startDegree到endDegree),因此我无法通过path来实现.

Is it possible to draw an arc and clip it? as the arc can be between any degrees (startDegree to endDegree), i can't acheive this with path.

所以我的要求是这样的

请帮助我实现以上目标.

Please help me to achieve the above.

推荐答案

我认为,您可以使用路径

您的弧线具有以下特征:

You arc has edges like:

  • 水平直线
  • 上弧线
  • 垂直直线
  • 下弧

因此,您需要进行一些数学运算才能计算出这些坐标和参数.

So, you need to take some math to calculate these coordinates and params.

UPD:
请查看此问题 好像我在那里找到了该曲线的精确公式.

UPD:
Please, take a look at this question Seems like I found exact formula for this curve there.

UPD 2:
关于如何在画布上绘制螺旋线,我认为不是很糟糕的解决方案,例如

UPD 2:
About how to draw spiral on canvas, I think not very bad solution is do like here (there javascript is used, but it doesn't matter – the idea is the same). The only thing: it is needed to write spiral equation in Cartesian coordinate system. Try to do this by yourself. If you fail, then ask me.

UPD 3: 检查上述问题的UPD2部分以找到笛卡尔坐标系参数化. 它可能包含错误,我没有亲自检查过,但是这个想法应该很清楚.

UPD 3: Check mentioned above question's UPD2 section to find Cartesian coordinate system parametrization. It might contain mistakes, I didn't check it by myself, but the idea should be clear.

希望有帮助.

这篇关于如何绘制不同厚度的圆弧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆