如果我有 2 個坐標 pointA(x,y) 和 pointB(x,y)
我需要計算特定距離和角度 90 度和 270 度的偏移坐標。我怎樣才能?
找不到合適的公式。
如何獲得C、D、E、F的坐標?

uj5u.com熱心網友回復:
差異向量
dx = B.X - A.X
dy = B.Y - A.Y
垂直向量
px = -dy
py = dx
向量長度(也許你Hypot的數學庫中有現成的函式或類似的函式)
len = sqrt(px*px py*py)
歸一化(單位長度)向量
nx = px / len
ny = py / len
現在找到距離點dist:
C.X = A.X nx * dist
C.Y = A.Y nY * dist
G.X = A.X - nx * dist
G.Y = A.Y - nY * dist
B周圍的點類似
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/451717.html
上一篇:將C 中的數字除以3long's
