[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kstars-devel
Subject:    [Kstars-devel] Fwd: KDE/kdeedu/kstars/kstars
From:       Jason Harris <jharris () 30doradus ! org>
Date:       2007-11-04 18:46:37
Message-ID: 200711041146.37616.jharris () 30doradus ! org
[Download RAW message or body]

forgot to CCMAIL...

["forwarded message" (message/rfc822)]

X-Spam-Checker-Version: SpamAssassin 3.2.0-gr1 (2007-05-01) on
	bender.robots.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=no
	version=3.2.0-gr1
Delivered-To: jharris@30doradus.org
Received: by 10.115.73.10 with SMTP id a10cs340857wal;
        Sun, 4 Nov 2007 08:09:06 -0800 (PST)
Received: by 10.141.51.15 with SMTP id d15mr1911841rvk.1194192544960;
        Sun, 04 Nov 2007 08:09:04 -0800 (PST)
Return-Path: <commitfilter@new.kstuff.org>
Received: from kdeget.osuosl.org (kdeget.osuosl.org [140.211.166.77])
        by mx.google.com with ESMTP id b8si10057954rvf.2007.11.04.08.08.58;
        Sun, 04 Nov 2007 08:09:04 -0800 (PST)
Received-SPF: neutral (google.com: 140.211.166.77 is neither permitted nor denied by \
best guess record for domain of commitfilter@new.kstuff.org) \
                client-ip=140.211.166.77;
Authentication-Results: mx.google.com; spf=neutral (google.com: 140.211.166.77 is \
neither permitted nor denied by best guess record for domain of \
                commitfilter@new.kstuff.org) smtp.mail=commitfilter@new.kstuff.org
Received: from ktown.kde.org ([131.246.120.250])
	by kdeget.osuosl.org with smtp (Exim 4.50)
	id 1Ioi28-0005ve-9l
	for commitfilter@new.kstuff.org; Sun, 04 Nov 2007 16:09:08 +0000
Received: (qmail 6685 invoked by uid 72); 4 Nov 2007 16:08:37 -0000
Received: (qmail 6607 invoked from network); 4 Nov 2007 16:08:34 -0000
Received: from unknown (HELO office.kde.org) (195.135.221.67)
	by ktown.kde.org with SMTP; 4 Nov 2007 16:08:33 -0000
Received: from svn.kde.org (localhost [127.0.0.1])
	by office.kde.org (Postfix) with SMTP id EB81458D
	for <kde-commits@kde.org>; Sun,  4 Nov 2007 17:08:31 +0100 (CET)
Received: (nullmailer pid 20129 invoked by uid 30);
	Sun, 04 Nov 2007 16:08:31 -0000
From: Jason Harris <kstars@30doradus.org>
To: kde-commits@kde.org
Subject: KDE/kdeedu/kstars/kstars
X-Commit-Directories: (0) trunk/KDE/kdeedu/kstars/kstars
MIME-Version: 1.0
Content-Type: text/plain;
  charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: Sun, 04 Nov 2007 16:08:31 +0000
Message-Id: <1194192511.736918.20128.nullmailer@svn.kde.org>
X-BeenThere: kde-commits@kde.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: kde-commits@kde.org
List-Id: Notification of KDE commits <kde-commits.kde.org>
List-Unsubscribe: <https://mail.kde.org/mailman/listinfo/kde-commits>,
	<mailto:kde-commits-request@kde.org?subject=unsubscribe>
List-Post: <mailto:kde-commits@kde.org>
List-Help: <mailto:kde-commits-request@kde.org?subject=help>
List-Subscribe: <https://mail.kde.org/mailman/listinfo/kde-commits>,
	<mailto:kde-commits-request@kde.org?subject=subscribe>
X-UID: 

SVN commit 732725 by harris:

Linear interpolation for refraction correction.

We use a lookup table to determine the correction due to atmospheric
refraction for an object's apparent altitude as a function of its true
altitude.  Until now, we adopted the correction value from the nearest
altitude position in the lookup table.  This breaks down near the
horizon because the correction changes rapidly with altitude,
resulting in large discontinuous "jumps" as an object's altitude
carries it between positions in the lookup table.

Now, we are using linear inerpolation to ensure that the refraction
correction is a smooth function of the true altitude.

TODO: doing linear interpolation is more costly than a straight table
lookup.  It might make sense to only interpolate near the horizon,
where the corrections are large and changing rapidly with altitude.
The straight-lookup strategy should be fine above some threshhold
altitude.



 M  +16 -5     skymap.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #732724:732725
@@ -1370,14 +1370,25 @@
     if ( alt->Degrees() <= -2.000 ) return dms( alt->Degrees() );
 
     int index = int( ( alt->Degrees() + 2.0 )*2. );  //RefractCorr arrays start at \
                alt=-2.0 degrees.
-    dms result;
+    int index2( index + 1 );
 
-    if ( findApparent ) {
-        result.setD( alt->Degrees() + RefractCorr1[index] );
-    } else {
-        result.setD( alt->Degrees() + RefractCorr2[index] );
+    //compute dx, normalized distance from nearest position in lookup table
+    double x1 = 0.5*float(index) - 1.75;
+    if ( alt->Degrees()<x1 ) index2 = index - 1;
+    if ( index2 < 0 ) index2 = index + 1;
+    if ( index2 > 183 ) index2 = index - 1;
+    double x2 = 0.5*float(index2) - 1.75;
+    double dx = (alt->Degrees() - x1)/(x2 - x1);
+
+    double y1 = RefractCorr1[index];
+    double y2 = RefractCorr1[index2];
+    if ( !findApparent ) {
+        y1 = RefractCorr2[index];
+        y2 = RefractCorr2[index2];
     }
 
+    //linear interpolation to find refracted altitude
+    dms result( alt->Degrees() + y2*dx + y1*(1.0-dx) );
     return result;
 }
 



_______________________________________________
Kstars-devel mailing list
Kstars-devel@kde.org
https://mail.kde.org/mailman/listinfo/kstars-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic