star_to_point Subroutine

private pure subroutine star_to_point(ra, dec, mag, ci, dir, rgb, size)

A star's direction, color (from its B-V color index: Ballesteros' temperature, then Tanner Helland's temperature to RGB) and raw size (OpenFrames' SkySphere::StarToPoint).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: ra

right ascension and declination (radians)

real(kind=wp), intent(in) :: dec

right ascension and declination (radians)

real(kind=wp), intent(in) :: mag

apparent magnitude and B-V color index

real(kind=wp), intent(in) :: ci

apparent magnitude and B-V color index

real(kind=wp), intent(out) :: dir(3)

unit vector

real(kind=wp), intent(out) :: rgb(3)

color (0 to 1)

real(kind=wp), intent(out) :: size

raw size (as raw_size)


Calls

proc~~star_to_point~~CallsGraph proc~star_to_point star_to_point proc~raw_size raw_size proc~star_to_point->proc~raw_size

Called by

proc~~star_to_point~~CalledByGraph proc~star_to_point star_to_point proc~read_stars read_stars proc~read_stars->proc~star_to_point proc~set_star_data SkySphere%set_star_data proc~set_star_data->proc~read_stars

Source Code

    pure subroutine star_to_point(ra, dec, mag, ci, dir, rgb, size)
        real(wp), intent(in) :: ra, dec                     !! right ascension and declination (radians)
        real(wp), intent(in) :: mag, ci                     !! apparent magnitude and B-V color index
        real(wp), intent(out) :: dir(3)                     !! unit vector
        real(wp), intent(out) :: rgb(3)                     !! color (0 to 1)
        real(wp), intent(out) :: size                       !! raw size (as raw_size)
        real(wp) :: t
        dir = [cos(ra) * cos(dec), sin(ra) * cos(dec), sin(dec)]
        size = raw_size(mag)
        t = 0.01_wp * 4600.0_wp * (1.0_wp / (0.92_wp * ci + 1.7_wp) + 1.0_wp / (0.92_wp * ci + 0.62_wp))
        if (t <= 66.0_wp) then
            rgb(1) = 255.0_wp
            rgb(2) = 99.4708025861_wp * log(t) - 161.1195681661_wp
        else
            rgb(1) = 329.698727446_wp * (t - 60.0_wp)**(-0.1332047592_wp)
            rgb(2) = 288.1221695283_wp * (t - 60.0_wp)**(-0.0755148492_wp)
        end if
        if (t >= 66.0_wp) then
            rgb(3) = 255.0_wp
        else if (t <= 19.0_wp) then
            rgb(3) = 0.0_wp
        else
            rgb(3) = 138.5177312231_wp * log(t - 10.0_wp) - 305.0447927307_wp
        end if
        rgb = max(0.0_wp, min(255.0_wp, rgb)) / 255.0_wp
    end subroutine star_to_point