Changeset 54a746 for src/vector.cpp
- Timestamp:
- Aug 18, 2009, 8:48:06 AM (16 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 658efb
- Parents:
- 093645
- git-author:
- Frederik Heber <heber@…> (08/18/09 08:38:46)
- git-committer:
- Frederik Heber <heber@…> (08/18/09 08:48:06)
- File:
-
- 1 edited
-
src/vector.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/vector.cpp
r093645 r54a746 6 6 7 7 8 #include "molecules.hpp" 9 8 #include "defs.hpp" 9 #include "helpers.hpp" 10 #include "leastsquaremin.hpp" 11 #include "vector.hpp" 12 #include "verbose.hpp" 10 13 11 14 /************************************ Functions for class vector ************************************/ … … 247 250 248 251 /** Calculates the intersection of the two lines that are both on the same plane. 249 * Note that we do not check whether they are on the same plane. 252 * Note that we do not check whether they are on the same plane. Vector is calculated with respecy to second line. 250 253 * \param *out output stream for debugging 251 254 * \param *Line1a first vector of first line … … 276 279 *out << Verbose(3) << "INFO: Normal of plane is " << *Normal << "." << endl; 277 280 278 // create normal vector to one line279 Line.CopyVector(Line1b);280 Line.SubtractVector(Line1a);281 LineNormal.MakeNormalVector(&Line, Normal);282 *out << Verbose(3) << "INFO: Normal of first line is " << LineNormal << "." << endl;283 284 281 // check if lines are parallel 285 282 helper.CopyVector(Line2b); 286 283 helper.SubtractVector(Line2a); 287 if (fabs(helper.ScalarProduct( &LineNormal)) < MYEPSILON) {284 if (fabs(helper.ScalarProduct(Normal)) < MYEPSILON) { 288 285 *out << Verbose(1) << "Lines " << helper << " and " << Line << " are parallel, no cross point!" << endl; 289 286 result = false; … … 291 288 helper.CopyVector(Line2a); 292 289 helper.SubtractVector(Line1a); 293 factor1 = helper.ScalarProduct( &LineNormal);290 factor1 = helper.ScalarProduct(Normal); 294 291 helper.CopyVector(Line2b); 295 292 helper.SubtractVector(Line1a); 296 factor2 = helper.ScalarProduct( &LineNormal);293 factor2 = helper.ScalarProduct(Normal); 297 294 if (fabs(factor2) > MYEPSILON) { 298 295 CopyVector(Line2a); … … 380 377 * @return true - vector is zero, false - vector is not 381 378 */ 382 bool Vector::IsNull() const 383 { 384 return (fabs(x[0]+x[1]+x[2]) < MYEPSILON); 379 bool Vector::IsZero() const 380 { 381 return (fabs(x[0])+fabs(x[1])+fabs(x[2]) < MYEPSILON); 382 }; 383 384 /** Checks whether vector has length of 1. 385 * @return true - vector is normalized, false - vector is not 386 */ 387 bool Vector::IsOne() const 388 { 389 return (fabs(Norm() - 1.) < MYEPSILON); 385 390 }; 386 391 … … 437 442 return a; 438 443 }; 444 445 /** Subtracts vector \a from this lhs component-wise. 446 * \param a base vector 447 * \param b vector components to add 448 * \return lhs - a 449 */ 450 Vector& operator-=(Vector& a, const Vector& b) 451 { 452 a.SubtractVector(&b); 453 return a; 454 }; 455 439 456 /** factor each component of \a a times a double \a m. 440 457 * \param a base vector … … 461 478 }; 462 479 480 /** Subtracts vector \a from \b component-wise. 481 * \param a first vector 482 * \param b second vector 483 * \return a - b 484 */ 485 Vector& operator-(const Vector& a, const Vector& b) 486 { 487 Vector *x = new Vector; 488 x->CopyVector(&a); 489 x->SubtractVector(&b); 490 return *x; 491 }; 492 463 493 /** Factors given vector \a a times \a m. 464 494 * \param a vector 465 495 * \param m factor 466 * \return a + b496 * \return m * a 467 497 */ 468 498 Vector& operator*(const Vector& a, const double m) 499 { 500 Vector *x = new Vector; 501 x->CopyVector(&a); 502 x->Scale(m); 503 return *x; 504 }; 505 506 /** Factors given vector \a a times \a m. 507 * \param m factor 508 * \param a vector 509 * \return m * a 510 */ 511 Vector& operator*(const double m, const Vector& a ) 469 512 { 470 513 Vector *x = new Vector;
Note:
See TracChangeset
for help on using the changeset viewer.
