在第38页中找找:
其中,GetPoint函数的输入参数是一点、另一点相对于该点在X和Y方向上的偏移量,计算另一点的坐标,其实现代码为:- Public Function GetPoint(pt As Variant, x As Double, y As Double) As Variant
- Dim ptTarget(0 To 2) As Double
- ptTarget(0) = pt(0) + x
- ptTarget(1) = pt(1) + y
- ptTarget(2) = 0
- GetPoint = ptTarget
- End Function
还有:
其中,GetPointAR函数输入参数是一点、另一点相对于该点的极坐标值,求另一点的绝对坐标,实现代码为:- Public Function GetPointAR(ByVal ptBase As Variant, ByVal angle As Double, ByVal length As Double) As Variant
- Dim pt(0 To 2) As Double
- pt(0) = ptBase(0) + length * Cos(angle)
- pt(1) = ptBase(1) + length * Sin(angle)
- pt(2) = ptBase(2)
- GetPointAR = pt
- End Function
需要注意的是,上面的angle为弧度值。 |