tag:blogger.com,1999:blog-54512528640184287702024-03-05T11:33:27.115+01:00Fabien Chéreau's blogStuff about programming, Stellarium and myself.fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-5451252864018428770.post-80542818886774643722015-06-14T16:36:00.000+02:002015-06-14T16:44:20.737+02:00Blowfish Rescue released!After more than 2 years of work, Guillaume from <a href="http://noctua-software.com/apps" target="_blank">Noctua Software</a> finally made it again:<br />
<br />
<b>Blowfish Rescue is now released! </b><br />
<br />
This is a 2d action/puzzle game in which you have to blow little fishes back in their bucket. It's really a lot of fun to play :)<br />
<br />
<span style="font-family: inherit;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: inherit;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/10XV1z5V8fQ/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/10XV1z5V8fQ?feature=player_embedded" width="320"></iframe></span></div>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><br /></span>
I find this game really unique, and consider it a real masterpiece of programming. Guillaume managed to pack in these less than 3mb package:<br />
<br />
<ul>
<li>a realistic fluid simulation solver</li>
<li>a kinematic engine</li>
<li>a procedural graphics (and animations) generation. See <a href="http://blog.noctua-software.com/noc_turtle.html" target="_blank">this blog post</a> for detailed info and source code for this feature</li>
<li>plus all regular game assets like music, sounds texts, animations etc..</li>
</ul>
<br />
The game is available for free on <a href="https://play.google.com/store/apps/details?id=com.noctuasoftware.blowfish">google play</a> and <a href="https://itunes.apple.com/app/blowfishrescue/id980155132">iTune</a>.<!--3mb-->fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com7tag:blogger.com,1999:blog-5451252864018428770.post-75906822606967164012014-06-07T00:29:00.000+02:002014-06-07T00:29:00.206+02:00A better reflectance model for the moonHere is my second post on my recent activities on planets rendering in Stellarium.<br />
<br />
One thing I always disliked in Stellarium was the rendering of the Moon. It always looked like a giant 3D sphere with a "computer graphics style".<br />
<br />
The reason for this is that we were until now using a basic <a href="http://en.wikipedia.org/wiki/Lambertian_reflectance" target="_blank">Lambertian reflectance</a> model. In other words, it means that we assumed that the light coming from the sun was reflected equally in all directions by the Moon's surface. The Moon being a sphere, this implies that the center of the full moon was brighter than the edges, because the light coming from the Sun comes perpendicular to the moon surface. And this produces something like that:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiItpgrxPhEhg7kFQ05JCXbb3GLAWnmc2bGAueNpSbL5FZfj13x12pNlid-1EsTn-299mC14ppqaqqajGOhHBdLg6tXLncQUDe7b5BS9gJtkAAD5EYrluBp4awFuElCMDFuAI7EmJn8kAXQ/s1600/stellarium-005.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiItpgrxPhEhg7kFQ05JCXbb3GLAWnmc2bGAueNpSbL5FZfj13x12pNlid-1EsTn-299mC14ppqaqqajGOhHBdLg6tXLncQUDe7b5BS9gJtkAAD5EYrluBp4awFuElCMDFuAI7EmJn8kAXQ/s1600/stellarium-005.png" height="358" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Notice how the center of the moon is brighter than it's edges</td></tr>
</tbody></table>
For comparison here is a beautiful picture of the moon taken from earth:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRAYNBM0RstSmWWZJgXTfM4njHcHNYsZFo-orYRq_D8mpuFZ4yarn-ZLlTQVCv_BV-3T2qA5xPlJ2X5nJHIhHnkMQMo4firA9dmceSyCwAUJ6BPOz8ixs7K-oVyGePQdiNOsoiADn2Tl7M/s1600/640px-Full_Moon_Luc_Viatour.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRAYNBM0RstSmWWZJgXTfM4njHcHNYsZFo-orYRq_D8mpuFZ4yarn-ZLlTQVCv_BV-3T2qA5xPlJ2X5nJHIhHnkMQMo4firA9dmceSyCwAUJ6BPOz8ixs7K-oVyGePQdiNOsoiADn2Tl7M/s1600/640px-Full_Moon_Luc_Viatour.jpg" height="400" width="396" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: small; text-align: start;">Image from <a href="http://en.wikipedia.org/wiki/Wikipedia:Featured_picture_candidates/delist/Full_Moon#mediaviewer/File:Full_Moon_Luc_Viatour.jpg" target="_blank">this Wikipedia page</a> - Copyrights</span><span style="font-size: small; text-align: start;"> Luc Viatour - </span><a href="http://creativecommons.org/licenses/by-sa/2.5-2.0-1.0" style="font-size: medium; text-align: start;">CC BY-SA 3.0</a></td></tr>
</tbody></table>
<br />
Notice the "flat design" look & feel? (<span style="font-size: x-small;">At least something Apple won't be able to patent because of prior art ;) )</span><br />
<br />
The reason of this is that the Moon's surface is composed of a rough material, and that rough materials are not well modelized by Lambertian model. For such surface, one option is to use an <a href="http://en.wikipedia.org/wiki/Oren%E2%80%93Nayar_reflectance_model" target="_blank">Oren-Nayar reflectance model</a>. Based on <a href="http://content.gpwiki.org/index.php/D3DBook:(Lighting)_Oren-Nayar" target="_blank">this article</a> I was able to quickly implement something, and here is the result:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxg3H18WkbTGm5rfxH8-OOJAjnwZcIu8nBAULBP30xb4wVPKn4m7nWYkyqjPLwpy6jWLc3Hv0bLmDg6HNOBvM4gbCG1Muigj-q8pSIaQ4GQ-W3qma8DHaWzApJFoWqdOWPYjwqLJeTq8H9/s1600/stellarium-006.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxg3H18WkbTGm5rfxH8-OOJAjnwZcIu8nBAULBP30xb4wVPKn4m7nWYkyqjPLwpy6jWLc3Hv0bLmDg6HNOBvM4gbCG1Muigj-q8pSIaQ4GQ-W3qma8DHaWzApJFoWqdOWPYjwqLJeTq8H9/s1600/stellarium-006.png" height="358" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">OK, it's still ugly, but it's already better..</td></tr>
</tbody></table>
<br />
What's next? Maybe try to add normal mapping, to simulate relief and adopt nicer textures.<br />
<br />fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com4tag:blogger.com,1999:blog-5451252864018428770.post-10432179727312071662014-06-06T23:54:00.001+02:002014-06-06T23:54:11.368+02:00Planets rendering in StellariumThis week I spent some of my evenings working on planet rendering in Stellarium.<br />
<br />
One of the long standing task which was in my TODO list was to properly integrate the great <a href="http://nexyon.blogspot.fr/2012/08/stellarium-shadows.html" target="_blank">work done by Jörg Müller</a> during the Google Summer Of Code 2012 (yes that's about 2 years now!).<br />
<br />
Although his code was producing a satisfying rendering, it had never been permanently integrated because of several reasons: the code was very slow, was making use of floating point textures, which is not supported by many OpenGL implementations, and most importantly, the code was not well integrated with the rest of the rendering, mostly because the rendering code of Stellarium was and is still on some aspects very messy.<br />
<br />
So, after <a href="http://bazaar.launchpad.net/~stellarium/stellarium/trunk/revision/6810" target="_blank">a good refactoring and a large shader simplification</a>, we now reached a point where we have a rendering as good as in Jörg's branch, with only a few FPS drops, and without using any exotic OpenGL features.<br />
<br />
Here is the result:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzZWZffb6Dkpdwn2oT5wP7LM_jaYHjqiavwzeTJruKBPNwSS3Hvwd1UgUZ429MgfovP7wXSccE2LIhsfREN6kt5S0VpvvKjQr5VtVk-w0vIrkba8EuAj_HFIQY9U7-bU3Z1eKv7L_keV4y/s1600/stellarium-000.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzZWZffb6Dkpdwn2oT5wP7LM_jaYHjqiavwzeTJruKBPNwSS3Hvwd1UgUZ429MgfovP7wXSccE2LIhsfREN6kt5S0VpvvKjQr5VtVk-w0vIrkba8EuAj_HFIQY9U7-bU3Z1eKv7L_keV4y/s1600/stellarium-000.png" height="360" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: small;">Saturn as seen from Iapetus. Notice the ring shadow cast on the planet</span></td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTT-PSiUT9jchlZLEbGzhv4dcm4EsbmvMhfVEmIzaMBcnAl5aYm0ALpSfeOA36Nt3Zf6y8lPpeQ9dEvbCTOoUZFGu_OXyqOi5zqOZpsgzOcq5gRYzUmImdHf72vq3hXJEFxRSiit5_lKRh/s1600/stellarium-001.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTT-PSiUT9jchlZLEbGzhv4dcm4EsbmvMhfVEmIzaMBcnAl5aYm0ALpSfeOA36Nt3Zf6y8lPpeQ9dEvbCTOoUZFGu_OXyqOi5zqOZpsgzOcq5gRYzUmImdHf72vq3hXJEFxRSiit5_lKRh/s1600/stellarium-001.png" height="356" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Io in front of Jupiter</td></tr>
</tbody></table>
<br />
What's next? The recent switch to shader-only based OpenGL code and shader cleanup done this week will allow me to improve the currently poor rendering of planets.<br />
<br />
To be continued..fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com0tag:blogger.com,1999:blog-5451252864018428770.post-30099489946736824912013-04-23T17:55:00.001+02:002013-04-23T17:55:12.313+02:00Voxel Invaders on iOS!<br />
<div class="separator" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYpuZtzh_jRdT5Admb1Y3fmcl_o_Tp5QT3JhrwYarZZwK8i8-TjLjhmpoPb6YV4xnJ9p8vOlhyphenhypheni-ENj5YyspRV-yulqmBtm_K7lFHX0zDW5cNE4kl7QKRmN7UP8Th4P-AbuFtM17248b-S/s1600/promo-small.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYpuZtzh_jRdT5Admb1Y3fmcl_o_Tp5QT3JhrwYarZZwK8i8-TjLjhmpoPb6YV4xnJ9p8vOlhyphenhypheni-ENj5YyspRV-yulqmBtm_K7lFHX0zDW5cNE4kl7QKRmN7UP8Th4P-AbuFtM17248b-S/s320/promo-small.png" /></a></div>
<br />
Good news for iPhone or iPad owners: we have finally made it through the Apple store procedure: Voxel Invaders, our last video game is now available on iOS!<br />
<br />
The game is now available on the main mobile plateforms and we are looking forward to compare sells on both :)<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjupIzwUut5yXQAYi_RJSzFGDoR7OdeGI8Gh8ZQ8Ia76WHinRBSGiCwAd3OOC_U8PITx4m9kwoVSnG2jxICg5u2Ub6og2vkBw4UBC7yfMtdjyh_Xlm8Yl_2Hl6LkJAAWXkvO519n0hRnnDf/s1600/appstore.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjupIzwUut5yXQAYi_RJSzFGDoR7OdeGI8Gh8ZQ8Ia76WHinRBSGiCwAd3OOC_U8PITx4m9kwoVSnG2jxICg5u2Ub6og2vkBw4UBC7yfMtdjyh_Xlm8Yl_2Hl6LkJAAWXkvO519n0hRnnDf/s1600/appstore.png" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgntWG-aP-POiYc4d8HLYLnBtnwZL_xANghuiuonx5Ig1Vgnsd9AjRnluhAI64WLmlzOlR4VRLKXIr4Xd4DozUpW3sXFGeBIbmlqUMfhGX-hLTT0iVg9VOsPB_NETQxLOB8HJofXZ5RVUaX/s1600/googleplay.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgntWG-aP-POiYc4d8HLYLnBtnwZL_xANghuiuonx5Ig1Vgnsd9AjRnluhAI64WLmlzOlR4VRLKXIr4Xd4DozUpW3sXFGeBIbmlqUMfhGX-hLTT0iVg9VOsPB_NETQxLOB8HJofXZ5RVUaX/s1600/googleplay.png" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWIdnxA4LMwUW3EaNxtrsdYm9EsEDQGKrG_VbLGEKKmX0omNJkK8CWg0YGPGvqpMuDy3Hq3huKmuLOfrL-BbI8yaC-xR4bNrflGEGSad1-1Rn41F7vQ9WnVWPFMLqeQe4nUbxO0Hu96RXO/s1600/amazon.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWIdnxA4LMwUW3EaNxtrsdYm9EsEDQGKrG_VbLGEKKmX0omNJkK8CWg0YGPGvqpMuDy3Hq3huKmuLOfrL-BbI8yaC-xR4bNrflGEGSad1-1Rn41F7vQ9WnVWPFMLqeQe4nUbxO0Hu96RXO/s1600/amazon.png" /></a></div>
<br />
For techies, it is interesting to note that all versions of the game use the exact same C source code with the exception of thin wrappers for each plateforms. Even the <a href="http://www.noctua-software.com/voxel-invaders/play" target="_blank">online JavaScript version</a> was generated from the pure C code using the powerful <a href="https://github.com/kripken/emscripten#readme" target="_blank">emscriptem</a>!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCCNf4NbmD0czouGCynn0M1MLD11Zb_c_14W3d5Ylok0ixkTZLxIRSCTLyPpY96rDw0Xj5j9kr4atqAd8rUDP8X5_1WrYtEECMfx2VVTqcFO8VPZPW-UAnPZGN-QtqKOr9JjFUe6l6XaLT/s1600/voxelinvaders_levelmenu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCCNf4NbmD0czouGCynn0M1MLD11Zb_c_14W3d5Ylok0ixkTZLxIRSCTLyPpY96rDw0Xj5j9kr4atqAd8rUDP8X5_1WrYtEECMfx2VVTqcFO8VPZPW-UAnPZGN-QtqKOr9JjFUe6l6XaLT/s400/voxelinvaders_levelmenu.png" width="263" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2AZhSZ0qRg8wYh-uiLcl1Ir-gIVxy02WGhMyQHUJ_twfBN-FSov3bEw95BUlex-dlxGvjHHo2HaC2Rj-lL_9rDvFQtIxm53Ka3D9DcuWDxCIfY4YLm-KB3nzzAzYsGZwWHD1dvnFYwxkV/s1600/voxelinvaders_led.png" imageanchor="1" style="display: inline !important; margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2AZhSZ0qRg8wYh-uiLcl1Ir-gIVxy02WGhMyQHUJ_twfBN-FSov3bEw95BUlex-dlxGvjHHo2HaC2Rj-lL_9rDvFQtIxm53Ka3D9DcuWDxCIfY4YLm-KB3nzzAzYsGZwWHD1dvnFYwxkV/s400/voxelinvaders_led.png" width="264" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj4sjOJkSV0-X1HDZml-HRIETTT35mtx28iNe5BdPauagmTNsJF-ARtXOuT0SzcMAHRRDPk-PEvfOzijNCKAps8jkkyn2bsKlDJ4MaWCL2QWq_kqqDKtFW0EPo4aOrRLQ3NSpvAQqWrIt4/s1600/voxelinvaders_asteroid.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj4sjOJkSV0-X1HDZml-HRIETTT35mtx28iNe5BdPauagmTNsJF-ARtXOuT0SzcMAHRRDPk-PEvfOzijNCKAps8jkkyn2bsKlDJ4MaWCL2QWq_kqqDKtFW0EPo4aOrRLQ3NSpvAQqWrIt4/s400/voxelinvaders_asteroid.png" width="266" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhByeVeRladYApej_PtiQv-gefcdtmM5D_KPzhTO_8WrokxN2oH-Oh76PeBZqiK7VlrTGtUtSC0UeJUYxNvqI1Id4-ow_4v_1tfZezKcGmS_-7bFs0vgE_hoM_eogCM-jpPZxr2_B0VemrJ/s1600/voxelinvaders_171.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhByeVeRladYApej_PtiQv-gefcdtmM5D_KPzhTO_8WrokxN2oH-Oh76PeBZqiK7VlrTGtUtSC0UeJUYxNvqI1Id4-ow_4v_1tfZezKcGmS_-7bFs0vgE_hoM_eogCM-jpPZxr2_B0VemrJ/s400/voxelinvaders_171.png" width="264" /></a></div>
<br />fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com1tag:blogger.com,1999:blog-5451252864018428770.post-31323226168189994702012-09-24T00:26:00.000+02:002012-09-24T00:26:05.298+02:00Space Invader + Voxel Graphics = Voxel Invaders!<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl-UMfPfcHtibPOI2EsNXW2vnU3lFYHuM88SVOpX96oNS6ZqHGXErQcGbOgnJCqCqPwACS5_hQI5IcPaMT6b1YFW5cty6ciswDnk62PksrUbbdQxScR40kGxMEW_2GCQrprXOiIugUxqdR/s1600/promo2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="195" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl-UMfPfcHtibPOI2EsNXW2vnU3lFYHuM88SVOpX96oNS6ZqHGXErQcGbOgnJCqCqPwACS5_hQI5IcPaMT6b1YFW5cty6ciswDnk62PksrUbbdQxScR40kGxMEW_2GCQrprXOiIugUxqdR/s400/promo2.png" width="400" /></a></div>
<br />
This week we (noctua software) released our new video game for android phone: <a href="http://play.google.com/store/apps/details?id=com.noctuasoftware.voxelinvaders">Voxel Invaders</a>.<br />
<br />
This is the sequel of our previous game <a href="http://play.google.com/store/apps/details?id=com.noctuasoftware.retrocosmos2">Retrocosmos</a> and it follows the same principle of making a fun space invader game for touch screen devices. Only this time we used 3d voxels (the equivalent of pixels in 3d) for all the graphics! My brother <a href="http://charlie137-2.blogspot.fr/2012/09/voxel-invaders-space-invader-3d-voxels.html">Guillaume</a> did a very good job coding the voxel graphic engine which delegates most of the computing on the graphic card allowing surprisingly fast rendering even on small devices.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8J3PdjX25bmOLr6E1tN9Hbv4XktMuQymuWw79pHe2wfnmQ5I62H-_xD3XGEKDpcqI-sHunQ_HWlMPQuiAuA9hSstu2R9oTkqnvFHgBCh_t3Q5GkTbIjO1_iwGWMTDprXc1CEyyV-QgcUr/s1600/screenshots.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8J3PdjX25bmOLr6E1tN9Hbv4XktMuQymuWw79pHe2wfnmQ5I62H-_xD3XGEKDpcqI-sHunQ_HWlMPQuiAuA9hSstu2R9oTkqnvFHgBCh_t3Q5GkTbIjO1_iwGWMTDprXc1CEyyV-QgcUr/s200/screenshots.png" width="133" /></a>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOeHdJlCz1JgUe4JZJfHxrsD2a0nj7wyg6TnSw6pr9XYSF8Fev-vcrHUskwXDCloKhGeoDLyaKPiv-WQRVV-9AlNjjpg-N12GoGq5764rxNCtA-yTOGNLZqsIBJ9rYhNztSVZ7F0slRuqv/s1600/screenshotlaser.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOeHdJlCz1JgUe4JZJfHxrsD2a0nj7wyg6TnSw6pr9XYSF8Fev-vcrHUskwXDCloKhGeoDLyaKPiv-WQRVV-9AlNjjpg-N12GoGq5764rxNCtA-yTOGNLZqsIBJ9rYhNztSVZ7F0slRuqv/s200/screenshotlaser.png" width="133" /></a>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5DjSrlKKmllQ_1qyBv8cqr8rzsL9CUzNZg_cc1eK6Uza4sHtut3w_RvpezEh8QG_pmfveTtOt6Z7CCtLNemKp-JeoSfhJs4dVQhS7OHbBos4X64A_f9zVsj_MHA8mDgN6coUtSytsudM4/s1600/screenshots-pong.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5DjSrlKKmllQ_1qyBv8cqr8rzsL9CUzNZg_cc1eK6Uza4sHtut3w_RvpezEh8QG_pmfveTtOt6Z7CCtLNemKp-JeoSfhJs4dVQhS7OHbBos4X64A_f9zVsj_MHA8mDgN6coUtSytsudM4/s200/screenshots-pong.png" width="133" /></a>
</div>
<br />
The game is overall much more mature than the previous one, with more levels and more efforts put into graphics and gameplay. I also spent some nights creating retro sound effects with my good old <a href="http://en.wikipedia.org/wiki/Roland_SH-101">Roland SH-101</a> analogic synthesizer and managed to compose 4 original soundtracks with my favorite tracker (<a href="http://en.wikipedia.org/wiki/OpenMPT">OpenMPT</a>). You can hear all of those in the demo video:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/RW5idfEPkpw?feature=player_embedded' frameborder='0'></iframe></div>
<br />
From a marketing point of view, we did two versions of the game: a <a href="http://play.google.com/store/apps/details?id=com.noctuasoftware.voxelinvaders_demo">free demo</a> and a <a href="http://play.google.com/store/apps/details?id=com.noctuasoftware.voxelinvaders">full paid</a> version. We didn't put ads in the free version but simply limited the number of levels. Let's hope our users will find the game fun enough to buy the extra 20 levels!
<br />
<br />
<div style="text-align: center;">
<a href="http://play.google.com/store/apps/details?id=com.noctuasoftware.voxelinvaders">
<img alt="Android app on Google Play" src="http://www.android.com/images/brand/android_app_on_play_logo_small.png" />
</a></div>
fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com0tag:blogger.com,1999:blog-5451252864018428770.post-79991646058602898582012-08-12T15:01:00.002+02:002012-08-12T15:01:49.028+02:00Alien Skull on MarsI just spent some time looking at the <a href="http://www.nasa.gov/mission_pages/msl/multimedia/pia16051.html">amazing first full res pictures of mars</a> taken by Curiosity, and I stumbled on this:
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7xZltL4102akyFOdUdGZht7MjPzBvQrBZnCdw508Qqd2Hwh8mQfElYpyhIUnOuNd64h2yKJJyFhH0yfCj4hz7ULQZLYfSGf7E5EXPHfisFy4O_SYqS1tHdpewVgQyu1oK971tGb9T-sDH/s1600/curiosity-mars-alien-skull.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="313" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7xZltL4102akyFOdUdGZht7MjPzBvQrBZnCdw508Qqd2Hwh8mQfElYpyhIUnOuNd64h2yKJJyFhH0yfCj4hz7ULQZLYfSGf7E5EXPHfisFy4O_SYqS1tHdpewVgQyu1oK971tGb9T-sDH/s400/curiosity-mars-alien-skull.png" /></a></div>
Yes, an alien grave with a skull! It's amazing how the human brain can see things it's looking for in random pictures :)fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com1tag:blogger.com,1999:blog-5451252864018428770.post-62848211397432352702011-07-22T12:14:00.000+02:002011-07-22T12:14:15.007+02:00Stellarium in SOCIS 2011Are you a student looking for an exciting summer job? Get paid this summer to work on Stellarium!<br />
<br />
The Stellarium project was selected to be a mentoring organization for the ESA Summer of Code in Space 2011: a program funding european students for working on astronomy open source projects. Please review our ideas page and submit your application <a href="http://sophia.estec.esa.int/socis2011/?q=node/13">here</a>.<br />
<br />
The stipend consist in 4000 EUR (upon project completion), and is available for students from European universities (see <a href="http://sophia.estec.esa.int/socis2011/?q=tos">this page</a> for more details).<br />
<br />
Hurry up! The application deadline is on July 27th at 11am UTCfab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com5tag:blogger.com,1999:blog-5451252864018428770.post-83244436838049865872011-06-15T16:19:00.001+02:002011-06-17T11:25:54.331+02:00Atmospheric refraction in Stellarium<div>The full moon eclipse coming "over bavaria" tonight (as said in the bavarian newpapers :) ) is a good occasion to show off the new atmospheric refraction code I finally had time to commit in stellarium (with important contributions from Georg Zotti).<br />
<br />
The <a href="http://en.wikipedia.org/wiki/Atmospheric_refraction">atmospheric refraction</a> effect is a small deviation of light rays when they go through the atmosphere. It causes stars to appear higher in the sky than they are in reality, and this effect is mostly visible close to the horizon.<br />
<br />
Luckily for the purpose of this post, today's moon eclipse is occuring very close to the horizon (in Munich) as you can see on this screenshot:<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEexgMQXYJkVXeM5jVLhKhVyJ2OSOHg4FIqEFcGxiocCrX6YNzP0KZHbBG44asHfpCn-u1NBhrIMk7ZqxjSUpi0hEOnZkestHPm6Jnw-WZXybDAmp2U0-vYadxx26SOTbbGswtkExG9vYm/s1600/refraction1.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEexgMQXYJkVXeM5jVLhKhVyJ2OSOHg4FIqEFcGxiocCrX6YNzP0KZHbBG44asHfpCn-u1NBhrIMk7ZqxjSUpi0hEOnZkestHPm6Jnw-WZXybDAmp2U0-vYadxx26SOTbbGswtkExG9vYm/s400/refraction1.png" width="393" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Moon eclipse simulated in Stellarium with atmosphere and refraction effect turned off (left) and on (right), at precisely the same time</td></tr>
</tbody></table><br />
What we can see in this image that:<br />
<ul><li>the moon on the right appears higher in the sky as it would without atmosphere. This means that on the right side (and in reality) we are actually seeing light originally coming from below the ground! This also mean that the apparent rising time for stars, sun and other astronomical objects is shifted by about a minute with respect to the geometric position.</li>
<li>the moon on the right doesn't have the shape of a disk but rather of an oval. This is because close to the horizon the light is 'compressed' vertically because of refraction.</li>
</ul>This refraction effect is much smaller further away from the horizon but still cannot be neglected when e.g. pointing a telescope. The blinking image below show what happens when atmosphere refraction is toggled on and off on a star field.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF8XQvVupXSjHX4yZR2EcgtUYVbe0hGQBt1AKnCMdP7eJyo9xeCI63IruYuIUhKzSzu2G6gI-rxqoDqtr8G2FPNxd1lRWG_kPmFQAxP-chANelnxFPxwrmm3L6EvklMDZCZnHtuJKA8gXM/s1600/refraction.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF8XQvVupXSjHX4yZR2EcgtUYVbe0hGQBt1AKnCMdP7eJyo9xeCI63IruYuIUhKzSzu2G6gI-rxqoDqtr8G2FPNxd1lRWG_kPmFQAxP-chANelnxFPxwrmm3L6EvklMDZCZnHtuJKA8gXM/s320/refraction.gif" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Click on the image to see a larger animated version</td></tr>
</tbody></table><br />
As you can imagine, this new feature was quite challenging to integrate cleanly in the code of Stellarium, and as far as I know, Stellarium is currently the only software able to simulate oval moons, and it does that in real time :)<br />
<br />
To keep things short, the technical details will be the subject of another post.</div>fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com2tag:blogger.com,1999:blog-5451252864018428770.post-55289989851865687612011-05-05T17:51:00.001+02:002011-05-05T18:11:29.667+02:00SVMT plugin for StellariumIf you have been wondering what <a href="http://dmarcos.es/">Diego</a> and myself worked on for more than a year at <a href="http://www.eso.org">ESO</a>, here is a quick video answer realized by Diego: <br />
<br />
<iframe width="560" height="349" src="http://www.youtube.com/embed/COkwscvTnnM" frameborder="0" allowfullscreen></iframe><br />
<br />
And here is another video focusing on the GUI:<br />
<br />
<iframe width="560" height="349" src="http://www.youtube.com/embed/xYmcpB794DM" frameborder="0" allowfullscreen></iframe><br />
<br />
Seeing the videos, you may now think: it looks cool, but what the hell is that?<br />
<br />
<br />
<b>What is SVMT?</b><br />
SVMT standing for "Survey Visualization and Monitoring Tool" is a plugin for Stellarium which allows astronomers at ESO to monitor the progression and completion of <a href="http://www.eso.org/sci/observing/policies/PublicSurveys/sciencePublicSurveys.html">large sky surveys</a> (realized by telescopes in Chile). <br />
<br />
The main Stellarium screen (on the left) is used to display shapes in the sky representing the locations where pictures were taken by the telescopes. A special GUI allows to specify a set of contraints defining which data set we are interested in (by default all the data is displayed, yes that's millions of stuff!). For example, a typical query is "show me only the images taken by telescope X for survey Y between date d1 and d2". The results is then displayed graphically and some more contraints can be added in the GUI to continue refining the query.<br />
<br />
There is also the possibility of comparing the result of several queries using a system of layers: one layer per query, and each layer has a different color. This allows to answer some questions such as "What is the percentage of completion of this survey in area?".<br />
<br />
<b>How does it works?</b><br />
Technically, the whole GUI part (on the right) was coded in <a href="http://doc.qt.nokia.com/4.7/qdeclarativeintroduction.html">QML</a> and is actually hosted on the server and downloaded by the client at startup. The queries themselves are computed on the server side and the result are returned as JSON files and displayed graphically on the sky and in the GUI.<br />
<br />
One of the most challenging piece of code done for this project is a library for computing the intersection and union of spherical polygons. As far as I know Stellarium's code contains the only <a href="http://en.wikipedia.org/wiki/Spherical_geometry">spherical geometry</a> library capable of managing spherical polygons which are non-convex (i.e. with holes or strange shapes) and potentially larger than 180° (i.e. larger than a half sphere). It is on my TODO list to write another post about that.<br />
<br />
<br />
<b>What's next?</b><br />
Now that me and Diego left ESO, there is currently no maintainer for SVMT. However, the code is entirely open source (GPL license) and its design was done keeping in mind that it should be re-used for other data sets. Please contact me if you have any interest of <a href="http://svmtdemo.hq.eso.org/1.0.1/doc/tuning.html">re-using the code for other purpose</a>.<br />
<br />
<b>For more info</b><br />
Try a <a href="http://svmtdemo.hq.eso.org/">demo version</a> (with public data sets only)<br />
See the project <a href="http://launchpad.net/svmt">Launchpad page</a>.<br />
Have a look at the <a href="http://svmtdemo.hq.eso.org/1.0.1/doc/">Developers Documentation</a>fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com2tag:blogger.com,1999:blog-5451252864018428770.post-81584844837519870312011-05-05T15:04:00.000+02:002011-05-05T15:04:53.012+02:00Looking for a jobAfter spending some months playing with small personal projects, it's now time for me to look for a proper job! For those interested, I just updated my CV [<a href="http://chereau.free.fr/job/cvfab.html">html</a>|<a href="http://chereau.free.fr/job/cv-chereau-fabien.pdf">pdf</a>]. <br />
<br />
Note that I am also available for specific consulting regarding Stellarium or other programming tasks!fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com1tag:blogger.com,1999:blog-5451252864018428770.post-53665619568778321172011-04-15T14:33:00.002+02:002011-05-02T15:17:11.905+02:00RetroCosmos ported to Android<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAKG7Ms1AoKI2EgZbJQGHM8xewBvSCNvYRM0drplioCGUZQuUx1rYiRr-NewvA9jLb3z-wrWj93NE5btWACpIh5tKZG0Wi4ek2MkW2khii6xYfoGqpd0U6Lbfo7XwfPp90AUNdj1s0j5AE/s1600/promoGraphics.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAKG7Ms1AoKI2EgZbJQGHM8xewBvSCNvYRM0drplioCGUZQuUx1rYiRr-NewvA9jLb3z-wrWj93NE5btWACpIh5tKZG0Wi4ek2MkW2khii6xYfoGqpd0U6Lbfo7XwfPp90AUNdj1s0j5AE/s1600/promoGraphics.png" /></a></div>I finally finished to port my new game RetroCosmos to Android! In adition to the standard space invaders features of the Symbian version, the android version features cool vintage sounds I made with my old analog synthesizer (Roland SH-101) as well as a techno music background (also composed by myself!).<br />
<br />
For those who don't own a compatible phone, I just uploaded a youtube video: <br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/erMJGcqaR7k?feature=player_embedded' frameborder='0'></iframe></div><br />
On the development side, it was quite fun to use Java again after some years of Qt/C++ and I was quite impressed by the Android SDK, even though Eclipse feels like a regression after using QtCreator for years.<br />
<br />
The game is now available <a href="https://market.android.com/details?id=com.noctuasoftware.retrocosmos2">for free on the Android Market</a>.<br />
<br />
Follow this link for more info on <a href="http://www.noctua-software.com/retrocosmos">retrocosmos space invaders</a>.<br />
<br />
Have fun!fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com0tag:blogger.com,1999:blog-5451252864018428770.post-21465274507974705712011-03-25T11:03:00.000+01:002011-03-25T11:03:25.331+01:00RetroCosmos on OVI StoreIn the last months I spent some days on creating a little video game called RetroCosmos with the aim of submitting it to the new <a href="http://www.callingallinnovators.com/10M/">Calling All Innovators</a> contest. I coded it using Qt 4.6 and made it run on Symbian. It's now <a href="http://store.ovi.com/content/105285">available (for free) on the OVI store</a>.<br />
<br />
It doesn't use any fancy technology but I really tried hard to make it enjoyable to play, and I am quite satisfied with the result :)<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcALey9GPJKLnsO9zytQBh3bVN-PT_x-SbTky72TrkuKD_ykvzzjIOBsQtTKip2jrxw-l1ET6yq45YVnGV0aLOVZxu1ZYm0s8AlCDUOcB5eisVAgHzU_FIRvblGX4R3CQYrSopzPqWSuO0/s1600/screenshot.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="200" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcALey9GPJKLnsO9zytQBh3bVN-PT_x-SbTky72TrkuKD_ykvzzjIOBsQtTKip2jrxw-l1ET6yq45YVnGV0aLOVZxu1ZYm0s8AlCDUOcB5eisVAgHzU_FIRvblGX4R3CQYrSopzPqWSuO0/s200/screenshot.png" /></a></div>fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com0tag:blogger.com,1999:blog-5451252864018428770.post-58847957907442098092011-02-13T15:16:00.000+01:002012-06-23T15:53:44.461+02:00Management disaster..The news that Nokia is going to use Microsoft OS as its primary developement plateform really makes me sad. As many other developers I feel betrayed, after having spent so much time learning to develop apps for Maemo/Symbian based on Qt.<br />
When I now think about the last 2 years it was pretty obvious that we, developers, couldn't really trust Nokia strategy. I started to get involved with Maemo 5 when I decided to port Stellarium to the N900 after Nokia bought Trolltech. Since then Nokia changed many time its strategy toward apps developers:<br />
<br />
- 2009: Maemo5 and N900 were presented as developers tools. Developers should naturally continue developing the app afterward on Maemo6 which was then annouced as the future of smart phone at Nokia.<br />
- However already at this time, different hints made us understand that finally Nokia will also keep using Symbian for smart phones as well.<br />
- February 2010: Nokia starts MeeGO with Intel and we learnt that "the MeeGo announcement will not affect the Maemo 6 rollout schedule".<br />
- Later we hear "Maemo 6 will be completely compatible with MeeGo, and according to Ari Jaaksi, we even can consider Maemo 6 already a MeeGo instance"<br />
- Finally Maemo6/Harmattan never came, and we learnt that the first MeeGO release will in fact be renamed MeeGo/Harmattan (although both OSes are quite different).<br />
- September 2010: at this point it seems that Nokia refocused again its whole strategy toward Symbian with devices like the N8 (launch of the Calling all Innovators contest for this device only with AT&T in North America).<br />
- November 2010: a bit unrelated but still insightful about the consistency of the Nokia management: we learn that "Nokia is partnering with Yahoo! to power and improve your Ovi Chat experience in the coming months"<br />
- Feb 2011: Now that it finally becomes reasonably easy to develop for Symbian/Maemo/MeeGO using Qt and QtCreator and that developers like me start to feel hope, Nokia decides to move to Microsoft and it's SDK.<br />
<br />
So much strategy changes in the last year! Now let's try to extrapolate a bit this story:<br />
- it is easy to see that the switch to MS SDK and OS will also take at least a year. At the same time Nokia will still support Symbian, Maemo and a new MeeGO device (although I am not sure I should trust Nokia when they claim it's coming).<br />
- I can't prevent thinking that during this Nth transition Nokia is going to continue doing so bad. Share holders will be angry and will ask for more blood, and Nokia will again change its strategy. Maybe move to Android?<br />
<br />
At the end, the loosers in this are definitely Nokia R&D and Trolltech employees. As well as all the open source community using Qt.fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com3tag:blogger.com,1999:blog-5451252864018428770.post-7458996073392904702011-02-08T13:24:00.003+01:002011-02-28T21:41:21.858+01:00Chatocracy opens<a href="http://www.chatocracy.com">Chatocracy</a> is my new website which allows people to <a href="http://www.chatocracy.com">find new friends or talk to strangers on the webcam</a>. We tried to make it simple and funny: also, after each conversation you can rate the person you have been talking to; the better ranking you get, the more people you can talk to.<br />
<br />
My brother and me have been working on this for the last few weeks. Propagate the word! It is still beta so if you encounter problems please report it.fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com0tag:blogger.com,1999:blog-5451252864018428770.post-13338561799535807452010-06-02T17:28:00.003+02:002010-06-02T17:32:02.809+02:00Stellarium 0.10.5 finally releasedIt was quite painful, but finally we managed to do it: <a href="http://www.stellarium.org">www.stellarium.org</a>. Excepted many awful font display issues caused apparently by Qt, this release should be one of the most stable ever :)<br /><br />PS: I will post more interesting things in the next days here, so keep up to date!fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com6tag:blogger.com,1999:blog-5451252864018428770.post-88385037251208643782009-05-01T18:21:00.005+02:002009-07-06T11:38:59.160+02:00Spherical geometry optimisations<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin78sTBZF613myeHkhfWRqardDHACkWY2Uxr0Y2M3WiqR_Bg_iYdTN0VU7E4SQ2BuiRnEY82y3JySG4RUpgxHk3CDb5H4qoMvpqZVUNsLMKMkvsH__G6ci-6LR3MKevp1AoJOeWS61QwJh/s1600-h/sphericalCap.png"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 196px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin78sTBZF613myeHkhfWRqardDHACkWY2Uxr0Y2M3WiqR_Bg_iYdTN0VU7E4SQ2BuiRnEY82y3JySG4RUpgxHk3CDb5H4qoMvpqZVUNsLMKMkvsH__G6ci-6LR3MKevp1AoJOeWS61QwJh/s200/sphericalCap.png" alt="" id="BLOGGER_PHOTO_ID_5330894022258470946" border="0" /></a>I am currently working on recoding proper classes for managing spherical geometry primitives in Stellarium. One of the most used primitive is the so called spherical cap showed in the figure. A spherical cap (sometimes called half space) is a disk-like region of the sphere defined by a direction unit vector <span style="font-weight: bold;">n</span> and an aperture angle ⍺.<br /><br />The most common operation that we want to perform on a spherical cap is to check if a point A of the sphere lies inside the cap. This is pretty easy to do by checking whether the dot product <span style="font-weight: bold;">n</span>·<span style="font-weight: bold;">OA</span> is smaller than cos(⍺).<br /><br />The C++ code below implements this. Note that to avoid computing a CPU expensive cosine each time we perform the <span style="font-family:courier new;">contains</span> operation, we pre-compute cos(⍺) and store it as a class member d.<br /><br /><span style=";font-family:courier new;font-size:85%;">class SphericalCap<br />{<br /> bool contains(const Vec3d &v) const {return (v*n>=d);}<br /> Vec3d n;<br /> double d;<br />};</span><br /><br />Another useful operation we want to perform often is to check whether two spherical caps with direction vectors <span style="font-weight: bold;">n1</span> and <span style="font-weight: bold;">n2</span> and aperture ⍺1 and ⍺2 intersect. The st<span style="font-family:georgia;">raightforward implementation is to compute the angle θ between </span><span style="font-weight: bold;font-family:georgia;" >n1</span><span style="font-family:georgia;"> and </span><span style="font-weight: bold;font-family:georgia;" >n2</span><span style="font-family:georgia;"> and check wh</span>ether it is smaller than ⍺1 + ⍺2.<br /><br /><span style=";font-family:courier new;font-size:85%;" >bool intersects(const SphericalCap& other) const<br />{<br /> const double theta = n.angle(other.n);<br /> return theta < acos(d) + acos(other.d);<br />}</span><br /><br />Unfortunately, because we store only the cosine of ⍺1 and ⍺2, this solution involves 2 calls to the acos function, plus 1 call to the angle() function which itself involves 1 acos and 1 sqrt. Needless to say that it's not lightning fast..<br /><br />After some thoughts I finally came up with a solution involving only basic arithmetics: <br><br />First, in the case ⍺1+⍺2 >= 180°, (i.e. if d1+d2<=0) the 2 caps necessarily intersect so we don't need to think further. Let's now treat the other cases:<br /><br />The 2 caps intersect only and only if:<br /><br />θ <= ⍺1+⍺2 (1)<br /><br />Because both members of (1) are < 180° (the angle θ between <b>n1</b> and <b>n2</b> can obviously not be > 180°), we can transform (1) into:<br /><br />cos (θ) >= cos(⍺1+⍺2)<br /><br />which with basic trigo can be transformed into:<br /><br />L <= sin ⍺1 sin ⍺2 , with L = cos ⍺1 cos ⍺2 - cos θ (2)<br /><br />In our case L is known and given by d1*d2-<b>n1·n2</b>. Because ⍺1 and ⍺2 are bounded between 0° and 180°, sin ⍺1 sin ⍺2 is bounded between 0 and 1. Therefore if L<=0, (2) is verified and the 2 caps intersect. Similarily, if L>1, (2) is not verified and the 2 caps don't intersect. In the last case where 0<L<=1 we can transform (2) into:<br /><br />L² <= sin²⍺1 sin²⍺2<br /><br />which with basic trigo formulae can be transformed into:<br /><br />L² <= (1-cos²⍺1)(1-cos²⍺2) (3)<br /><br />In our case cos²⍺1 and cos²⍺2 are know and given by d1² and d2² so we can easily check that (3) is verified or not.<br /><br />We thus have a solution to each cases, and none of them involve any CPU expensive operation!! In C++ code, this reasoning translates into:<br /><br /><span style=";font-family:courier new;font-size:85%;" >bool intersects(const SphericalCap& other) const<br />{<br /> const double L = d*other.d - n*other.n;<br /> return d+other.d<=0. || L<=0. || (L<=1. && L*L <= (1.-d*d)*(1.-other.d*other.d));<br />}</span>fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com1tag:blogger.com,1999:blog-5451252864018428770.post-22590897774562758762009-05-01T16:08:00.000+02:002009-05-01T16:23:57.485+02:00First post!Et hop!<br />I finally open a blog. In this blog I will post whatever I feel like writing, but I guess the main subjects will be technical about my project <a href="http://www.stellarium.org/">Stellarium</a>.<br />Actually the idea of creating a blog was suggested by a friend after I proudly explained to him how I optimized a small spherical geometry method in Stellarium.. So I guess with topic will be my first real post.fab1http://www.blogger.com/profile/01463177955419672228noreply@blogger.com3