Changeset 1f591b for molecuilder/src/vector_ops.cpp
- Timestamp:
- Apr 13, 2010, 1:22:42 PM (16 years ago)
- Children:
- e7ea64
- Parents:
- 0f55b2
- File:
-
- 1 edited
-
molecuilder/src/vector_ops.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/vector_ops.cpp
r0f55b2 r1f591b 121 121 // normalise this vector with respect to axis 122 122 a.CopyVector(vec); 123 a.ProjectOntoPlane( &axis);123 a.ProjectOntoPlane(axis); 124 124 // construct normal vector 125 125 try { … … 135 135 y.Scale(sin(alpha)); 136 136 a.Scale(cos(alpha)); 137 res = vec.Projection( &axis);137 res = vec.Projection(axis); 138 138 // add scaled normal vector onto this vector 139 res .AddVector(&y);139 res += y; 140 140 // add part in axis direction 141 res .AddVector(&a);141 res += a; 142 142 return res; 143 143 }; … … 197 197 Vector parallel; 198 198 double factor = 0.; 199 if (fabs(a.ScalarProduct( &b)*a.ScalarProduct(&b)/a.NormSquared()/b.NormSquared() - 1.) < MYEPSILON) {199 if (fabs(a.ScalarProduct(b)*a.ScalarProduct(b)/a.NormSquared()/b.NormSquared() - 1.) < MYEPSILON) { 200 200 parallel = Line1a - Line2a; 201 factor = parallel.ScalarProduct( &a)/a.Norm();201 factor = parallel.ScalarProduct(a)/a.Norm(); 202 202 if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) { 203 203 res = Line2a; … … 206 206 } else { 207 207 parallel = Line1a - Line2b; 208 factor = parallel.ScalarProduct( &a)/a.Norm();208 factor = parallel.ScalarProduct(a)/a.Norm(); 209 209 if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) { 210 210 res = Line2b; … … 221 221 double s; 222 222 Vector temp1, temp2; 223 temp1 .CopyVector(&c);224 temp1.VectorProduct( &b);225 temp2 .CopyVector(&a);226 temp2.VectorProduct( &b);223 temp1 = c; 224 temp1.VectorProduct(b); 225 temp2 = a; 226 temp2.VectorProduct(b); 227 227 Log() << Verbose(1) << "INFO: temp1 = " << temp1 << ", temp2 = " << temp2 << "." << endl; 228 228 if (fabs(temp2.NormSquared()) > MYEPSILON) 229 s = temp1.ScalarProduct( &temp2)/temp2.NormSquared();229 s = temp1.ScalarProduct(temp2)/temp2.NormSquared(); 230 230 else 231 231 s = 0.; 232 Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct( &temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl;232 Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct(temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl; 233 233 234 234 // construct intersection
Note:
See TracChangeset
for help on using the changeset viewer.
