我想創建基於中心點(我已經有中心點)的時鐘手座標。這裏是我到目前爲止的代碼:創建基於偏離中心點的時鐘手座標
我有我的VB.NET形式是什麼:
http://i58.tinypic.com/3ehwl.png
Private Sub CreateClockPoints(ByVal centerPt As VISIPoint)
Dim vPtD As New VISIPoint
If rbn1.Checked Then
vPtD.Put(centerPt.X, centerPt.Y + Util.convertVal(1.5, 1, 2), centerPt.Z)
ElseIf rbn2.Checked Then
vPtD.Put(centerPt.X, centerPt.Y, centerPt.Z)
ElseIf rbn3.Checked Then
vPtD.Put(centerPt.X, centerPt.Y, centerPt.Z)
ElseIf rbn4.Checked Then
vPtD.Put(centerPt.X + Util.convertVal(1.5, 1, 2), centerPt.Y, centerPt.Z)
ElseIf rbn5.Checked Then
vPtD.Put(centerPt.X, centerPt.Y, centerPt.Z)
ElseIf rbn6.Checked Then
vPtD.Put(centerPt.X, centerPt.Y, centerPt.Z)
ElseIf rbn7.Checked Then
vPtD.Put(centerPt.X, centerPt.Y - Util.convertVal(1.5, 1, 2), centerPt.Z)
ElseIf rbn8.Checked Then
vPtD.Put(centerPt.X, centerPt.Y, centerPt.Z)
ElseIf rbn9.Checked Then
vPtD.Put(centerPt.X, centerPt.Y, centerPt.Z)
ElseIf rbn10.Checked Then
vPtD.Put(centerPt.X - Util.convertVal(1.5, 1, 2), centerPt.Y, centerPt.Z)
ElseIf rbn11.Checked Then
vPtD.Put(centerPt.X, centerPt.Y, centerPt.Z)
ElseIf rbn12.Checked Then
vPtD.Put(centerPt.X, centerPt.Y, centerPt.Z)
End If
End Sub
從中心到時鐘點的距離必須是1.5。
正如你所看到的,我已經有1,4,7和10了。我不確定2,3,5,6,8,9,11和12的配方是什麼。讓我知道你是否需要任何額外的信息,謝謝。
你對三角函數有什麼瞭解?如果你有角度,那麼計算'X = length * sin(angle)+ centerPt.X; Y =長度* cos(角度)+ centerPt.Y;'在3D中明顯更復雜一點(但想法相同):[維基救援](https://en.wikipedia.org/wiki/) Rotation_(數學)#Three_dimensions) – Carsten
@CarstenKönig非常感謝,這就是我一直在尋找的東西。不熟悉數學知道這從我的頭頂,但正確的方向我都準備好了。再次感謝你,你應該讓這個答案,所以你得到信用。 – Joe
沒問題 - 其他答案是一樣的 - 我得到了我需要的所有代表(沒有更多的里程碑獲得,而且我也永遠不會成爲J. Skeet) - 只需選擇最好的答案(接受)並接受它即可 – Carsten