Star Selection Part 2

By
Dave
2011
Apr
16
11:50
Posted in

In the part 1 I descrbed an approach for picking stars using a reticle. I wanted to extend this approach to include other objects such as deep-sky objects, planets etc. Background stars have the advantage of being point sources, and selecting a nearby background star is shown in Figure 1.

Reticle for star selection

Figure 1. Reticle selecting the nearest star.

When non-point sources are involved, an intersection test is required and the item is selected if there are no other point sources within a minimum distance, or if the reticle is closer to the center of the non-point source than any other item. The object is highlighted using a rectangular border, as shown below in Figure 2 for M31.

Reticle for deep sky object

Figure 2. Reticle selecting a deep sky object by intersection.

Deep-sky objects of less than a minimum size in the current field of view are treated similarly to point sources such as background stars (selected based on a minimum distance and highlighted using a circle and marker line), as shown below in Figure 3 for M32.

Reticle for deep sky object

Figure 3. Reticle selecting a deep sky object of less than a minimum size.

Vanity URLs

By
Dave
2011
Apr
15
11:31
Posted in

The category controller currently uses the following URL structure:

http://{domain}/blog/category/{slug1}

It is often useful for URLs to be more concise, for example when adding a caption to a video. In such cases "vanity URLs" are often used. I've updated the blog categories to enable them to support a vanity URL, currently based on the category slug, as follows:

http://{domain}/blog/{slug}

The approach I took was to inject specific entries into the MVC routing table. Clearly this wouldn't be sensible for large numbers of entries, but the number of blog cetegories should be relatively small, and not every category has to have one. An added complication is that whenever I add, update, or delete a category I may need to regenerate the routing table to support adding/removing vanity URLs. I add the enries as follows:

foreach (Category category in new BlogService().ListCategories())
   if (category.VanityUrl)
      routes.MapRoute(category.Slug, category.Slug, new { controller = "Archive", action = "CategoryIndex", name = category.Slug });

Listing 1. Adding vanity URLs to MVC route table

1 A slug is a "friendly" URL (both from an SEO and human-perspective), using characters which do not require HTML-encoding (e.g. dashes instead of spaces)

Star Selection

By
Dave
2011
Apr
09
16:28
Posted in

I wanted to be able to select individual stars for further information. In order to do fast lookups of stars near to a cursor or reticle I added a further spatial index to my background stars. Due to the inaccuracies of using right-ascension and declination near to the celestial poles, I used an indexing scheme based on cartesian coordinates. A screenshot is shown below in Figure 1.

Reticle for star selection

Figure 1. Reticle for star selection. Note that the reticle is shown at 2x scale for clarity.

More information on the star is shown after a configurable delay, and hidden when the reticle is no longer focussed on the object. This avoids rendering data when it is not required, and allows higher-latency data (such as from the internet) to be shown when ready. Going forward, I should consider a hierarchical indexing scheme such as a Hierarchical Triangular Mesh1, which would give me the ability to find the nearest star at a given level of resolution.

1 "Indexing the Sphere with the Hierarchical Triangular Mesh", Alexander S. Szalay, Jim Gray, George Fekete, Peter Z. Kunszt, Peter Kukol, and Ani Thakar, August 2005