å ¥åã¯å€è§åœ¢ã®ã»ããã§ãïŒäžè§åœ¢ã®ã¿ãèæ ®ããŸãïŒïŒé ç¹ã®åº§æšïŒåº§æšç³»ã¯ã¢ã«ãŽãªãºã ã«äŸåããŸãïŒããã³ãããã®åé ç¹ã®å±æ§å€ã¯ãäžè§åœ¢ã®è¡šé¢ã«æ²¿ã£ãŠããã«è£éãããŸãã ãã®èšäºã§ã¯ãããã€ãã®èœãšãç©Žã«ã€ããŠèª¬æããŸãã
- ãã¯ã»ã«å¡ãã€ã¶ãã«ãŒã«
- 粟床
- å±æ§è£éäžã®é è¿è£æ£ïŒé è¿è£æ£å æ¿ïŒ
ã©ã¹ã¿ã©ã€ãºãžã®3ã€ã®ã¢ãããŒããæ€èšããŸãã
- é¡ã®åŸãã䜿çšãããæšæºãã¢ã«ãŽãªãºã
- å€è§åœ¢ã®é¢ã®æ¹çšåŒïŒãã©ããŒãµã«ã¢ã«ãŽãªãºã ïŒã®äœ¿çšã«åºã¥ãå€æ°ã®ã¢ã«ãŽãªãºã
- åäžãªã©ã¹ã¿ãŒåã¢ã«ãŽãªãºã
ãŸããæåŸã«ãå®è£ äŸã§ãããããžã§ã¯ããžã®ãªã³ã¯ããããããããã³ãŒãäŸããããŸãã
åºæ¬
ãããã£ãŠãã©ã¹ã¿ã©ã€ãºã¯ãç¹å®ã®ããªãŽã³ã«ãå«ãŸããããã¯ã»ã«ãèŠã€ããããã»ã¹ã§ãã ãŸããããªãŽã³ãåè²ã§å¡ãã€ã¶ãã ãã§ååã ãšä»®å®ããŸãã
ç»é¢ã«è¡šç€ºããããã®æ¬¡ã®äžè§åœ¢ããããšæ³åããŠãã ããïŒãã¹ãŠã®åº§æšã¯æ¢ã«ç»é¢ã¹ããŒã¹ã«è¡šç€ºãããŠããŸãïŒã
ã©ã®ãã¯ã»ã«ãå¡ãã€ã¶ãå¿ èŠããããŸããïŒ ãã¯ã»ã«ã¯ãå®å šã«ããªãŽã³ã®å€åŽãéšåçã«ããªãŽã³å ãå®å šã«ããªãŽã³å ã«ãããŸãã
次ã®2ã€ã®å Žåããã¹ãŠãç°¡åã§ãã
- ãã¯ã»ã«ã¯ããªãŽã³å šäœã«å«ãŸããŠããŸããïŒåçã®èµ€ãè²ïŒ-å¡ãã€ã¶ããªãã§ãã ãã
- ãã¯ã»ã«ã¯ããªãŽã³å šäœã«å«ãŸããŠããŸãïŒå³ã®ç·è²ïŒ-å¡ãã€ã¶ããŸã
3çªç®ã®ã±ãŒã¹ïŒãã¯ã»ã«ã¯éšåçã«ããªãŽã³ã®å åŽã«ãããŸãïŒã¯ããè€éã§ãã é ã«æµ®ãã¶æåã®æ±ºå®ã¯ããã®ãããªãã¯ã»ã«ããã¹ãŠããªãŽã³ã«å«ãŸãããã©ãããæ³å®ããããšã§ãã ããããããã¯ééã£ãçµæã«ã€ãªãããŸãã æç»ãã3次å ã¢ãã«ã¯å€ãã®äžè§åœ¢ã§æ§æãããŠãããéåžžã¯äºãã«éãªããªãããã«ããŸãã äºãã«éãªãåãäžè§åœ¢ã¯ãæ¢åã®æ å ±ãè€è£œããã ããªã®ã§ãæå³ããããŸããã ãããã£ãŠãå€ãã®ããªãŽã³ã«ã¯å ±éã®é¢ããããŸãã æãç°¡åãªäŸã¯é·æ¹åœ¢ã§ãïŒ
äž¡æ¹ã®ããªãŽã³ã«éšåçã«åãŸããã¯ã»ã«ã¯ããªã¬ã³ãžè²ã§ããŒã¯ãããŠããŸãã ãããäž¡æ¹ã®ããªãŽã³ãã©ã¹ã¿ã©ã€ãºãããšããŸãã ããªãŽã³ã«éšåçã«å«ãŸãããã¹ãŠã®ãã¯ã»ã«ãå¡ãã€ã¶ãå¿ èŠããããšå€æããå Žåãåããã¯ã»ã«ã2åååŸããŸãïŒ3ã€ä»¥äžã®ããªãŽã³ã«å ±éã®é ç¹ãããå Žåã¯ããã«å€ããªããŸãïŒã ããã¯äžèŠåé¡ã«æããªããããããŸããããå®éã«ã¯ãã¢ã«ãã¡ãã¬ã³ãã£ã³ã°ïŒéæ床ãã·ãã¥ã¬ãŒãããããã«ã¢ã«ãã¡ãã£ãã«ã䜿çšããŠã¬ã³ããªã³ã°ïŒãªã©ã®ããã€ãã®ææ³ã䜿çšãããšãããŸããŸãªã¢ãŒãã£ãã¡ã¯ããçºçããŸãã ããã¯çç£æ§ã®äœäžã«ãã€ãªãããŸãããªããªãã å±æ§å€ãèšç®ããå¿ èŠããããã¯ã»ã«ã®æ°ã¯å¢å ããŠããŸãã å察ã«ããã®ãããªãã¯ã»ã«ãæçµç»åã«å«ãŸããŠããããå¡ãã€ã¶ããŠã¯ãªããªããšå€æããå ŽåãããªãŽã³éã«ãç©Žããã§ããŸãããããã¯åãå ¥ããããŸããã
ãããã£ãŠãé£æ¥ããããªãŽã³ãæç»ãããšããåãã¯ã»ã«ã1åã ãå¡ãã€ã¶ãå¿ èŠããããšããããšãããããŸããã ããã¯ãDirect3DãšOpenGLã®äž¡æ¹ãæºæ ããèŠä»¶ã§ãã
åé¡ã¯ãé£ç¶ïŒç»é¢ã®åº§æšç³»ïŒããé¢æ£ïŒã¢ãã¿ãŒäžã®ãã¯ã»ã«ïŒã«è¡šç€ºããå¿ èŠãããããã«çºçããŸãã åŸæ¥ã®ã©ã¹ã¿ã©ã€ãºã¢ã«ãŽãªãºã ïŒã¹ã ãŒãžã³ã°ãªãã§ã¬ã³ããªã³ã°ããå ŽåïŒã¯ãããã次ã®ããã«è§£æ±ºããŸããåãã¯ã»ã«ã¯ãããªãŽã³ã«å ¥ããã¯ã»ã«ã®åå ãšãªãç¹å®ã®ãã€ã³ãïŒãµã³ãã«ãã€ã³ãïŒã«é¢é£ä»ããããŸãã ãŸãããã®æç¹ã§ãå¿ èŠãªãã¹ãŠã®å±æ§ã®å€ãèæ ®ãããŸãã èšãæããã°ãç»é¢ã®åº§æšç³»ã§ãã¯ã»ã«ãå ãããã¹ãŠã®ç©ºéã¯ã1ã€ã®ç¹ã§ãè¡šãããŸããã ååãšããŠãããã¯äžå¿ã§ãïŒïŒ0.5ã0.5ïŒïŒ
çè«çã«ã¯ããã¯ã»ã«ã®äžå¿ã§ã¯ãªãããã¯ã»ã«å ã®ä»»æã®ãã€ã³ããåãããšãã§ããŸãã ä»ã®å€ã¯ãç»åãäžæ¹åã«1ãã¯ã»ã«ãã€ãã·ãããã§ãããšããäºå®ã«ã€ãªãããŸãã ãŸããé£æ¥ããããªãŽã³ãããç¶æ³ã§ã¯ãäžè§åœ¢ã®é ç¹ãé 眮ãããŠããªããã¯ã»ã«ã®å Žåããã€ã³ãïŒ0.5ã0.5ïŒã®äœ¿çšã«ã¯è¯ãç¹æ§ããããŸãïŒãã®ãã€ã³ãã¯ããã¯ã»ã«ãè¡šãé·æ¹åœ¢ã®é¢ç©ã®50ïŒ ä»¥äžãã«ããŒããããªãŽã³ã«å«ãŸããŸãã
ãããã£ãŠããã¯ã»ã«ã®äžå¿ãããªãŽã³ã«å ¥ãå Žåããã¯ã»ã«ã¯ããªãŽã³ã«å±ãããšèŠãªãããŸãã ãããã次ã®åé¡ãçºçããŸãã2ã€ã®ããªãŽã³ã«ãã¯ã»ã«ã®äžå¿ãéãå ±éã®é¢ãããå Žåã¯ã©ãã§ããããã ãã¯ã»ã«ã¯2ã€ã®äžè§åœ¢ã®ãã¡ã®1ã€ã ãã«å±ããŠããå¿ èŠãããããšã«ãã§ã«æ°ä»ããŸããããã©ã¡ããäžè§åœ¢ã§ããïŒ ä»¥äžã®å³ã§ã¯ããã®ãããªãã¯ã»ã«ã¯èµ€ã§ããŒã¯ãããŠããŸãã
ãã®åé¡ã¯ããããããå å¡«èŠåãã«ãã£ãŠè§£æ±ºãããŸãã
å å¡«å¥çŽ
ãããã£ãŠãäžèšã®ç¶æ³ã«çŽé¢ããŠãããšä»®å®ããŸãã2ã€ã®ããªãŽã³ã¯ããã¯ã»ã«ã®äžå¿ãæ£ç¢ºã«ééããé¢ãå ±æããŸãã ç§ãã¡ã®ã¿ã¹ã¯ã¯ããã®ãã¯ã»ã«ãã©ã®ããªãŽã³ã«å±ããŠãããã調ã¹ãããšã§ãã
äºå®äžã®æšæºã¯ãããããå·Šäžã«ãŒã«ã§ããDirectXããã³ã»ãšãã©ã®OpenGLå®è£ ã«åŸããŸãã ãã®ã«ãŒã«ã®æ¬è³ªã¯æ¬¡ã®ãšããã§ããããªãŽã³ã®é¢ããã¯ã»ã«ã®äžå¿ãééããå Žåããã®ãã¯ã»ã«ã¯2ã€ã®å Žåã«ããªãŽã³ã«å±ããŸã-å·ŠåŽãŸãã¯äžé¢ã®å ŽåïŒååã®ç±æ¥ïŒã
å·Šãå³ãäžé¢ãããã³äžé¢ã®æŠå¿µãæ確ã«ããå¿ èŠããããŸãã ãããŸã§ã®ãšãããæ£ç¢ºãªå®çŸ©ã¯è¡ããŸããïŒãã©ããŒãµã«ã¢ã«ãŽãªãºã ã«å°éããããããè¡ããŸãïŒããããåçŽãªèšèªã§ãããã説æããŸãã
- äžé¢ã¯ãä»ã®ãã¹ãŠã®é¢ã®äžã«ããæ°Žå¹³é¢ã§ã
- äž-ä»ã®ãã¹ãŠã®é¢ã®äžã«ããæ°Žå¹³é¢
- å·ŠåŽ-äžè§åœ¢ã®å·ŠåŽã«ãããæ°Žå¹³ã§ã¯ãªãé¢
- å³åŽã¯ãäžè§åœ¢ã®å³åŽã«ãããæ°Žå¹³ã§ã¯ãªãé¢ã§ã
äŸïŒ
次ã«ãé£æ¥ããããªãŽã³ã®å ŽåãèããŸãã é¢ãé£æ¥ãã1ã€ã®ããªãŽã³ã«æ®ã£ãŠããå Žåããã®é¢ããã®ããªãŽã³ãšå ±æãããã¹ãŠã®ããªãŽã³ã«å¯ŸããŠåãé¢ãæ£ããã§ãã åæ§ã®èŠåã¯ãäžé¢ãšäžé¢ã«å¯ŸããŠæ©èœããŸãã
ãã®ããããã£ã䜿çšããŠããã¯ã»ã«ãé£æ¥ããããªãŽã³ã®ã©ãã«å±ããããå€æã§ããŸãã äžå¿ãå ±éã®é¢ã«ãããã¯ã»ã«ãããã®é¢ãæ®ã£ãŠããããªãŽã³ã®ã¿ã«å±ããããšã«åæããå Žåããã®é¢ã¯æ£ãããããé£æ¥ããããªãŽã³ã«ã¯èªåçã«å±ããŸããã äžéã«ã€ããŠãåãã§ãã
äžé¢ãšå·ŠåŽã®é¢ã®èŠåãæãé »ç¹ã«èŠã€ãããšããäºå®ã«ãããããããé©åãªçµã¿åããã䜿çšã§ããŸãã ããšãã°ãäžåŽãšå·ŠåŽãäžåŽãšå³åŽãªã©ã®ã«ãŒã«ã Direct3Dã§ã¯å·Šäžã®ã«ãŒã«ã䜿çšããå¿ èŠããããŸãããOpenGLã¯ããã»ã©å³å¯ã§ã¯ãªãããã¯ã»ã«æææš©ã®åé¡ã解決ããã«ãŒã«ã䜿çšã§ããŸãã åŒãç¶ãå·Šäžã®ã«ãŒã«ã䜿çšããããšãæ³å®ããŸãã
粟床
次ã®2ã€ã®ããªãŽã³ãæ€ââèšããŠãã ããã
ç¹å®ã®è§åºŠã§ã®å転ã®çµæãšããŠãæåã®ããªãŽã³ãã2çªç®ã®ããªãŽã³ãååŸã§ããŸãã çµæãšããŠãããã€ãã®ãã¯ã»ã«ãæçµç»åã«è¿œå ã§å«ãŸãïŒãã®ãããªãã¯ã»ã«ã¯ç·è²ã§ããŒã¯ãããŸãïŒãå察ã«ãããã€ãã¯ãã¯ã»ã«ããæ¶ããŸãïŒèµ€è²ã§ããŒã¯ãããŸãïŒã ãããã£ãŠãé ç¹åº§æšã®å°æ°éšåãèæ ®ããå¿ èŠããããŸãã ããããç Žæ£ãããšãéçã§ãªãã·ãŒã³ãæç»ãããšãã«åé¡ãçºçããŸãã ããšãã°ãããªãŽã³ãéåžžã«ãã£ãããšå転ããããšãäžéçµæãæ£ããåŠçãã代ããã«ããšããžãããäœçœ®ããå¥ã®äœçœ®ã«æ¥æ¿ã«ããžã£ã³ãããããããåãããããããããŸãã ãããã®2ã€ã®åç»ãæ¯èŒãããšãéããç°¡åã«ç解ã§ããŸãã
ãã¡ãããéçãªã·ãŒã³ã®å Žåããã®ãããªåé¡ã¯çºçããŸããã
å±æ§è£é
ã©ã¹ã¿ã©ã€ãºã¢ã«ãŽãªãºã ã«çŽæ¥é²ãåã«ãå±æ§ã®è£éã«ã€ããŠè©³ããèŠãŠã¿ãŸãããã
å±æ§ã¯ããªããžã§ã¯ãã«é¢é£ä»ããããæ å ±ã§ããããã¯ãç¹å®ã®ã¢ã«ãŽãªãºã ã«åŸã£ãŠæ£ããã¬ã³ããªã³ã°ãè¡ãããã«å¿ èŠã§ãã äœã§ããã®ãããªå±æ§ã«ãªãåŸãŸãã æãäžè¬çãªãªãã·ã§ã³ã®1ã€ã¯ãè²ããã¯ã¹ãã£åº§æšãæ³ç·åº§æšã§ãã å±æ§å€ã¯ããªããžã§ã¯ãã°ãªããã®é ç¹ã§èšå®ãããŸãã ããªãŽã³ãã©ã¹ã¿ã©ã€ãºããå Žåããããã®å±æ§ã¯äžè§åœ¢ã®è¡šé¢ã«æ²¿ã£ãŠè£éãããåãã¯ã»ã«ã®è²ãèšç®ããããã«äœ¿çšãããŸãã
æãåçŽãªäŸïŒããã³ãhello worldãã®ç¬ç¹ãªé¡äŒŒç©ïŒã¯ãäžè§åœ¢ã®æç»ã§ãããåé ç¹ã«1ã€ã®å±æ§ãäžããããŠããŸã-è²ïŒ
ãã®å Žåã3ã€ã®é ç¹ã®è²ã®ç·åœ¢è£éã®çµæã§ããããªãŽã³ã®åãã¯ã»ã«ã«è²ãå²ãåœãŠããšã次ã®ç»åãåŸãããŸãã
è£éãè¡ãããæ¹æ³ã¯ãã¬ã³ããªã³ã°ããã»ã¹ã§æäœããããŒã¿ã«äŸåãããããã¯ãã©ã¹ã¿ã©ã€ãºã§äœ¿çšãããã¢ã«ãŽãªãºã ã«äŸåããŸãã ããšãã°ããæšæºãã¢ã«ãŽãªãºã ã䜿çšããå Žåã2ã€ã®ãã¯ã»ã«éã®å€ã®åçŽãªç·åœ¢è£éã䜿çšã§ããŸãããŸãããã©ããŒãµã«ã¢ã«ãŽãªãºã -éå¿åº§æšã䜿çšããå Žåã䜿çšã§ããŸãã ãããã£ãŠãã¢ã«ãŽãªãºã èªäœã®èª¬æãŸã§å»¶æããŸãã
ãã ããåãã£ãŠå¯ŸåŠããå¿ èŠãããéèŠãªãããã¯ããŸã ãããŸããé è¿è£æ£ã«ããå±æ§è£éã§ãã
æãåçŽãªè£éæ¹æ³ã¯ãç»é¢ç©ºéã§ã®ç·åœ¢è£éã§ããããªãŽã³ãæ圱é¢ã«æ圱ãããåŸãäžè§åœ¢ã®è¡šé¢ã«æ²¿ã£ãŠå±æ§ãç·åœ¢è£éããŸãã ãã®è£éã¯å®è¡ãããæ圱ãèæ ®ããªãããããã®è£éã¯æ£ãããªãããšãç解ããããšãéèŠã§ãã
æ圱é¢d = 1ã«ç·ãæ圱ããããšãæ€èšããŠãã ããã éå§ããŒã¯ãšçµäºããŒã¯ã§ãã«ã¡ã©ç©ºéïŒããã³äžçïŒã§ç·åœ¢ã«å€åããç¹å®ã®å±æ§ãèšå®ãããŸãã æ圱ãè¡ãããåŸããããã®å±æ§ã¯ç»é¢ç©ºéã§çŽç·çã«æé·ããŸããã ããšãã°ãã«ã¡ã©ç©ºéã®äžéç¹ïŒ v = v0 * 0.5 + v1 * 0.5 ïŒãååŸããå Žåãæ圱åŸããã®ç¹ã¯æ圱ãããç·ã®äžå€®ã«ãããŸããã
ããã¯ããªããžã§ã¯ãããã¯ã¹ãã£ãªã³ã°ãããšãã«æãç°¡åã«æ°ä»ããŸãïŒä»¥äžã®äŸã§ã¯ããã£ã«ã¿ãªã³ã°ããã«åçŽãªãã¯ã¹ãã£ãªã³ã°ã䜿çšããŸãïŒã ãã¯ã¹ãã£ãªã³ã°ããã»ã¹ã«ã€ããŠã¯è©³ãã説æããŠããŸããïŒããã¯å¥ã®èšäºã®ãããã¯ã§ãïŒã®ã§ãããã§ã¯ç°¡åãªèª¬æã«éå®ããŸãã
ãã¯ã¹ãã£ãªã³ã°ã®éãããªãŽã³ã®åé ç¹ã§ããã¯ã¹ãã£åº§æšã®å±æ§ã®å€ãèšå®ãããŸãïŒå€ãã®å Žåã察å¿ãã軞ã®ååã§uvãšåŒã°ããŸãïŒã ãããã¯ããã¯ã¹ãã£ã®ã©ã®éšåã䜿çšãããã決å®ããæ£èŠåããã座æšïŒ 0ã1 ïŒã§ãã
ããã§ããã¯ã¹ãã£åãããé·æ¹åœ¢ãæç»ãããã¯ã¹ãã£å šäœã䜿çšãããããã«uvå±æ§ã®4ã€ã®å€ãèšå®ããããšãæ³åããŠãã ããã
ãã¹ãŠãããŸãããããã§ãïŒ
確ãã«ããã®ã¢ãã«ã¯æ圱é¢ã«å¹³è¡ã«é 眮ãããŠãããããé è¿æ³ã«ããæªã¿ã¯ãããŸããã äžã®2ã€ã®é ç¹ãz軞ã«æ²¿ã£ãŠ1ã€ãã€ã·ããããããšãããšãåé¡ãããã«æããã«ãªããŸãã
ãããã£ãŠãå±æ§ãè£éãããšãã¯ããŒã¹ãã¯ãã£ããèæ ®ããå¿ èŠããããŸãã ããã®éèŠãªäºå®ã¯ã zãç»é¢ç©ºéã§æ£ããè£éããããšã¯ã§ããŸãããã 1 / zã¯ã§ããããšã§ãã ç¹°ãè¿ããŸãããç·ã®æ圱ãæ€èšããŠãã ããã
ãŸããåæ§ã®äžè§åœ¢ã«ãã£ãŠããããã§ã«ç¥ã£ãŠããŸãã
ã¹ã¯ãªãŒã³ç©ºéã§xãè£éãããšã次ã®ããã«ãªããŸãïŒ
ã«ã¡ã©ç©ºéã§xãè£éãããšã次ã®ããã«ãªããŸãã
ãããã®3ã€ã®çåŒãéèŠã§ããããããã«åºã¥ããŠãã¹ãŠã®åŸç¶ã®åŒãå°åºãããŸãã ç§ã¯ãããèªåã§ç°¡åã«è¡ãããšãã§ãããããå®å šãªçµè«ãåºãããšã¯ãããçµæã«çŠç¹ãåœãŠãŠç°¡åã«èª¬æããŸãã
ãããã®2ã€ã®çåŒãäžè§åœ¢ã®ã¢ã¹ãã¯ãæ¯ããååŸããæ¹çšåŒã«ä»£å ¥ãããã¹ãŠã®åŒãåçŽåãããšãæçµçã«z座æšã®éæ°ãç»é¢ç©ºéã§ç·åœ¢è£éã§ããããšãããããŸãã
ãã®åŒã§ã¯ããã£ã³ããŒç©ºéã®z座æšã®éæ°ã®éã§è£éãè¡ãããããšãéèŠã§ãã
ããã«ãç¹å®ã®å±æ§ã®å€ãé ç¹Aããã³Bã«èšå®ãããŠãããšä»®å®ããããããT1ããã³T2ã§ç€ºããŸãããããã¯ã«ã¡ã©ç©ºéã§ãç·åœ¢è£éã§ããŸãã
äžèšã®åºåã®äžéçµæã䜿çšããŠã Tc / Zcã®å€ãã¹ã¯ãªãŒã³ç©ºéã§æ£ããè£éã§ããããšãèšè¿°ã§ããŸãã
ãŸãšãããšã 1 / Zcããã³Tc / Zcã¯ã¹ã¯ãªãŒã³ç©ºéã§ç·åœ¢è£éã§ããããšãããããŸããã ããã§ã Tcã®å€ãç°¡åã«ååŸã§ããŸãã
å®éãååãã«æ£ç¢ºãªè£éã®ã³ã¹ãã¯äž»ã«ãã®åºåã«ãããŸãã ããŸãå¿ èŠã§ãªãå Žåã¯ã䜿çšããå±æ§ã®æ°ãæå°éã«æããå¯èœã§ããã°ç»é¢ç©ºéã§ã®åçŽãªç·åœ¢è£éãè¡ããªãæ¹ãè¯ãã§ãããã æ£ãããã¯ã¹ãã£ãªã³ã°çµæã以äžã«ç€ºããŸãïŒ
é è¿è£æ£ãå®è£ ããã«ã¯ãã«ã¡ã©ç©ºéã®é ç¹ã®æ·±ãïŒ z座æšïŒã«éã®å€ãå¿ èŠã§ãã å°åœ±è¡åãæãããšäœãèµ·ãããæãåºããŠãã ããïŒ
ã«ã¡ã©ç©ºéããã®é ç¹ã¯ã¯ãªããã³ã°ç©ºéã«å ¥ããŸãã ç¹ã«ã z座æšã¯ç¹å®ã®å€æŽïŒå°æ¥çã«æ·±åºŠãããã¡ã«å¿ èŠãšãªãïŒãåããã«ã¡ã©ç©ºéã®é ç¹ã®z座æšãšäžèŽããªãããã䜿çšã§ããŸããã ãããŠãäžèŽããã®ã¯w-座æšã§ããããã¯ãã«ã¡ã©ç©ºéããæ瀺çã«zãé 眮ããããã§ãïŒãããªãã¯ã¹ã®4åç®ãèŠãŠãã ããïŒã å®éã zèªäœã§ãªã1 / zãå¿ èŠã§ãã NDCã«åãæ¿ãããšããã¹ãŠã®é ç¹ãz ïŒw座æšã«ããïŒã§é€ç®ããããããå®éã«ã¯ãç¡æãã§ååŸã§ããŸãã
float const w_inversed{ 1.0f / vw }; vx *= w_inversed; vy *= w_inversed; vz *= w_inversed; // NDC to screen // ...
ãããã£ãŠããããåçŽã«å察ã®å€ã«çœ®ãæããããšãã§ããŸãã
float const w_inversed{ 1.0f / vw }; vx *= w_inversed; vy *= w_inversed; vz *= w_inversed; vw = w_inversed; // NDC to screen // ...
ã©ã¹ã¿ã©ã€ãºã¢ã«ãŽãªãºã
以äžã§ã¯ãããªãŽã³ãã©ã¹ã¿ã©ã€ãºãã3ã€ã®ã¢ãããŒãã«ã€ããŠèª¬æããŸãã ã³ãŒãäŸã®å€ãã¯å®è£ ã«äŸåããŠãããããå®å šãªã³ãŒãäŸã¯ãããŸãããããã¯ãæ¯æŽãããããæ··ä¹±ãæãã§ãããã èšäºã®æåŸã«ãããžã§ã¯ããžã®ãªã³ã¯ããããå¿ èŠã«å¿ããŠãããžã§ã¯ãã®å®è£ ã³ãŒããèŠãããšãã§ããŸãã
ãæšæºãã¢ã«ãŽãªãºã
ãã®ã¢ã«ãŽãªãºã ã¯ããœãããŠã§ã¢ã¬ã³ãã©ãŒã§æãäžè¬çã«èª¬æãããŠããã©ã¹ã¿ã©ã€ãºã¢ã«ãŽãªãºã ã§ããããããã®ã¢ã«ãŽãªãºã ããæšæºããšåŒãã§ããŸãã ãã©ããŒãµã«ã¢ã«ãŽãªãºã ãåäžãªåº§æšã§ã®ã©ã¹ã¿ã©ã€ãºãããç解ããããããããã£ãŠãå®è£ ã容æã§ãã
ããã§ã¯ãã©ã¹ã¿ã©ã€ãºãããäžè§åœ¢ããå§ããŸãããã ãŸãããããæ°Žå¹³ãªåºé¢ãæã€äžè§åœ¢ã§ãããšããŸãã
ãã®ã¢ã«ãŽãªãºã ã®æ¬è³ªã¯ãåŽé¢ã«æ²¿ã£ãŠé 次移åããåŽé¢éã®ãã¯ã»ã«ãåããããšã§ãã ãã®ããã X軞ã«æ²¿ã£ãå€äœå€ã¯ãY軞ã«æ²¿ã£ãåäœããšã®å€äœããšã«æåã«èšç®ãããŸãã
次ã«ãåŽé¢ã«æ²¿ã£ãåããå§ãŸããŸãã ãã¯ã»ã«vã¯ãããã®ç¹ã§è¡šãããããã移åã¯é ç¹v0ã® Y座æšããã§ã¯ãªããæãè¿ãäžå¿ããéå§ããããšãéèŠã§ãã Y座æšv0ãæ¢ã«äžå¿ã«ããå Žåã v0ã¯å·Šãšå³ã®äž¡æ¹ã®é¢ã«ããããããã®è»žã®æ¬¡ã®äžå¿ã«ç§»åããŸããã€ãŸãããã®ãã¯ã»ã«ã¯ç»åã«å«ãŸããŸããã
次ã®è¡ã«ç§»åãããšãX軞ã«æ²¿ã£ãŠæ¬¡ã®äžå¿ããã®ã¿ç§»åãéå§ããŸããé¡ããã¯ã»ã«ã®äžå¿ãééããå Žåãå³åŽã§ã¯ãªãå·ŠåŽã®ç»åã«ãã¯ã»ã«ãå«ããŸãã
åæ§ã«ãã¢ã«ãŽãªãºã ã¯ãäžéšãæ°Žå¹³ã®äžè§åœ¢ã«å¯ŸããŠãæ©èœããŸãã 氎平蟺ãæããªãäžè§åœ¢ã¯ãåçŽã«2ã€ã®äžè§åœ¢ã«åå²ãããŸãã1ã€ã¯æ°Žå¹³ã®äžéšããã1ã€ã¯æ°Žå¹³ã®äžéšã§ãã ãããè¡ãããã«ãäžè§åœ¢ã®é ç¹ã®1ã€ïŒ Y座æšã®å¹³åïŒãéãæ°Žå¹³ç·ãšä»ã®é¢ã®äº€ç¹ãæ¢ããŸãã
ãã®åŸããããã®äžè§åœ¢ã¯ããããäžèšã®ã¢ã«ãŽãªãºã ã«åŸã£ãŠã©ã¹ã¿ã©ã€ãºãããŸãã ãŸããæ°ããé ç¹ã§z座æšãšw座æšã®å€ãæ£ããèšç®ããå¿ èŠããããŸã-ããšãã°ãããããè£éããŸãã åæ§ã«ãå±æ§ãè£éãããšãã«ãã®é ç¹ã®ååšãèæ ®ããå¿ èŠããããŸãã
å±æ§ã¯ã次ã®ããã«é è¿è£æ£ãªãã§è£éãããŸã-åŽé¢ã«æ²¿ã£ãŠç§»åãããšããã©ã¹ã¿ã©ã€ãºããã©ã€ã³ã®éå§ç¹ãšçµäºç¹ã§è£éãããå±æ§å€ãèšç®ããŸãã 次ã«ããããã®å€ã¯ãã®ç·ã«æ²¿ã£ãŠç·åœ¢è£éãããŸãã å±æ§ã«é è¿æã®è£æ£ãå¿ èŠãªå Žåã¯ã代ããã«ããªãŽã³ã®é¢ã«æ²¿ã£ãŠT / zãè£éããŸãïŒåã«T-å±æ§å€ã®ã¿ãè£éããã®ã§ã¯ãªãïŒ 1 / z ã 次ã«ãç·ã®å§ç¹ãšçµç¹ã®ãããã®å€ã¯ããã«æ²¿ã£ãŠè£éãããäžèšã®åŒã«åŸã£ãŠèŠç¹ãèæ ®ããŠæçµçãªå±æ§å€ãååŸããããã«äœ¿çšãããŸãã ç§ãèšåãã1 / zã¯ãå®éã«ãã¹ãŠã®å€æãè¡ãããåŸã®ãã¯ãã«ã®w座æšã«ããããšã«æ³šæããŠãã ããã
ãã©ããŒãµã«ã¢ã«ãŽãªãºã
ããã¯ãå€è§åœ¢ã®é¢ã®æ¹çšåŒã«åºã¥ããŠåãã¢ãããŒãã䜿çšããã¢ã«ãŽãªãºã ã®ã°ã«ãŒãå šäœã§ãã
é¢ã®æ¹çšåŒã¯ããã®é¢ãååšããç·ã®æ¹çšåŒã§ãã ã€ãŸããããã¯ããªãŽã³ã®2ã€ã®é ç¹ãéãçŽç·ã®æ¹çšåŒã§ãã ãããã£ãŠãåäžè§åœ¢ã¯æ¬¡ã®3ã€ã®ç·åœ¢æ¹çšåŒã§ç¹åŸŽä»ããããŸãã
ãŸãã2ã€ã®ãã€ã³ããéãçŽç·ã®æ¹çšåŒã«ã€ããŠèª¬æããŸãïŒãããã¯äžè§åœ¢ã®é ç¹ã®ãã¢ã§ãïŒã
次ã®ããã«æžãæããããšãã§ããŸãã
æåŸã®åŒããããã¯ãã«nã¯ãã¯ãã«v0-v1ã«åçŽã§ããããšãããããŸãïŒåº§æšã¯äº€æãããX座æšã¯ãã€ãã¹èšå·ã§ååŸãããŸãïŒã ãããã£ãŠãnã¯2ã€ã®é ç¹ã«ãã£ãŠåœ¢æãããç·ã®æ³ç·ã§ãã ããã¯ãã¹ãŠç·ã®çåŒã§ããããããã£ãŠããã€ã³ãïŒxãyïŒãããã«ä»£å ¥ããŠãŒãã«ãããšããã®ãã€ã³ããç·äžã«ããããšãããããŸãã æ®ãã®å€ã¯ã©ãã§ããïŒ ããã§ã¯ãæ³ç·ã®ããé²é³ãã©ãŒã ã圹ç«ã¡ãŸãã 2ã€ã®ãã¯ãã«ã®ã¹ã«ã©ãŒç©ãã2çªç®ã®ãã¯ãã«ã®é·ãã§ä¹ç®ããã2çªç®ã®ãã¯ãã«ãžã®æåã®ãã¯ãã«ã®æ圱ã®é·ããèšç®ããããšãç¥ã£ãŠããŸãã æ³ç·ã¯æåã®ãã¯ãã«ãšããŠæ©èœããæåã®é ç¹ãããã€ã³ãïŒxãyïŒãŸã§ã®2çªç®ã®ãã¯ãã«ãšããŠæ©èœããŸãã
ãŸãã次ã®3ã€ã®ãªãã·ã§ã³ããããŸãã
- å€ã¯0-ãã€ã³ãã¯çŽç·äžã«ãããŸãã
- 0ãã倧ããå€-ãã€ã³ãã¯æ£ã®åå¹³é¢ã«ãããŸã
- 0ããå°ããå€-ãã€ã³ãã¯è² ã®åå¹³é¢ã«ãããŸã
ãããã¯ãã¹ãŠä»¥äžã«ç€ºãããŠããŸãã
æ³ç·ãå察æ¹åãæãããã«ç·ã®æ¹çšåŒãèšå®ããããšãã§ããŸã-ãã€ãã¹1ãæããã ãã§ãã å°æ¥ãæ¹çšåŒã¯äžè§åœ¢ã®å åŽã®æ³ç·ãæãããã«èšèšããããšä»®å®ããŸãã
ãããã®æ¹çšåŒã䜿çšããŠã3ã€ã®æ£ã®åå¹³é¢ã®äº€ç¹ãšããŠäžè§åœ¢ãå®çŸ©ã§ããŸãã
ãããã£ãŠããã©ããŒãµã«ã¢ã«ãŽãªãºã ã®äžè¬çãªéšåã¯æ¬¡ã®ãšããã§ãã
- ãã€ã³ãã®é¢ã®æ¹çšåŒã®å€ãèšç®ããŸã
- ãã¹ãŠã®å€ãæ£ã®å Žåããã¯ã»ã«ã¯å¡ãã€ã¶ãããŸãã ãããã®ããããããŒãã®å Žåããã¯ã»ã«ã¯é¢ã®1ã€ã«ãããå·Šäžã«ãŒã«ã䜿çšããŠãã¯ã»ã«ãããªãŽã³ã«å±ãããã©ããã決å®ããŸã
- 次ã®ãã¯ã»ã«ã«ç§»å
å·Šäžã®ã«ãŒã«ã®å®è£ ã«ã€ããŠè©³ããèŠãŠã¿ãŸãããã é¢ã®æ³ç·ãæäœããŠããã®ã§ãå·Šé¢ãšäžé¢ã®ããå³å¯ãªå®çŸ©ãè¡ãããšãã§ããŸãã
- å·ŠåŽã¯ãæ³ç·ãæ£ã®x座æšãæã€ïŒã€ãŸããå³ãæãïŒé¢ã§ãã
- äžé¢ã¯ãY軞ãäžåãã®å Žåãæ³ç·ãè² ã®y座æšãæã€é¢ã§ãã Y軞ãäžãåããŠããå ŽåïŒãã®ãªãã·ã§ã³ã«åºå·ããŸãïŒãäžé¢ã®y座æšã¯æ£ã§ã
ãŸããæ³ç·åº§æšãç·ã®æ£æºæ¹çšåŒã®ä¿æ°aããã³bãšäžèŽããããšã«æ³šæããããšãéèŠã§ãïŒ ax + by + c = 0 ã
以äžã¯ããã¯ã»ã«ãé¢ã®1ã€ã«å¯ŸããŠæ£ã®åå¹³é¢ã«ãããã©ããã決å®ããé¢æ°ã®äŸã§ãïŒå·Šäžã®èŠåã䜿çšïŒã å ¥åã«å¯ŸããŠ3ã€ã®åŒæ°ããšãã ãã§ååã§ãããã€ã³ãã§ã®é¡ã®æ¹çšåŒã®å€ãšæ³ç·ã®åº§æšã§ãã
ã³ãŒãäŸ
inline bool pipeline::is_point_on_positive_halfplane_top_left( float const edge_equation_value, float const edge_equation_a, float const edge_equation_b) const { // , top-left rule // if (std::abs(edge_equation_value) < EPSILON) { if (std::abs(edge_equation_a) < EPSILON) { // edge.a == 0.0f, , , // // y- , // return edge_equation_b > 0.0f; } else { // x- , // return edge_equation_a > 0.0f; } } else { // , return edge_equation_value > 0.0f; } }
æ¹çšåŒã®å€ãèšç®ãããšãã®åçŽã§äŸ¿å©ãªæé©åïŒåº§æšïŒxãyïŒãæã€ãã¯ã»ã«ã®å€ãããã£ãŠããå Žåããã€ã³ãïŒx + 1ãyïŒã§å€ãèšç®ããã«ã¯ãä¿æ°aã®å€ãè¿œå ããã ãã§ååã§ãã åæ§ã«ã ïŒxãy + 1ïŒã®å€ãèšç®ããã«ã¯ãä¿æ°bãè¿œå ããã ãã§ååã§ãã
次ã®ã¹ãããã¯ãå±æ§è£éãšé è¿è£æ£ã§ãã ãã®ããã«ãéå¿åº§æšã䜿çšãããŸãã ãããã¯ãäžè§åœ¢ã®ç¹ãé ç¹ã®ç·åœ¢çµåãšããŠèšè¿°ããã座æšã§ãïŒæ£åŒã«ã¯ããã®ç¹ãäžè§åœ¢ã®è³ªéã®äžå¿ã§ããã察å¿ããé ç¹ã®éã¿ãããããšãæå³ããŸãïŒã æ£èŠåãããããŒãžã§ã³ã䜿çšããŸã-ã€ãŸã 3ã€ã®é ç¹ã®åèšéã¿ã¯1ã«çãããªããŸãã
ãã®åº§æšç³»ã«ã¯ãèšç®ãå¯èœã«ããéåžžã«äŸ¿å©ãªããããã£ããããŸãïŒéå¿åº§æšã¯ãäžã®å³ã§åœ¢æãããäžè§åœ¢ã®é¢ç©ãšäžè§åœ¢ã®ç·é¢ç©ã®æ¯ã«çããïŒãã®ãããé¢ç©åº§æšãšãåŒã°ããŸãïŒïŒ
3ã€ã®åº§æšã®åèšã¯1ã«çããããã3çªç®ã®åº§æšã¯äžè§åœ¢ã®é¢ç©ãä»ããã«èšç®ã§ããŸããå®éã2ã€ã®èªç±åºŠãããããŸããã
ããã§ããã¹ãŠãç·åœ¢å±æ§è£éã®æºåãã§ããŸãããäžè§åœ¢ã®æå®ãããç¹ã®å±æ§å€ã¯ã察å¿ããé ç¹ã®éå¿åº§æšãšå±æ§å€ã®ç·åœ¢çµåã«çãããªããŸãã
ããŒã¹ãã¯ãã£ããä¿®æ£ããã«ã¯ãå¥ã®åŒã䜿çšããŸãããŸããè£éå€T / zãèšç®ãã次ã«è£éå€1 / zãèšç®ããããããäºãã«åå²ããŠããŒã¹ãã¯ãã£ããèæ ®ããTã®æçµå€ãååŸããŸãã
ããŸããŸãªãã©ããŒãµã«ã¢ã«ãŽãªãºã ã®éãã¯ãæ€èšŒçšã®ãã¯ã»ã«ã®éžææ¹æ³ã§ãã ããã€ãã®ãªãã·ã§ã³ãæ€èšããŸãã
AABBã¢ã«ãŽãªãºã
ååã瀺ãããã«ããã®ã¢ã«ãŽãªãºã ã¯åçŽã«ããªãŽã³ã®è»žã«åãããå¢çããã¯ã¹ãæ§ç¯ããããªãŽã³å ã®ãã¹ãŠã®ãã¯ã»ã«ãééããŸãã äŸïŒ
ããã¯ãã©ããã³ã°ã¢ã«ãŽãªãºã
ãã®ã¢ã«ãŽãªãºã ã¯ã次ã®æé ã§æ§æãããŸãã
- æäžéšã®é ç¹ã®äžã®æäžéšã®ãã¯ã»ã«ããéå§ããŸã
- ããªãŽã³ã®å·ŠåŽã®ãã¯ã»ã«ã«éãããŸã§å·Šã«ç§»åããŸãïŒããã¯ãã©ããã³ã°ïŒ
- å³ã«ç§»åããããªãŽã³ã®å³ã®ãã¯ã»ã«ã«åºäŒããŸã§ãã¯ã»ã«ããã€ã³ãããŸã
- äžã®è¡ã«ç§»åããŠã2çªç®ã®ã¹ãããããããçŽããŠãã ããã
ããã¯æ¬¡ã®ããã«è¡šãããšãã§ããŸãã
ãã¯ã»ã«ãããªãŽã³ã®å·Šã«ããããšã次ã®ããã«ç¢ºèªã§ããŸã-æ³ç·ãå³ãæãïŒã€ãŸãa> 0ïŒå°ãªããšã1ã€ã®é¢ã§ã¯ããã®é¢ã®æ¹çšåŒã®å€ã¯è² ã§ãã
ãžã°ã¶ã°ã¢ã«ãŽãªãºã
ãã®ã¢ã«ãŽãªãºã ã¯ãããã¯ãã©ããã³ã°ã¢ã«ãŽãªãºã ã®æ¹è¯çãšèŠãªãããšãã§ããŸãã å³ã«ç§»åã§ãããã¯ã»ã«ãã§ãããŸã§è¡ã®ãã¯ã»ã«ããã¢ã€ããªã³ã°ããã代ããã«ãè¡ã®ç§»åãéå§ãããã¯ã»ã«ã«é¢ããæ å ±ãèŠããŠããããã¯ã»ã«ãå·Šå³ã«ç§»åããŸã圌ã
- æäžéšã®é ç¹ã®äžã®æäžéšã®ãã¯ã»ã«ããéå§ããŸã
- äœçœ®ãèŠããŠ
- å·Šã«ç§»åããŠãããªãŽã³ã®å·ŠåŽã®ãã¯ã»ã«ã«åºäŒããŸã§ãããªãŽã³ã«å ¥ããã¯ã»ã«ã®äžã«ãã€ã³ãããŸãïŒããã¯ãã©ããã³ã°ïŒ
- éå§ãããã¯ã»ã«ã«æ»ãïŒæé 2ã§èšæ¶ããŸããïŒãå³ã«ç§»åããŠãããªãŽã³ã®å€åŽã®ãã¯ã»ã«ã«éãããŸã§ãããªãŽã³ã«å ¥ããã¯ã»ã«ãåããŸãã
- äžã®è¡ã«ç§»åããŠã2çªç®ã®ã¹ãããããããçŽããŠãã ããã
å次座æšã®ã©ã¹ã¿ã©ã€ãºã¢ã«ãŽãªãºã
ãã®ã¢ã«ãŽãªãºã ã¯å ã ã2Då次座æšã䜿çšããäžè§åœ¢ã¹ãã£ã³å€æãMarc OlanoïŒTrey Greerã®åºçç©ã§èª¬æãããŠããŸããã ãã®äž»ãªå©ç¹ã¯ãé ç¹ã®å€æäžã«w座æšã«ããã¯ãªããã³ã°ãšé€ç®ã®å¿ èŠããªãããšã§ãïŒããã€ãã®äºçŽãé€ããŸã-ãããã«ã€ããŠã¯åŸã§èª¬æããŸãïŒã
ãŸããã©ã¹ã¿ã©ã€ãºã®éå§æã«ãé ç¹ã®x座æšãšy座æšã«ã察å¿ããw座æšã§åçŽã«é€ç®ããããšã«ãããç»é¢äžã®åº§æšã«ãããã³ã°ãããå€ãå«ãŸããŠãããšä»®å®ããŸãã ããã¯ãW座æšã«ããé€ç®ãå«ãŸãªããããããã€ãã®ã©ã¹ã¿ã©ã€ãºã¢ã«ãŽãªãºã ããµããŒããããŠããå Žåãé ç¹å€æã³ãŒãããããã«å€æŽã§ããŸãã åçš®ã®2次å 空éã®åº§æšã¯ãã©ã¹ã¿ã©ã€ãºãå®è¡ããé¢æ°ã«çŽæ¥è»¢éãããŸãã
ããªãŽã³ã«æ²¿ã£ãå±æ§ã®ç·åœ¢è£éã®åé¡ããã詳现ã«æ€èšããŠã¿ãŸãããã å±æ§ã®å€ïŒãããpãšåŒã³ãŸãããïŒã¯ç·åœ¢ã«å¢å ããããã次ã®æ¹çšåŒãïŒ3次å 空éã§ïŒæºããå¿ èŠããããŸãã
ç¹ïŒxãyãzïŒã¯å次座æšïŒxãyãwïŒã䜿çšããŠå¹³é¢ã«æ圱ãããã®ã§ïŒ w = z ïŒ ãå次座æšã§ãã®æ¹çšåŒãæžãããšãã§ããŸãã
ä¿æ°a ã bãããã³cãç¥ã£ãŠãããšæ³åããŠãã ããïŒå°ãåŸã§èŠã€ããããšãæ€èšããŸãïŒã ã©ã¹ã¿ã©ã€ãºäžãç»é¢ç©ºéå ã®ãã¯ã»ã«ã®åº§æšãåŠçããŸããããã¯ã次ã®åŒã«åŸã£ãŠåäžç©ºéå ã®åº§æšã«é¢é£ä»ããããŸãïŒããã¯æåã®ä»®å®ã§ããïŒã
wã§å²ãããšã«ãããç»é¢ç©ºéã®åº§æšã®ã¿ã䜿çšããŠp / wã®å€ãè¡šçŸã§ããŸãã
ã¹ã¯ãªãŒã³åº§æšã䜿çšããŠæ£ããpå€ãååŸããã«ã¯ããã®å€ã1 / wã§é€ç®ããã ãã§ãïŒãŸãã¯ãåãããšã§ã wã§ä¹ç®ããŸãïŒã
åæ§ã«ã 1 / wã¯åæ§ã®ã¢ã«ãŽãªãºã ã§èšç®ã§ããŸãããã¹ãŠã®é ç¹ã§åããã©ã¡ãŒã¿ãŒp = [1 1 1]ããããšæ³åããã ãã§ååã§ãã
次ã«ãä¿æ°a ã bãããã³cãèŠã€ããæ¹æ³ãæ€èšããŸãã åå±æ§ã®å€ã¯ããªãŽã³ã®é ç¹ã§èšå®ããããããå®éã«ã¯æ¬¡ã®åœ¢åŒã®æ¹çšåŒç³»ããããŸãã
ãã®ã·ã¹ãã ããããªãã¯ã¹åœ¢åŒã§æžãæããããšãã§ããŸãã
ãããŠè§£æ±ºçïŒ
ããªãŽã³ããšã«1ã€ã®éè¡åã®ã¿ãèšç®ããå¿ èŠãããããšã«æ³šæããããšãéèŠã§ãããããã®ä¿æ°ã䜿çšããŠãç»é¢äžã®ä»»æã®ãã€ã³ãã§æ£ããå±æ§å€ãèŠã€ããããšãã§ããŸãã ãŸããè¡åã®è¡ååŒãéç®ããããã«èšç®ããå¿ èŠããããããè¡ååŒã¯åç¹ã«é ç¹ãæã¡ãå€è§åœ¢ã®ç¹ã«2ãæããåé¢äœã®äœç©ãèšç®ãããããè£å©æ å ±ãååŸããŸãïŒããã¯ãã¯ãã«ã®æ··åç©ã®å®çŸ©ããåŸãããŸãïŒã è¡ååŒããŒãã®å Žåãããã¯ããªãŽã³ãæç»ã§ããªãããšãæå³ããŸããããªãŽã³ã¯çž®éããŠããããã«ã¡ã©ã«å¯ŸããŠãšããžã«ãã£ãŠå転ããŠããããã§ãã ãŸããåé¢äœã®äœç©ã«ã¯ãã©ã¹èšå·ãšãã€ãã¹èšå·ãä»ããããšãã§ããŸããããã䜿çšããŠãã«ã¡ã©ã«ãæ»ããããªãŽã³ïŒãèé¢ã«ãªã³ã°ãïŒãåãåãããšãã§ããŸãã é ç¹ãåæèšåãã«äžŠã¹ãããšãæ£ãããšèããå Žåãè¡ååŒã®å€ãæ£ã§ããããªãŽã³ã¯ã¹ãããããå¿ èŠããããŸãïŒå·Šæ座æšç³»ã䜿çšãããŠããå ŽåïŒã
ãã®ããã«ãå±æ§è£éã®åé¡ã¯ãã§ã«è§£æ±ºãããŠããŸã-ç»é¢äžã®ç¹å®ã®ãã€ã³ãã§ä»»æã®å±æ§ã®æ£ããå€ãèšç®ã§ããŸãïŒèŠç¹ãèæ ®ã«å ¥ããŠïŒã ããªãŽã³ãç»é¢äžã®ã©ã®ãã€ã³ãã«å±ãããã決å®ããããã ãã«æ®ããŸãã
ãã©ããŒã¹ã¢ã«ãŽãªãºã ã§ããªãŽã³ãžã®ãã¯ã»ã«ã®æå±ãã©ã®ããã«æ€èšŒãããããæãåºããŠã¿ãŸãããã é¢ã®æ¹çšåŒãèšç®ããç»é¢äžã®ç®çã®ãã€ã³ãã§å€ã確èªããŸããã ãããããã¹ãŠæ£ïŒãŸãã¯ãŒãã§ããããå·Šé¢ãŸãã¯äžé¢ã«å±ããŠããïŒã§ããå Žåããã¯ã»ã«äžã«ãã€ã³ãããŸããã äžè§åœ¢ã®è¡šé¢ã«æ²¿ã£ãŠå±æ§ãè£éããæ¹æ³ããã§ã«ç¥ã£ãŠããã®ã§ãå察ã®é ç¹ïŒå®éã«ã¯ããã¯å¹³é¢ã§ãïŒã«æ²¿ã£ãŠãŒãã«çããæ¬äŒŒå±æ§ãšæ£ã®å€ïŒæã䟿å©ãªã®ã¯1ïŒãè£éãããšä»®å®ããŠããŸã£ããåãã¢ãããŒãã䜿çšã§ããŸããããã®é¢ãééããïŒïŒ
ãããã£ãŠãåé¢ã®ãããã®æ¬äŒŒå±æ§ã®å€ïŒ
ãããã䜿çšããŠãåé¢ã«å¯Ÿå¿ããä¿æ°a ã bãããã³cãèšç®ãããããã®æ¹çšåŒãååŸã§ããŸãã
ããã§ãäžè§åœ¢ã®è¡šé¢ã«æ²¿ã£ãŠåæ§ã«å€ãè£éããå¿ èŠãªãã€ã³ãã§å€ãèšç®ã§ããŸãã æ£ã§ãããããŒãã§ãããã巊端ãšäžç«¯ã«ããå Žåããã¯ã»ã«ã¯ããªãŽã³ã®å åŽã«ãããå¡ãã€ã¶ãå¿ èŠããããŸãã ãŸããå°ããªæé©åãé©çšããããšãã§ããŸã-é¢ã®æ¹çšåŒã®æ£ç¢ºãªå€ã¯ãŸã£ããå¿ èŠãªãããã®ç¬Šå·ã ãã§ååã§ãã ãããã£ãŠã 1 / wã«ããé€ç®ã¯åé¿ã§ãã p / wãš1 / wã®ç¬Šå·ããã§ãã¯ããã ãã§ãããäžèŽããå¿ èŠããããŸãã
åããã§ãŒã¹æ¹çšåŒãæäœããããããã©ããŒãµã«ã¢ã«ãŽãªãºã ã®ã»ã¯ã·ã§ã³ã§è¿°ã¹ãå 容ã®å€ãã¯ããã®ã¢ã«ãŽãªãºã ã«ãé©çšã§ããŸãã ããšãã°ãå·Šäžã®ã«ãŒã«ã¯åæ§ã®æ¹æ³ã§å®è£ ã§ããé¢ã®æ¹çšåŒã®å€ã¯å¢åçã«èšç®ã§ããŸããããã¯äŸ¿å©ãªæé©åã§ãã
ãã®ã¢ã«ãŽãªãºã ãå°å ¥ãããšãã«ããã®ã¢ã«ãŽãªãºã ã¯åäžãªåº§æšã§åäœãããããã¯ãªããã³ã°ãå¿ èŠãšããªããšæžããŸããã ããã¯ã1ã€ã®ã±ãŒã¹ãé€ããã»ãŒå®å šã«çå®ã§ãã åç¹ã«è¿ãïŒãŸãã¯äžèŽããïŒãã€ã³ãã®w座æšãæäœããå ŽåããããŸãã ãã®å Žåãå±æ§ã®è£éäžã«ãªãŒããŒãããŒãçºçããå¯èœæ§ããããŸãã ãã®ããããã®ãããªãšã©ãŒãåé¿ããããã«ã xyå¹³é¢ã«å¹³è¡ã§ãåç¹ã«è¿ãè·é¢zã«ããå¥ã®ãé¢ããè¿œå ããããšããå§ãããŸãã
ãã©ããŒãµã«ã¢ã«ãŽãªãºã ã説æãããšãã«ãäžè§åœ¢ããã§ãã¯ãããã¯ã»ã«ã®ã»ãããéžæããããã®ããã€ãã®ãªãã·ã§ã³ã«ã€ããŠèšåããŸããïŒè»žæŽåå¢çããã¯ã¹ãããã¯ãã©ããã³ã°ããžã°ã¶ã°ã¢ã«ãŽãªãºã ïŒã ããã§é©çšã§ããŸãã ããã¯ãå¢çå€ïŒããšãã°ãããŠã³ãã£ã³ã°ããã¯ã¹ã®åº§æšïŒãèšç®ããããã«é ç¹ãw座æšã§é€ç®ããå¿ èŠãããç¶æ³ã§ããw<= 0ã®å Žåã®ã¿ç¶æ³ãäºæž¬ããå¿ èŠããããŸã ã ãã¡ãããä»ã®æ¹æ³ããããŸãã ç»é¢ã®ãã¹ãŠã®ãã¯ã»ã«ãééããããšã¯ãããã©ãŒãã³ã¹ã®èŠ³ç¹ããæããã«å€±æããŸãã ãŸããã¿ã€ã«ã©ã¹ã¿åã䜿çšããããšãã§ããŸããããã®èª¬æã¯ãã®èšäºã®ç¯å²å€ã§ãã
ããã ãã§ã
å®è£ ã®äŸãèŠãããšãã§ãããããžã§ã¯ãïŒ github.com/loreglean/lantern ä¿®æ£ãªã©ã®ãã«ãªã¯ãšã¹ããæè¿ããŸããã³ãŒãã®ãšã©ãŒãŸãã¯PMã«é¢ãã質åã«ã€ããŠæžããŠãã ããã