如果直线垂直于圆的切线,则延伸时它将穿过圆心。如果您的圆以 (a,b) 为中心,半径为 r,并且您希望它以角度 t 出现,则起点为 x1=a+rcos t, y1=b+rsin t (我假设你希望线从圆周开始,这就是你的问题似乎暗示的),如果你希望线的长度为 z,你的终点是 x2=x1+zcos t, y2=y1+zsin t 并且可以使用处理命令
line(x1,y1,x2,y2)
编辑:请注意,我的 t 是从 x 轴顺时针测量的。如果你希望它是逆时针的(这在数学中是正常的),你可以在上面的两个地方用 -sin t 替换 sin t ,因为处理过程中 y 会增加而下降。
If the line is perpendicular to a tangent to the circle, it would pass through the center of the circle if extended. If your circle is centered at (a,b) with radius r, and you want it to come out at angle t, then the start points are x1=a+rcos t, y1=b+rsin t (I've assumed you want the line to start at the circumference, which is what your question seems to imply) and if you want the line to be of length z, your end points are x2=x1+zcos t, y2=y1+zsin t and you can use the processing command
line(x1,y1,x2,y2)
Edit: Note that my t is measured clockwise from the x-axis. If you want it to be counter-clockwise (which is normal in maths) you can replace sin t with -sin t in both places above, since processing has increasing y going down.
I suggest you forget about the tangent and draw a line from the center of the circle in the directions you want the line to protrude from. You could offset the line the radius distance so that it starts at the edge of the circle.
Ideally there can be infinite tangents to a circle and hence you can have infinite lines coming out of a circle.
If I did understand your question correctly then the following might help.
You can pick random points lying on a circle and then connect them to the center of the circle. For the lines to actually come out of the circle, consdier a circle of slightly bigger radius than your original circle, but having the same center coordinates. Then pick random points on the circumference of this outer circle and connect them to its center.
For a circle a perpendicular to a tangent would pass through the centre of the circle. Any line which passes through the centre of a circleis perpendicular to the tangent at the point it intersects the circle.
发布评论
评论(4)
如果直线垂直于圆的切线,则延伸时它将穿过圆心。如果您的圆以 (a,b) 为中心,半径为 r,并且您希望它以角度 t 出现,则起点为 x1=a+rcos t, y1=b+rsin t (我假设你希望线从圆周开始,这就是你的问题似乎暗示的),如果你希望线的长度为 z,你的终点是 x2=x1+zcos t, y2=y1+zsin t 并且可以使用处理命令
编辑:请注意,我的 t 是从 x 轴顺时针测量的。如果你希望它是逆时针的(这在数学中是正常的),你可以在上面的两个地方用 -sin t 替换 sin t ,因为处理过程中 y 会增加而下降。
If the line is perpendicular to a tangent to the circle, it would pass through the center of the circle if extended. If your circle is centered at (a,b) with radius r, and you want it to come out at angle t, then the start points are x1=a+rcos t, y1=b+rsin t (I've assumed you want the line to start at the circumference, which is what your question seems to imply) and if you want the line to be of length z, your end points are x2=x1+zcos t, y2=y1+zsin t and you can use the processing command
Edit: Note that my t is measured clockwise from the x-axis. If you want it to be counter-clockwise (which is normal in maths) you can replace sin t with -sin t in both places above, since processing has increasing y going down.
我建议您忘记切线,并从圆心沿您希望线突出的方向画一条线。您可以将线偏移半径距离,以便它从圆的边缘开始。
I suggest you forget about the tangent and draw a line from the center of the circle in the directions you want the line to protrude from. You could offset the line the radius distance so that it starts at the edge of the circle.
理想情况下,圆可以有无限的切线,因此圆可以有无限的直线。
如果我正确理解你的问题,那么以下内容可能会有所帮助。
您可以选取圆上的随机点,然后将它们连接到圆心。为了使线条真正从圆中出来,请考虑一个半径比原始圆稍大但具有相同中心坐标的圆。然后在该外圆的圆周上随机选取点并将它们连接到其中心。
干杯
Ideally there can be infinite tangents to a circle and hence you can have infinite lines coming out of a circle.
If I did understand your question correctly then the following might help.
You can pick random points lying on a circle and then connect them to the center of the circle. For the lines to actually come out of the circle, consdier a circle of slightly bigger radius than your original circle, but having the same center coordinates. Then pick random points on the circumference of this outer circle and connect them to its center.
cheers
对于圆来说,切线的垂直线将穿过圆心。任何穿过圆心的直线都垂直于与圆相交点的切线。
For a circle a perpendicular to a tangent would pass through the centre of the circle. Any line which passes through the centre of a circleis perpendicular to the tangent at the point it intersects the circle.