Web Programming with html5, css, and JavaScript



Download 18,68 Mb.
Pdf ko'rish
bet83/98
Sana28.10.2022
Hajmi18,68 Mb.
#857632
1   ...   79   80   81   82   83   84   85   86   ...   98
Bog'liq
Web Programming with HTML5, CSS, and JavaScript

FIGUre 12.23D
shows the 
computeAngles
function. It is similar to the 
computeAngles
function in Figure 10.22. However, this web page’s global variable
slope
, replaces the local 
panelSlope
variable in Chapter 9’s function. Because this chapter’s HTML uses a different input 
format for month, it initializes the local month variable differently than Chapter 9’s function did. 
Chapter 9’s function assumed the hour was always 12 noon, but the current web page includes an 
explicit 
hour
variable. The current web page includes a local 
hourAngle
variable that expresses 
hour
as radians relative to noon. The current web page’s formula for 
sinAltitude
includes 
an 
hourAngle
term. The current web page’s 
Math.asin
conversion of 
sinAltitude
to
altitude
includes a 0.999999 round-off-error-suppression factor to avoid a fatal error if round-
off happens to make 
sinAltitude
greater than unity.
618
Chapter 12
 
Canvas


The current web page includes an explicit 
azimuth
variable, and its 
Math.acos
conversion 
of 
cosAzimuth
to 
azimuth
also includes a 0.999999 round-off-error-suppression factor. Because 
Math.acos
cannot distinguish angles in the range 
π
radians to 2
π
radians from angles in the 
range 0 to 
π
radians, the current web page also includes the funny-looking 
conditional assignment

azimuth = (hour <= 12) ? azimuth : 2 * Math.PI - azimuth;
If the hour is less than or equal to 12, 
azimuth
equals its initial value. But if the hour is greater 
than 12, 
azimuth
equals 2
π
minus its initial value. This conditional adjustment enables 
azimuth
to vary through all 360 degrees. In morning, it’s less than 180 degrees and in afternoon it’s greater 
than 180 degrees.
The 
cosIncidenceAngle
formula in Figure 12.23D is exactly the same as that in Figure 10.22, 
except this time both 
altitude
and 
cosAzimuth
vary not only with 
month
but also with 
hour
.

Download 18,68 Mb.

Do'stlaringiz bilan baham:
1   ...   79   80   81   82   83   84   85   86   ...   98




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish