gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master da96172 2/2: Warp: --align option now works wi


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master da96172 2/2: Warp: --align option now works with 90-deg rotated images
Date: Sat, 30 Nov 2019 13:45:33 -0500 (EST)

branch: master
commit da9617252239c0317d23a4162486ef372a45ae05
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Warp: --align option now works with 90-deg rotated images
    
    Until now, when the WCS matrix of an input image looked something like
    below (the diagonal elements being zero), Warp would abort, complaining
    about `nan' elements in the rotation matrix. This would happen because the
    generic algorithm to find the proper rotation matrix would fail when the
    diagonal elements were zero.
    
    With this commit, a special case has been added to deal with such cases
    without producing NaN elements.
    
    Example WCS PC matrix:
    PC1_1   =  0.00000000000000E+00
    PC1_2   =  1.00000000000000E+00
    PC2_1   = -1.00000000000000E+00
    PC2_2   =  0.00000000000000E+00
---
 bin/warp/ui.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bin/warp/ui.c b/bin/warp/ui.c
index 2a95287..0c0cdf6 100644
--- a/bin/warp/ui.c
+++ b/bin/warp/ui.c
@@ -527,6 +527,13 @@ ui_matrix_make_align(struct warpparams *p, double *tmatrix)
       x[2] = 0.0f;
       x[3] = w[3]>0 ? 1.0f : -1.0f;  /* Has to be positive. */
     }
+  else if (w[0]==0.0f && w[3]==0.0f )
+    {
+      x[0] = 0.0f;
+      x[1] = w[1]<0 ? 1.0f : -1.0f;  /* Has to be negative. */
+      x[2] = w[2]>0 ? 1.0f : -1.0f;  /* Has to be positive. */
+      x[3] = 0.0f;
+    }
   else
     {
       A = (w[3]/w[1]) - (w[2]/w[0]);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]