Ignore:
Timestamp:
Apr 6, 2012, 11:44:09 AM (14 years ago)
Author:
Frederik Heber <heber@…>
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:
93eae36
Parents:
2db053
git-author:
Frederik Heber <heber@…> (04/03/12 13:32:46)
git-committer:
Frederik Heber <heber@…> (04/06/12 11:44:09)
Message:

Added Line::getRotationMatrix() and RealSpaceMatrix::setRotation(Vector,double).

  • setRotation() now allows to set a rotation matrix about an arbitrary axis.
  • Line::getRotationMatrix() just forwards to RealSpaceMatrix::setRotation() with its direction.
  • added (simple) unit test function for both.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LinearAlgebra/src/unittests/LineUnitTest.cpp

    r2db053 r50c35d  
    3030
    3131#include "LineUnitTest.hpp"
     32
     33#include "RealSpaceMatrix.hpp"
    3234
    3335#ifdef HAVE_TESTRUNNER
     
    297299
    298300
    299 
    300301  // now the real rotations
    301302  // unitVec[1] around unitVec[0]
     
    364365}
    365366
     367void LineUnittest::getRotationMatrixTest()
     368{
     369  RealSpaceMatrix M;
     370  Vector fixture;
     371
     372  // check getRotationMatrix;
     373  M = la1->getRotationMatrix(1.);
     374  fixture = M * unitVec[0];
     375  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
     376  M = la2->getRotationMatrix(1.);
     377  fixture = M * unitVec[1];
     378  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
     379  M = la3->getRotationMatrix(1.);
     380  fixture = M * unitVec[2];
     381  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
     382
     383  // unitVec[1] around unitVec[0]
     384  fixture = la1->rotateVector(unitVec[1],0);
     385  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
     386  fixture = la1->rotateVector(unitVec[1],1./2.*M_PI);
     387  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
     388  fixture = la1->rotateVector(unitVec[1],M_PI);
     389  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
     390  fixture = la1->rotateVector(unitVec[1],2*M_PI);
     391  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
     392
     393  // unitVec[2] around unitVec[1]
     394  fixture = la2->rotateVector(unitVec[2],0);
     395  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
     396  fixture = la2->rotateVector(unitVec[2],1./2.*M_PI);
     397  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
     398  fixture = la2->rotateVector(unitVec[2],M_PI);
     399  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
     400  fixture = la2->rotateVector(unitVec[2],2*M_PI);
     401  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
     402
     403  // unitVec[0] around unitVec[2]
     404  fixture = la3->rotateVector(unitVec[0],0);
     405  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
     406  fixture = la3->rotateVector(unitVec[0],1./2.*M_PI);
     407  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
     408  fixture = la3->rotateVector(unitVec[0],M_PI);
     409  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
     410  fixture = la3->rotateVector(unitVec[0],2*M_PI);
     411  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
     412}
     413
    366414void LineUnittest::sphereIntersectionTest(){
    367415  {
Note: See TracChangeset for help on using the changeset viewer.