[Kstars-devel] KDE/kdeedu/kstars/kstars

Akarsh Simha akarshsimha at gmail.com
Thu Jan 15 19:17:38 CET 2009


SVN commit 911596 by asimha:

Use the 3:2 aspect ratio (which is the usual case with DSLRs and Film)
for calculating the FOV of a camera.

CCMAIL: kstars-devel at kde.org
CCBUG: 132766



 M  +9 -4      fovdialog.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/fovdialog.cpp #911595:911596
@@ -243,10 +243,16 @@
 }
 
 void NewFOV::slotComputeFOV() {
-    if ( sender() == ui->ComputeEyeFOV && ui->TLength1->value() > 0.0 )
+    if ( sender() == ui->ComputeEyeFOV && ui->TLength1->value() > 0.0 ) {
         ui->FOVEditX->setText( QString::number( (double) ui->EyeFOV->value() * ui->EyeLength->value() / ui->TLength1->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
-    else if ( sender() == ui->ComputeCameraFOV && ui->TLength2->value() > 0.0 )
-        ui->FOVEditX->setText( QString::number( (double) ui->ChipSize->value() * 3438.0 / ui->TLength2->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
+        ui->FOVEditY->setText( ui->FOVEditX->text() );
+    }
+    else if ( sender() == ui->ComputeCameraFOV && ui->TLength2->value() > 0.0 ) {
+        double sx = (double) ui->ChipSize->value() * 3438.0 / ui->TLength2->value();
+        const double aspectratio = 3.0/2.0; // Use the default aspect ratio for DSLRs / Film (i.e. 3:2)
+        ui->FOVEditX->setText( QString::number( sx, 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
+        ui->FOVEditY->setText( QString::number( sx / aspectratio, 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
+    }
     else if ( sender() == ui->ComputeHPBW && ui->RTDiameter->value() > 0.0 && ui->WaveLength->value() > 0.0 ) {
         ui->FOVEditX->setText( QString::number( (double) 34.34 * 1.2 * ui->WaveLength->value() / ui->RTDiameter->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
         // Beam width for an antenna is usually a circle on the sky.
@@ -254,7 +260,6 @@
         ui->FOVEditY->setText( ui->FOVEditX->text() );
         slotUpdateFOV();
     }
-    ui->FOVEditY->setText( ui->FOVEditX->text() );
 }
 
 unsigned int FOVDialog::currentItem() const { return fov->FOVListBox->currentRow(); }


More information about the Kstars-devel mailing list