Changeset da5c7c for molecuilder/src/vector.cpp
- Timestamp:
- Jul 28, 2009, 1:01:15 PM (16 years ago)
- Children:
- 3dc682
- Parents:
- 78b45a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/vector.cpp
r78b45a rda5c7c 216 216 }; 217 217 218 /** Calculates squared norm of this vector. 219 * \return \f$|x|^2\f$ 220 */ 221 double Vector::NormSquared() const 222 { 223 return (ScalarProduct(this)); 224 }; 225 218 226 /** Normalizes this vector. 219 227 */ … … 259 267 double Vector::Angle(const Vector *y) const 260 268 { 261 double angle = this->ScalarProduct(y)/Norm()/y->Norm(); 269 double norm1 = Norm(), norm2 = y->Norm(); 270 double angle = 1; 271 if ((fabs(norm1) > MYEPSILON) && (fabs(norm2) > MYEPSILON)) 272 angle = this->ScalarProduct(y)/norm1/norm2; 262 273 // -1-MYEPSILON occured due to numerical imprecision, catch ... 263 274 //cout << Verbose(2) << "INFO: acos(-1) = " << acos(-1) << ", acos(-1+MYEPSILON) = " << acos(-1+MYEPSILON) << ", acos(-1-MYEPSILON) = " << acos(-1-MYEPSILON) << "." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.