Code Monkey home page Code Monkey logo

starrynight's Introduction

Header image

StarryNight

Language License: GPL v3 Carthage compatible Build Status

Overview

StarryNight is all you need for curiosity towards stars and constellations.

  • Database of 15000+ stars within 7th magnitude.
    • Star Catalogs including HR, HD, HIP, Gould and Bayer-Flamsteed designations.
    • Celestial coordinate and proper motion.
    • Visual and absolute magnitude, luminance, spectral type, binary star info, and other physical properties.
  • Extended Constellation support.
    • Position query and inverse position query.
    • Constellation line and constellation border.
    • Abbreviation, genitive and etymology.

Installation

Carthage

github "DJBen/StarryNight" ~> 0.3.0

Usage

Stars

  1. All stars brighter than...
Star.magitudeLessThan(7)
  1. Star with specific designation.
Star.hr(9077)
Star.hd(224750)
Star.hip(25)
  1. Star closest to specific celestial coordinate.

This is very useful to locate the closest star to user input.

let coord = Vector3.init(equatorialCoordinate: EquatorialCoordinate.init(rightAscension: radians(hours: 5, minutes: 20), declination: radians(degrees: 10), distance: 1)).normalized()
Star.closest(to: coord, maximumMagnitude: 2.5)
// Bellatrix

Constellations

  1. Constellation with name or IAU symbol.
Constellation.iau("Tau")
Constellation.named("Orion")
  1. Constellation that contains specific celestial coordinate.

This is very useful to locate the constellation that contains the region of user input.

It is implemented as a category on EquatorialCoordinate. See SpaceTime repo for implementation and usage of coordinate classes.

let coord = EquatorialCoordinate.init(rightAscension: 1.547, declination: 0.129, distance: 1)
coord.constellation
// Orion
  1. Neighboring constellations and centers.
// Get a set of neighboring constellations
Constellation.iau("Ori").neighbors
// Get the coordinate of center(s) of current constellation
Constellation.iau("Ori").displayCenters

Note: displayCenters returns an array of one element for all constellations except Serpens, which will include two elements - one center for Serpens Caput and the other for Serpens Cauda.

Remarks

Data extracted from HYG database and processed into SQLite. The star catalog has been trimmed to 7th magnitude to reduce file size. Feel free to download the full catalog and import into SQLite whenever you see fit.

starrynight's People

Contributors

djben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

starrynight's Issues

not an issue - question on rendering constellation lines.

firstly, thanks so much for all your efforts here - it's an amazing library. Kudos

I threw this crude method together - and it does draw stars into scene.
my problem is getting the lines to appear as if they are in a dome -

cosmographia app from nasa - https://github.com/claurel/cosmographia
screen shot 2018-02-20 at 11 10 51 am
as opposed to floating around in the scene. the lines are appearing to point into the earth.

Any suggestions? I was thinking just make all the z dimensions hard coded to a value really far away.

    func addStars(){
        
        let stars = Star.magitudeLessThan(7)
        for star in stars{
            let scnText = TextNode(star.identity.properName ?? "")
            scnText.position = SCNVector3( star.physicalInfo.coordinate)
            constellationLines.addChildNode(scnText)
            
            let starNode = SCNNode(geometry: SCNSphere(radius: 0.01))
            starNode.geometry?.firstMaterial?.diffuse.contents = UIImage(named:"spark.png")
            starNode.position = SCNVector3( star.physicalInfo.coordinate)
            constellationLines.addChildNode(starNode)
        }
        //lines + names
        for constellation in Constellation.all{
            let scnText = TextNode(constellation.name )
            scnText.font = UIFont.systemFont(ofSize: 0.2)
            scnText.color = .red
            if let center = constellation.displayCenter{
                scnText.position = SCNVector3(center) * 10
                constellationLines.addChildNode(scnText)
            }
            
            
            for (_,line) in constellation.connectionLines.enumerated(){
                let line = SCNNode.lineNode(from: SCNVector3( line.star1.physicalInfo.coordinate), to: SCNVector3(line.star2.physicalInfo.coordinate))
                constellationLines.addChildNode(line)
            }
        }
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.