{"id":17,"date":"2022-11-29T05:54:43","date_gmt":"2022-11-29T05:54:43","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/robrouleau\/?p=17"},"modified":"2022-11-29T05:54:43","modified_gmt":"2022-11-29T05:54:43","slug":"creating-the-stars","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/robrouleau\/2022\/11\/29\/creating-the-stars\/","title":{"rendered":"Creating the Stars"},"content":{"rendered":"\n<p>The fall term is quickly coming to end, and our team has finished the final version of our design document. With that done, we have focused our full attention on v0.0.2, the final assignment of the term. For this iteration, I am working on implementing a feature that allows the user to see where stars and constellations are relative to their position in the environment. This process consists of gathering real positional data for each star from the SIMBAD astronomical database, maintained by the <a rel=\"noreferrer noopener\" href=\"https:\/\/en.wikipedia.org\/wiki\/Centre_de_donn%C3%A9es_astronomiques_de_Strasbourg\" target=\"_blank\">Centre de donn\u00e9es astronomiques de Strasbourg (CDS)<\/a>. Then the data is used to spawn each individual star in the constellation within a Bevy application. Below I will walk you through the process of creating a prototype for this feature, where real positional data is used to spawn stars belonging to the Andromeda constellation.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Gathering the Data<\/h5>\n\n\n\n<p>The first step is to gather the data for the constellation using data available through the IAU. The database is queried for each star by identifier.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"988\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/AND.gif\" alt=\"\" class=\"wp-image-18\" \/><figcaption class=\"wp-element-caption\">Andromeda &#8211; source: https:\/\/www.iau.org\/public\/themes\/constellations\/<\/figcaption><\/figure>\n\n\n\n<p>The identifier used in the query is flexible. A query for &#8220;Almach&#8221;, &#8220;\u03b3 and&#8221;, or &#8220;gam and&#8221; will all return the data for Gamma Andromedae (<a href=\"http:\/\/simbad.cds.unistra.fr\/simbad\/sim-id?Ident=%CE%B3+And&amp;submit=submit+id\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/simbad.cds.unistra.fr\/simbad\/sim-id?Ident=%CE%B3+And&amp;submit=submit+id<\/a>).<\/p>\n\n\n\n<p>On this page, we are interested in the Right Ascension, Declination, and Parallax. With these measurements we can determine where to place the star using Cartesian coordinates.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"514\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-210252-1024x514.png\" alt=\"\" class=\"wp-image-19\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-210252-1024x514.png 1024w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-210252-300x150.png 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-210252-768x385.png 768w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-210252-1536x770.png 1536w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-210252.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">The page for Gamma Andromedae with the measurements we are interested in circled in red. <\/figcaption><\/figure>\n\n\n\n<p>This data is compiled in an excel sheet where calculations are done to convert the right ascension, declination, and parallax into xyz-coordinates. First the right ascension is converted from hours, minutes, seconds into degrees. Next the declination is converted from degrees, minutes, seconds into degrees. Finally, the parallax is converted from milliarc-seconds (mas) to parsecs. Once these units are converted, we can calculate the xyz-coordinates using trigonometry.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"610\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-211629-1024x610.png\" alt=\"\" class=\"wp-image-20\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-211629-1024x610.png 1024w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-211629-300x179.png 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-211629-768x457.png 768w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-211629.png 1350w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Positional data for stars in the Andromeda constellation.<\/figcaption><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Andromeda in bevy<\/h5>\n\n\n\n<p>Now that we have coordinates for each star in the constellation, we can create a system to spawn those stars in the environment. Each star will be spawned with a DirectionalLightBundle and a PbrBundle. In an new *.rs file we create a public function that takes commands, meshes, and materials as parameters. The spawn method is called to create the DirectionalLightBundle and PbrBundle at the coordinates from excel.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"894\" height=\"391\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-212815.png\" alt=\"\" class=\"wp-image-21\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-212815.png 894w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-212815-300x131.png 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/6229\/files\/2022\/11\/Screenshot-2022-11-28-212815-768x336.png 768w\" sizes=\"auto, (max-width: 894px) 100vw, 894px\" \/><figcaption class=\"wp-element-caption\">The coordinates from excel are inserted into the arguments for Transform::from_xyz( ) in the transform fields.<\/figcaption><\/figure>\n\n\n\n<p>This function is completed for the remaining stars in the excel file. In a separate file, main.rs, we call this system using add_startup_system( ). For the purposes of prototyping, a 3D camera is included from the crate <a rel=\"noreferrer noopener\" href=\"https:\/\/crates.io\/crates\/smooth-bevy-cameras\" target=\"_blank\">smooth_bevy_cameras<\/a>. The end result is an application that allows a user to fly around our constellation.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Andromeda in Bevy\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/Jo9ZSoUv6nY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Looking ahead<\/h5>\n\n\n\n<p>Creating this prototype helped me get a grasp on how it will look when stars are positioned using this process. From this point, I want to include the lines between stars that are familiar to anyone who has searched for an image of constellations. This will help make it easier to identify the constellation. The user will be able to show or hide these lines. Then the 3D models for the stars will be created and used in place of the icospheres in this prototype.<\/p>\n\n\n\n<p>This was a look into the development process of Space Atlas. Stay tuned for more!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The fall term is quickly coming to end, and our team has finished the final version of our design document. With that done, we have focused our full attention on v0.0.2, the final assignment of the term. For this iteration, I am working on implementing a feature that allows the user to see where stars [&hellip;]<\/p>\n","protected":false},"author":12988,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/users\/12988"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/comments?post=17"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":22,"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/posts\/17\/revisions\/22"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/media?parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/categories?post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/robrouleau\/wp-json\/wp\/v2\/tags?post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}