Trouble compiling code win7 32 bit.

sunwukong <[email protected]>
Newsgroups gmane.comp.gnu.mingw.user
Message-ID <[email protected]>
I have found some code to solve a surveying problem that I have. 
Finding the coordinates where a ray or second line will cross a target 
line defined by two end points.

I have installed mingw on my hard drive.  And it seems to be trying but 
failing.  I am unsure of what the header lines that are commented out 
do.  I am assuming that
g++ calls the compile
-o intercept is telling g++ to put the output (.exe) file into
-I/user/local tells g++ where to get the input file of intercept.cpp
  -LGeographic -Wl.-rpoath=/usr/local/lib tells g++ to look in 
/usr/local/lib with the option -Wl. (????)

Is it polite /proper to ask someone to compile this to a win32 .exe file 
so I can try to see if it gives good results.

Would this even work on my computer? If my installation of the Lib fils 
are not "standard" in some obtuse way?

I have tried several versions of less powerfull code found on

https://rosettacode.org/wiki/Find_the_intersection_of_a_line_with_a_plane

and every option i have tried "C", GWBasic, UBasic, and VBA all give 
roughly the same (wrong) results.

Is there a manual of the compile (in Win / DOS command wiondow)?  I've 
found some brief "how-to" files but they do not answer my questions.

VR [email protected]

************** code to compile ************
***** the author of this code is very kind and helpfull **** but it 
seems he has suffered some medical issues and *** is not able to help at 
this time


// Find intersection of two geodesics
// Compile with, e.g.,
// g++ -o intercept -I/usr/local intercept.cpp \
//    -lGeographic -Wl,-rpath=/usr/local/lib

#include <iostream>
#include <iomanip>
#include <C:\mingw\bin\Gnomonic.hpp>
#include <C:\mingw\bin\Geodesic.hpp>

class vector3 {
public:
   double _x, _y, _z;
   vector3(double x, double y, double z = 1) throw()
     : _x(x)
     , _y(y)
     , _z(z) {}
   vector3 cross(const vector3& b) const throw() {
     return vector3(_y * b._z - _z * b._y,
                    _z * b._x - _x * b._z,
                    _x * b._y - _y * b._x);
   }
   void norm() throw() {
     _x /= _z;
     _y /= _z;
     _z = 1;
   }
};

int main() {
   double lata1, lona1, lata2, lona2;
   double latb1, lonb1;
   std::cin >> lata1 >> lona1 >> lata2 >> lona2
            >> latb1 >> lonb1;
   const GeographicLib::Geodesic
     geod(GeographicLib::Constants::WGS84_a(),
          GeographicLib::Constants::WGS84_f());
   const GeographicLib::Gnomonic gn(geod);
   double
     lat0 = (lata1 + lata2)/2,
     // Possibly need to deal with longitudes wrapping around
     lon0 = (lona1 + lona2)/2;
   std::cout << std::setprecision(16);
   std::cout << "Initial guess " << lat0 << " " << lon0 << "\n";
   for (int i = 0; i < 10; ++i) {
     double xa1, ya1, xa2, ya2;
     double xb1, yb1;
     gn.Forward(lat0, lon0, lata1, lona1, xa1, ya1);
     gn.Forward(lat0, lon0, lata2, lona2, xa2, ya2);
     gn.Forward(lat0, lon0, latb1, lonb1, xb1, yb1);
     // See Hartley and Zisserman, Multiple View Geometry, Sec. 2.2.1
     vector3 va1(xa1, ya1); vector3 va2(xa2, ya2);
     // la is homogeneous representation of line A1,A2
     vector3 la = va1.cross(va2);
     vector3 vb1(xb1, yb1);
     // lb is homogeneous representation of line thru B1 perpendicular to la
     vector3 lb(la._y, -la._x, la._x * yb1 - la._y * xb1);
     // p0 is homogeneous representation of intersection of la and lb
     vector3 p0 = la.cross(lb);
     p0.norm();
     double lat1, lon1;
     gn.Reverse(lat0, lon0, p0._x, p0._y, lat1, lon1);
     std::cout << "Increment " << lat1-lat0 << " " << lon1-lon0 << "\n";
     lat0 = lat1;
     lon0 = lon1;
   }
   std::cout  << "Final result " << lat0 << " " << lon0 << "\n";
   double azi1, azi2;
   geod.Inverse(lat0, lon0, lata1, lona1, azi1, azi2);
   std::cout << "Azimuth to A1 " << azi1 << "\n";
   geod.Inverse(lat0, lon0, lata2, lona2, azi1, azi2);
   std::cout << "Azimuth to A2 " << azi1 << "\n";
   geod.Inverse(lat0, lon0, latb1, lonb1, azi1, azi2);
   std::cout << "Azimuth to B1 " << azi1 << "\n";
}

************* end code *************

_______________________________________________
MinGW-Users mailing list
[email protected]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.osdn.me/mailman/listinfo/mingw-users
Also: mailto:[email protected]?subject=unsubscribe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.