python怎么显示线的点坐标,如何在python中计算两点之间的线的坐标?

How can I get all the coordinate points between two points in python?

For example: I have a point with the coordinates of x1, y1 and an other with x10, y10. I need all the points between them (in this case for instance x2, y2 ... x9, y9). Huge thanks for your help!

解决方案

"All of them"? There are an infinite number.

You can calculate the slope and intercept of the line between those two points. Knowing those you can calculate the value for y at every value of x you wish using the equation for the line.

This is high school algebra. What's the problem?

Given two points (x1, y1) and (x2, y2) the equation for the line between them is:

y = m*x + b

where

m = slope = (y1-y2)/(x1-x2)

and

b = y-intercept = (x1*y2 - x2*y1)/(x1-x2)

If you mean "draw the circle passing between the two points and find all the points inside", I'd calculate the center point as the midpoint of that line and radius equal to half the length of that line. You calculate whether or not a point is inside or outside the circle by determining the distance from the center and comparing it to the radius.

There are an infinite numbers of points both inside and outside the circle. What are you really trying to do here?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值