Index: trunk/BNC/bncpppclient.cpp
===================================================================
--- trunk/BNC/bncpppclient.cpp	(revision 2042)
+++ trunk/BNC/bncpppclient.cpp	(revision 2043)
@@ -43,4 +43,5 @@
 
 #include "bncpppclient.h"
+#include "bncutils.h"
 
 extern "C" {
@@ -154,4 +155,5 @@
       }
       cc->tt.set(GPSweek, GPSweeks);
+      cc->rao.ReSize(3);
       in >> cc->iod >> cc->dClk >> cc->rao[0] >> cc->rao[1] >> cc->rao[2];
     }
@@ -190,4 +192,7 @@
 void bncPPPclient::applyCorr(const t_corr* cc, ColumnVector& xc, 
                              ColumnVector& vv) {
+  ColumnVector dx(3);
+  RSW_to_XYZ(xc.Rows(1,3), vv, cc->rao, dx);
+
 
 }
Index: trunk/BNC/bncutils.cpp
===================================================================
--- trunk/BNC/bncutils.cpp	(revision 2042)
+++ trunk/BNC/bncutils.cpp	(revision 2043)
@@ -168,2 +168,19 @@
   return gga.toAscii();
 }
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void RSW_to_XYZ(const ColumnVector& rr, const ColumnVector& vv,
+                const ColumnVector& rsw, ColumnVector& xyz) {
+
+  ColumnVector along  = vv / vv.norm_Frobenius();
+  ColumnVector cross  = crossproduct(rr, vv); cross /= cross.norm_Frobenius();
+  ColumnVector radial = crossproduct(along, cross);
+
+  Matrix RR(3,3);
+  RR.Column(1) = radial;
+  RR.Column(2) = along;
+  RR.Column(3) = cross;
+
+  xyz = RR * rsw;
+}
Index: trunk/BNC/bncutils.h
===================================================================
--- trunk/BNC/bncutils.h	(revision 2042)
+++ trunk/BNC/bncutils.h	(revision 2043)
@@ -29,4 +29,6 @@
 #include <QDateTime>
 
+#include <newmat.h>
+
 void expandEnvVar(QString& str);
 
@@ -41,3 +43,6 @@
                      const QByteArray& height);
 
+void RSW_to_XYZ(const ColumnVector& rr, const ColumnVector& vv,
+                const ColumnVector& rsw, ColumnVector& xyz);
+
 #endif
