- Timestamp:
- Oct 6, 2011, 12:08:30 PM (13 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, 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:
- 47812b
- Parents:
- 29daad
- git-author:
- Frederik Heber <heber@…> (08/12/11 15:16:28)
- git-committer:
- Frederik Heber <heber@…> (10/06/11 12:08:30)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/GLMoleculeView.cpp
r29daad rb40b9d 28 28 29 29 #include <iostream> 30 #include <boost/shared_ptr.hpp> 30 31 31 32 #include "LinearAlgebra/Line.hpp" … … 229 230 float blueMaterial[] = { 255./(float)color[0], 255./(float)color[1], 255./(float)color[2], 1 }; // need to recast from [0,255] with integers into [0,1] with floats 230 231 GLUquadricObj* q = gluNewQuadric (); 232 gluQuadricOrientation(q, GLU_OUTSIDE); 231 233 232 234 std::cout << "Setting sphere at " << x << " with color r" … … 254 256 float blueMaterial[] = { 255./(float)color[0], 255./(float)color[1], 255./(float)color[2], 1 }; 255 257 GLUquadricObj* q = gluNewQuadric (); 258 gluQuadricOrientation(q, GLU_OUTSIDE); 256 259 Vector a,b; 260 Vector OtherAxis; 257 261 double alpha; 258 a = x - b; 259 b.GetOneNormalVector(a); 260 b.MakeNormalTo(Z); 262 a = x - y; 263 // construct rotation axis 264 b = a; 265 b.VectorProduct(Z); 266 Line axis(zeroVec, b); 267 // calculate rotation angle 261 268 alpha = a.Angle(Z); 262 if (fabs(a[2]) > MYEPSILON) // I have no idea why I need to check this, but this fixes the sign problem of the rotation angle 269 // construct other axis to check right-hand rule 270 OtherAxis = b; 271 OtherAxis.VectorProduct(Z); 272 // assure right-hand rule for the rotation 273 if (a.ScalarProduct(OtherAxis) < MYEPSILON) 263 274 alpha = M_PI-alpha; 264 Line axis(zeroVec, b); 265 a = axis.rotateVector(a, alpha); 266 std::cout << "Setting cylinder from " << x << " to " << a << " with color r" 275 // check 276 Vector a_rotated = axis.rotateVector(a, alpha); 277 std::cout << "Setting cylinder from "// << x << " to " << y 278 << a << " to " << a_rotated << " around " << b << " by " << alpha/M_PI*180. << ", respectively, " 279 << " with color r" 267 280 << (int)color[0] << ",g" << (int)color[1] << ",b" << (int)color[2] << "." << endl; 268 281 … … 307 320 // create atom 308 321 const element *ptr = (*atomiter)->getType(); 309 molecule::const_iterator moliter = (*Runner)->begin();310 Position = (*atomiter)->getPosition() - (*moliter)->getPosition();322 boost::shared_ptr<Vector> MolCenter((*Runner)->DetermineCenterOfGravity()); 323 Position = (*atomiter)->getPosition() - *MolCenter; 311 324 const unsigned char* color = NULL; 312 325 if ((World::getInstance().isSelected(*atomiter)) || (World::getInstance().isSelected((*Runner)))) … … 322 335 ++bonditer) { 323 336 if ((*bonditer)->leftatom->getId() == (*atomiter)->getId()) { 324 Position = (*bonditer)->leftatom->getPosition() - (*moliter)->getPosition();325 OtherPosition = (*bonditer)->rightatom->getPosition() - (*moliter)->getPosition();337 Position = (*bonditer)->leftatom->getPosition() - *MolCenter; 338 OtherPosition = (*bonditer)->rightatom->getPosition() - *MolCenter; 326 339 const double distance = sqrt(Position.DistanceSquared(OtherPosition))/2.; 327 340 const unsigned char *color1 = (*bonditer)->leftatom->getType()->getColor();
Note:
See TracChangeset
for help on using the changeset viewer.