Update of /cvsroot/csp/APPLICATIONS/SimData/Source In directory sc8-pr-cvs1:/tmp/cvs-serv7999/Source Modified Files: Tag: b0_4_0 DataArchive.cpp Date.cpp GeoPos.cpp Interpolate.cpp LUT.cpp Matrix3.cpp Quat.cpp Log Message: Index: DataArchive.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/DataArchive.cpp,v retrieving revision 1.15.2.2 retrieving revision 1.15.2.3 diff -C2 -d -r1.15.2.2 -r1.15.2.3 *** DataArchive.cpp 18 Sep 2003 00:27:38 -0000 1.15.2.2 --- DataArchive.cpp 18 Sep 2003 02:09:49 -0000 1.15.2.3 *************** *** 131,142 **** while (n_directories-- > 0) { ObjectID node = *hptr++; ! uint32 n = hptr->a; ++hptr; ! if (n > n_paths) { throw CorruptArchive("Path table of contents."); } std::vector<ObjectID> &childlist = _children[node]; ! childlist.reserve(n); ! while (n-- > 0) { childlist.push_back(*hptr++); } --- 131,142 ---- while (n_directories-- > 0) { ObjectID node = *hptr++; ! uint32 n_children = hptr->a; ++hptr; ! if (n_children > n_paths) { throw CorruptArchive("Path table of contents."); } std::vector<ObjectID> &childlist = _children[node]; ! childlist.reserve(n_children); ! while (n_children-- > 0) { childlist.push_back(*hptr++); } *************** *** 181,187 **** fwrite(&size, sizeof(size), 1, _f); for (iter = _children.begin(); iter != _children.end(); iter++) { ! ObjectID size = iter->second.size(); fwrite(&(iter->first), sizeof(ObjectID), 1, _f); ! fwrite(&size, sizeof(size), 1, _f); std::vector<ObjectID>::const_iterator child = iter->second.begin(); std::vector<ObjectID>::const_iterator last_child = iter->second.end(); --- 181,187 ---- fwrite(&size, sizeof(size), 1, _f); for (iter = _children.begin(); iter != _children.end(); iter++) { ! ObjectID n_children = iter->second.size(); fwrite(&(iter->first), sizeof(ObjectID), 1, _f); ! fwrite(&n_children, sizeof(n_children), 1, _f); std::vector<ObjectID>::const_iterator child = iter->second.begin(); std::vector<ObjectID>::const_iterator last_child = iter->second.end(); Index: Date.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Date.cpp,v retrieving revision 1.7.2.5 retrieving revision 1.7.2.6 diff -C2 -d -r1.7.2.5 -r1.7.2.6 *** Date.cpp 18 Sep 2003 00:32:06 -0000 1.7.2.5 --- Date.cpp 18 Sep 2003 02:09:49 -0000 1.7.2.6 *************** *** 97,103 **** timing_t get_realtime() { ! struct timezone tz; struct timeval now; ! gettimeofday(&now, &tz); return (timing_t) ((double)now.tv_sec + (double)now.tv_usec*1.0e-6); } --- 97,103 ---- timing_t get_realtime() { ! struct timezone tz_; struct timeval now; ! gettimeofday(&now, &tz_); return (timing_t) ((double)now.tv_sec + (double)now.tv_usec*1.0e-6); } Index: GeoPos.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/GeoPos.cpp,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -d -r1.7.2.1 -r1.7.2.2 *** GeoPos.cpp 22 Aug 2003 00:21:45 -0000 1.7.2.1 --- GeoPos.cpp 18 Sep 2003 02:09:49 -0000 1.7.2.2 *************** *** 68,73 **** y_ = _ref.A_B * (y_ + dz); x_ = x_ + dp; ! double h = 1.0 / sqrt(y_*y_ + x_*x_); ! _iterateECEF(_lat, _alt, p, z_, x_*h, y_*h, z, _ref, iter+1); } } --- 68,73 ---- y_ = _ref.A_B * (y_ + dz); x_ = x_ + dp; ! double hp = 1.0 / sqrt(y_*y_ + x_*x_); ! _iterateECEF(_lat, _alt, p, z_, x_*hp, y_*hp, z, _ref, iter+1); } } *************** *** 566,570 **** double nu, T, T2, S, C, CP, SP, R, D, D2, M; double mu, phi; ! double x, y; _easting = easting; --- 566,570 ---- double nu, T, T2, S, C, CP, SP, R, D, D2, M; double mu, phi; ! double x_, y_; _easting = easting; *************** *** 573,586 **** _designator = designator; ! x = easting - 500000.0; //remove 500,000 meter offset for longitude ! y = northing; if ((designator - 'N') < 0) { ! y -= 10000000.0; //remove 10,000,000 meter offset used for southern hemisphere } double lon0 = toRadians((getZoneNumber() - 1) * 6.0 - 180.0 + 3.0); //+3 puts origin in middle of zone ! M = y / k0; mu = M * _ref->m_f; --- 573,586 ---- _designator = designator; ! x_ = easting - 500000.0; //remove 500,000 meter offset for longitude ! y_ = northing; if ((designator - 'N') < 0) { ! y_ -= 10000000.0; //remove 10,000,000 meter offset used for southern hemisphere } double lon0 = toRadians((getZoneNumber() - 1) * 6.0 - 180.0 + 3.0); //+3 puts origin in middle of zone ! M = y_ / k0; mu = M * _ref->m_f; *************** *** 596,600 **** SP = 1.0 - S * S * _ref->e2; R = _ref->A * _ref->B2_A2 / (SP*sqrt(SP)); ! D = x/(nu*k0); D2 = D*D; --- 596,600 ---- SP = 1.0 - S * S * _ref->e2; R = _ref->A * _ref->B2_A2 / (SP*sqrt(SP)); ! D = x_/(nu*k0); D2 = D*D; *************** *** 797,802 **** y_ = _ref->A_B * (y_ + dz); x_ = x_ + dp; ! double h = 1.0 / sqrt(y_*y_ + x_*x_); ! iterateECEF(p, z_, x_*h, y_*h, iter+1); } } --- 797,802 ---- y_ = _ref->A_B * (y_ + dz); x_ = x_ + dp; ! double hp = 1.0 / sqrt(y_*y_ + x_*x_); ! iterateECEF(p, z_, x_*hp, y_*hp, iter+1); } } *************** *** 835,840 **** // UTM ! UTM::UTM(LLA const &lla, ReferenceEllipsoid const &ref, char zone) { ! *this = LLAtoUTM(lla, ref, zone); } --- 835,840 ---- // UTM ! UTM::UTM(LLA const &lla, ReferenceEllipsoid const &ref, char zone_) { ! *this = LLAtoUTM(lla, ref, zone_); } *************** *** 867,881 **** } ! void UTM::set(double easting, double northing, const char *code, double alt) { _zone=0; _designator='Z'; ! _E = easting; ! _N = northing; _alt = alt; ! if (code) { ! char c0 = code[0]; ! char c1 = code[1]; ! char c2 = code[2]; _zone = c0 - '0'; if (c2) { --- 867,881 ---- } ! void UTM::set(double easting_, double northing_, const char *zone_, double alt) { _zone=0; _designator='Z'; ! _E = easting_; ! _N = northing_; _alt = alt; ! if (zone_) { ! char c0 = zone_[0]; ! char c1 = zone_[1]; ! char c2 = zone_[2]; _zone = c0 - '0'; if (c2) { *************** *** 915,924 **** const char *c = cdata; while (*c != 0 && (*c == ' ' || *c == '\t' || *c == '\r' || *c == '\n')) c++; ! int zone; ! char designator; ! int n = sscanf(c, "%lf %lf %d%c %lf", &_E, &_N, &zone, &designator, &_alt); if (n != 5) throw ParseException("SYNTAX ERROR: expecting 'easting northing zone altitude'"); ! _zone = zone; ! _designator = toupper(designator); if (!valid()) { throw ParseException("SYNTAX ERROR: invalid UTM code"); --- 915,924 ---- const char *c = cdata; while (*c != 0 && (*c == ' ' || *c == '\t' || *c == '\r' || *c == '\n')) c++; ! int zone_; ! char designator_; ! int n = sscanf(c, "%lf %lf %d%c %lf", &_E, &_N, &zone_, &designator_, &_alt); if (n != 5) throw ParseException("SYNTAX ERROR: expecting 'easting northing zone altitude'"); ! _zone = zone_; ! _designator = toupper(designator_); if (!valid()) { throw ParseException("SYNTAX ERROR: invalid UTM code"); Index: Interpolate.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Interpolate.cpp,v retrieving revision 1.17.2.1 retrieving revision 1.17.2.2 diff -C2 -d -r1.17.2.1 -r1.17.2.2 *** Interpolate.cpp 22 Aug 2003 00:21:45 -0000 1.17.2.1 --- Interpolate.cpp 18 Sep 2003 02:09:49 -0000 1.17.2.2 *************** *** 159,163 **** _min = _breaks[0]; double max = _breaks[n-1]; ! value_t _range = static_cast<value_t>(max - _min); _i_n = int(_range / spacing) + 1; _table.resize(_i_n); --- 159,163 ---- _min = _breaks[0]; double max = _breaks[n-1]; ! _range = static_cast<value_t>(max - _min); _i_n = int(_range / spacing) + 1; _table.resize(_i_n); Index: LUT.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/LUT.cpp,v retrieving revision 1.5.2.2 retrieving revision 1.5.2.3 diff -C2 -d -r1.5.2.2 -r1.5.2.3 *** LUT.cpp 18 Sep 2003 00:32:06 -0000 1.5.2.2 --- LUT.cpp 18 Sep 2003 02:09:49 -0000 1.5.2.3 *************** *** 549,553 **** X h = xb - xa; X s = static_cast<X>(1.0) / h; ! X d2s = h * h * 0.166666667; for (int i = 0; i < n; ++i) { X x = x0 + i * dx; --- 549,553 ---- X h = xb - xa; X s = static_cast<X>(1.0) / h; ! X d2s = h * h * static_cast<X>(0.166666667); for (int i = 0; i < n; ++i) { X x = x0 + i * dx; *************** *** 560,564 **** h = xb - xa; s = static_cast<X>(1.0) / h; ! d2s = h * h * 0.166666667; } X f = (x - xa) * s; --- 560,564 ---- h = xb - xa; s = static_cast<X>(1.0) / h; ! d2s = h * h * static_cast<X>(0.166666667); } X f = (x - xa) * s; Index: Matrix3.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Matrix3.cpp,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** Matrix3.cpp 22 Aug 2003 00:21:45 -0000 1.9.2.1 --- Matrix3.cpp 18 Sep 2003 02:09:49 -0000 1.9.2.2 *************** *** 110,120 **** void Matrix3::preMult(const Matrix3& other) { double t[3]; ! for (int col=0; col<3; col++) { ! t[0] = INNER_PRODUCT(other, *this, 0, col); ! t[1] = INNER_PRODUCT(other, *this, 1, col); ! t[2] = INNER_PRODUCT(other, *this, 2, col); ! _mat[0][col] = t[0]; ! _mat[1][col] = t[1]; ! _mat[2][col] = t[2]; } } --- 110,120 ---- void Matrix3::preMult(const Matrix3& other) { double t[3]; ! for (int col_=0; col_<3; col_++) { ! t[0] = INNER_PRODUCT(other, *this, 0, col_); ! t[1] = INNER_PRODUCT(other, *this, 1, col_); ! t[2] = INNER_PRODUCT(other, *this, 2, col_); ! _mat[0][col_] = t[0]; ! _mat[1][col_] = t[1]; ! _mat[2][col_] = t[2]; } } *************** *** 122,132 **** void Matrix3::postMult(const Matrix3& other) { double t[3]; ! for (int row=0; row<3; row++) { ! t[0] = INNER_PRODUCT(*this, other, row, 0); ! t[1] = INNER_PRODUCT(*this, other, row, 1); ! t[2] = INNER_PRODUCT(*this, other, row, 2); ! _mat[row][0] = t[0]; ! _mat[row][1] = t[1]; ! _mat[row][2] = t[2]; } } --- 122,132 ---- void Matrix3::postMult(const Matrix3& other) { double t[3]; ! for (int row_=0; row_<3; row_++) { ! t[0] = INNER_PRODUCT(*this, other, row_, 0); ! t[1] = INNER_PRODUCT(*this, other, row_, 1); ! t[2] = INNER_PRODUCT(*this, other, row_, 2); ! _mat[row_][0] = t[0]; ! _mat[row_][1] = t[1]; ! _mat[row_][2] = t[2]; } } Index: Quat.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Quat.cpp,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** Quat.cpp 22 Aug 2003 00:21:45 -0000 1.3.2.1 --- Quat.cpp 18 Sep 2003 02:09:49 -0000 1.3.2.2 *************** *** 91,103 **** /// Set the elements of the Quat to represent a rotation of angle /// (radians) around the axis (x,y,z) ! void Quat::makeRotate(double angle, double x, double y, double z) { ! double inversenorm = 1.0/sqrt(x*x + y*y + z*z); double coshalfangle = cos(0.5*angle); double sinhalfangle = sin(0.5*angle); ! _x = x * sinhalfangle * inversenorm; ! _y = y * sinhalfangle * inversenorm; ! _z = z * sinhalfangle * inversenorm; _w = coshalfangle; } --- 91,103 ---- /// Set the elements of the Quat to represent a rotation of angle /// (radians) around the axis (x,y,z) ! void Quat::makeRotate(double angle, double x_, double y_, double z_) { ! double inversenorm = 1.0/sqrt(x_*x_ + y_*y_ + z_*z_); double coshalfangle = cos(0.5*angle); double sinhalfangle = sin(0.5*angle); ! _x = x_ * sinhalfangle * inversenorm; ! _y = y_ * sinhalfangle * inversenorm; ! _z = z_ * sinhalfangle * inversenorm; _w = coshalfangle; } *************** *** 128,136 **** const double epsilon = 0.00001f; - double length1 = from.length(); - double length2 = to.length(); - // dot product vec1*vec2 ! double cosangle = (from*to)/(length1*length2); if (fabs(cosangle - 1) < epsilon) { --- 128,133 ---- const double epsilon = 0.00001f; // dot product vec1*vec2 ! double cosangle = (from*to)/(from.length()*to.length()); if (fabs(cosangle - 1) < epsilon) { *************** *** 203,217 **** // Won't give very meaningful results if the Quat is not associated // with a rotation! ! void Quat::getRotate(double& angle, double& x, double& y, double& z) const { double sinhalfangle = sqrt(_x*_x + _y*_y + _z*_z); angle = 2 * atan2(sinhalfangle, _w); if(sinhalfangle) { ! x = _x / sinhalfangle; ! y = _y / sinhalfangle; ! z = _z / sinhalfangle; } else { ! x = 0.0; ! y = 0.0; ! z = 1.0; } } --- 200,214 ---- // Won't give very meaningful results if the Quat is not associated // with a rotation! ! void Quat::getRotate(double& angle, double& x_, double& y_, double& z_) const { double sinhalfangle = sqrt(_x*_x + _y*_y + _z*_z); angle = 2 * atan2(sinhalfangle, _w); if(sinhalfangle) { ! x_ = _x / sinhalfangle; ! y_ = _y / sinhalfangle; ! z_ = _z / sinhalfangle; } else { ! x_ = 0.0; ! y_ = 0.0; ! z_ = 1.0; } } |