Changeset 005e18 for src


Ignore:
Timestamp:
Apr 30, 2010, 9:53:16 AM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
1513a74
Parents:
0e01b4
Message:

Added const correctness to plane class and simplified interface

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Plane.cpp

    r0e01b4 r005e18  
    172172/************ Methods inherited from Space ****************/
    173173
    174 double Plane::distance(Vector &point){
     174double Plane::distance(const Vector &point) const{
    175175  double res = point.ScalarProduct(*normalVector)-offset;
    176176  return fabs(res);
    177177}
    178178
    179 Vector Plane::getClosestPoint(Vector &point){
     179Vector Plane::getClosestPoint(const Vector &point) const{
    180180  Vector difference = distance(point) * (*normalVector);
    181181  if(difference.IsZero()){
     
    189189  return (point - (sign * difference));
    190190}
    191 
    192 bool Plane::isContained(Vector &point){
    193   return (fabs(point.ScalarProduct(*normalVector) - offset)) < MYEPSILON;
    194 }
  • src/Plane.hpp

    r0e01b4 r005e18  
    5252  /****** Methods inherited from Space ***********/
    5353
    54   virtual double distance(Vector &point);
    55   virtual Vector getClosestPoint(Vector &point);
    56   virtual bool isContained(Vector &point);
    57 
     54  virtual double distance(const Vector &point) const;
     55  virtual Vector getClosestPoint(const Vector &point) const;
    5856
    5957private:
  • src/Space.cpp

    r0e01b4 r005e18  
    77
    88#include "Space.hpp"
     9#include "vector.hpp"
    910
    1011Space::Space()
     
    1314Space::~Space()
    1415{}
     16
     17bool Space::hasZero() const{
     18  return isContained(zeroVec);
     19}
     20
     21bool Space::isContained(const Vector &point) const{
     22  return (distance(point)) < MYEPSILON;
     23}
  • src/Space.hpp

    r0e01b4 r005e18  
    1717  virtual ~Space();
    1818
    19   virtual double distance(Vector &point)=0;
    20   virtual Vector getClosestPoint(Vector &point)=0;
    21   virtual bool isContained(Vector &point)=0;
     19  virtual double distance(const Vector &point) const=0;
     20  virtual Vector getClosestPoint(const Vector &point) const=0;
     21  virtual bool isContained(const Vector &point) const;
     22  virtual bool hasZero() const;
     23
    2224};
    2325
  • src/vector.cpp

    r0e01b4 r005e18  
    719719  return isInside;
    720720}
     721
     722
     723// some comonly used vectors
     724const Vector zeroVec(0,0,0);
     725const Vector e1(1,0,0);
     726const Vector e2(0,1,0);
     727const Vector e3(0,0,1);
  • src/vector.hpp

    r0e01b4 r005e18  
    101101};
    102102
     103// some commonly used and fixed vectors
     104const extern Vector zeroVec;
     105const extern Vector e1;
     106const extern Vector e2;
     107const extern Vector e3;
     108
    103109ostream & operator << (ostream& ost, const Vector &m);
    104110const Vector& operator*=(Vector& a, const double m);
Note: See TracChangeset for help on using the changeset viewer.