简体   繁体   English

通过角度和长度计算线的端点坐标

[英]Calculate coordinates of end point of a line by having the angle and the length

I have the coordinates of the start point of a line and also i have the angle and length of that line and i want to get the coordinates of the endpoint.我有一条线的起点的坐标,也有这条线的角度和长度,我想得到终点的坐标。

I am using the script:我正在使用脚本:

X_B = X_A + (length * round(abs(math.cos(Angle))))
Y_B = Y_A + (length * round(abs(math.sin(Angle))))

But in many cases it doesnt work但在很多情况下它不起作用

Make sure the angle is in radians , not in degrees :确保角度是弧度,而不是度数

import math 

length = 1
Angle = 3.14/3
X_A = 0
Y_A = 0

X_B = X_A + round(length * math.cos(Angle), 3)
Y_B = Y_A + round(length * math.sin(Angle), 3)

print(X_B, Y_B)

Output: Also, don't round sin or cos . Output:另外,不要四舍五入sincos Perform the round on the resulting value.对结果值执行回合。

0.5 0.866

暂无
暂无

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

相关问题 如何计算具有起点 (x,y) 、像素长度和角度的像素坐标? - How to calculate pixel coordinates having start (x,y) , length in pixel and angle? 对于线长的(x,y)像素坐标,调整角度变成圆形 - For (x, y) pixel coordinates in length of line, adjust angle to become circle 如何找到一个点的坐标,使其与给定的线成 135 度角? - How to find the coordinates of a point such that it makes a 135 degree angle with a given line? 计算轮廓上特定零件/边/线的斜率,长度和角度? - Calculate slope, length and angle of a specific part / side / line on a contour? 得到一个点的position从一个角度和线的长度 - Get a point's position from an angle and the length of the line 如何使用起点、长度和角度在 Shapely 中创建一条线 - How to create a line in Shapely using starting point, length, and an angle 根据随机位置点计算两条相连线段的角度 - Calculate the angle of two connected line segments based on a randomly position point 如果我有中点、角度和长度,则获取一条线的端点 - Getting end points of a line if I have middlepoint and angle and length python 代码使用其 3D 坐标计算三点之间的角度 - python code to calculate angle between three point using their 3D coordinates 使用 python 根据原点、终点、中心、距离和方位计算圆弧坐标 - Calculate arc coordinates based on original point, end point, center, distance and bearing using python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM