我想模擬建築物上的太陽光線。對於太陽光線的角度,我有正確的仰角和方位角。我正在計算航向和俯仰的相應值。但是前進,俯仰和滾動似乎會相互影響。標題改變時,音高也會改變。我不知道如何計算我的角度對應的值。 我正在檢查netlogo庫中的「Turtle and Observer Motion」代碼示例,但這沒有幫助。在3D中定義標題間距和滾動問題-netlogo
這是我到目前爲止的代碼: 角度應改變每60個蜱(位置在列表中的變化) 列表包含轉換航向和俯仰值respectevly
globals [h ; heading
p ; pitch
r ; roll
i ; instead of tick
data_az ; a list with the azimuth angles
data_el ; a list with the elevation angles
hour ; is the position of the angles in the list, stands for the hour
i_test
i_round
]
breed [rays ray]
to setup
ca
file-open "heading.txt"
set data_az file-read
file-close
file-open "pitch.txt"
set data_el file-read
file-close
check-date
set r 0
set i 1
set hour hour - 1
set-default-shape rays "line half"
reset-ticks
end
to go
tick
if i = 1440 ; after 24x60 i stop
[
stop
]
set i_test i/60
set i_round round i_test
if i_test = i_round or i = 1
[
set hour hour + 1
set h item hour data_az
set p item hour data_el
]
if h != 0
[
create-sunshine
run-sunshine
]
set i i + 1
close
end
to create-sunshine
create-rays 5 [ setxyz random-pxcor max-pycor random-pzcor
set color yellow
set heading h
set pitch p
set roll r
set size 2
]
end
to run-sunshine
ask rays [fd 1]
ask rays [if pxcor = 0 [die]] ;rays stop at the edges
ask rays [if pxcor = 199 [die]]
ask rays [if pycor = 0 [die]]
ask rays [if pycor = 49 [die]]
ask rays [if pzcor = 0 [die]]
ask rays [if pzcor = 199 [die]]
end
to close
file-close-all
end
to check-date
if date = "march-equinox" [set hour 0]
if date = "summer-solstice" [set hour 24]
if date = "september-equinox" [set hour 48]
if date = "winter-solstice" [set hour 72]
end
期待您的建議! 由於事先 賈納
將面臨或facexyz是你的模型太粗? http://ccl.northwestern.edu/netlogo/docs/dict/face3d.html – 2014-11-05 01:11:04
因爲我想要隨機x和z座標的光線,每個光線都會有一個不同的角度朝向(facexyz-)點,對嗎?但射線應該在一個小時內具有相同的角度。但是我可以創建一個射線面向一個點並將其複製到其他射線,對不對? – Schlaeni 2014-11-05 10:38:22
我覺得很聰明。它們也可以是不存在的facexyz座標。即facexyz -1000 23456 567760000 – 2014-11-05 12:38:09