- Timestamp:
- Sep 19, 2013, 8:24:28 PM (11 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:
- aeb694
- Parents:
- 52bb5a
- git-author:
- Frederik Heber <heber@…> (08/30/13 22:32:37)
- git-committer:
- Frederik Heber <heber@…> (09/19/13 20:24:28)
- Location:
- src/Shapes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Shapes/Shape.cpp
r52bb5a rf06cbb 46 46 #include "Tesselation/ApproximateShapeVolume.hpp" 47 47 48 #include <boost/bind.hpp> 48 49 #include <algorithm> 49 50 #include <limits> … … 152 153 } 153 154 154 std::string Shape::toString() const {155 std::string Shape::toString() const { 155 156 return impl->toString(); 156 157 } … … 186 187 187 188 AndShape_impl::AndShape_impl(const Shape::impl_ptr &_lhs, const Shape::impl_ptr &_rhs) : 188 lhs(_lhs),rhs(_rhs) 189 lhs(_lhs), 190 rhs(_rhs), 191 radius(NULL, boost::bind(&AndShape_impl::calculateRadius, this), "radius"), 192 center(NULL, boost::bind(&AndShape_impl::calculateCenter, this), "center") 189 193 {} 190 194 … … 238 242 } 239 243 240 Vector AndShape_impl:: getCenter() const244 Vector AndShape_impl::calculateCenter() const 241 245 { 242 246 // calculate closest position on sphere surface to other center .. … … 247 251 } 248 252 249 double AndShape_impl:: getRadius() const253 double AndShape_impl::calculateRadius() const 250 254 { 251 255 const double distance = (lhs->getCenter() - rhs->getCenter()).Norm(); … … 314 318 315 319 OrShape_impl::OrShape_impl(const Shape::impl_ptr &_lhs, const Shape::impl_ptr &_rhs) : 316 lhs(_lhs),rhs(_rhs) 320 lhs(_lhs), 321 rhs(_rhs), 322 radius(NULL, boost::bind(&OrShape_impl::calculateRadius, this), "radius"), 323 center(NULL, boost::bind(&OrShape_impl::calculateCenter, this), "center") 317 324 {} 318 325 … … 366 373 } 367 374 368 Vector OrShape_impl:: getCenter() const375 Vector OrShape_impl::calculateCenter() const 369 376 { 370 377 // calculate furthest position on sphere surface to other center .. … … 375 382 } 376 383 377 double OrShape_impl:: getRadius() const384 double OrShape_impl::calculateRadius() const 378 385 { 379 386 const Vector rhsDistance = rhs->getCenter() + rhs->getRadius()*((rhs->getCenter() - lhs->getCenter()).getNormalized()); -
src/Shapes/Shape_impl.hpp
r52bb5a rf06cbb 28 28 #include "LinearAlgebra/LineSegmentSet.hpp" 29 29 #include "LinearAlgebra/Vector.hpp" 30 31 #include "CodePatterns/Cacheable.hpp" 30 32 31 33 … … 146 148 virtual bool isOnSurface(const Vector &point) const; 147 149 virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException); 148 virtual Vector getCenter() const; 149 virtual double getRadius() const; 150 virtual Vector getCenter() const 151 { return *center; } 152 virtual double getRadius() const 153 { return *radius; } 150 154 virtual double getVolume() const; 151 155 virtual double getSurfaceArea() const; … … 156 160 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 157 161 private: 162 double calculateRadius() const; 163 Vector calculateCenter() const; 164 158 165 Shape::impl_ptr lhs; 159 166 Shape::impl_ptr rhs; 167 Cacheable<double> radius; 168 Cacheable<Vector> center; 160 169 }; 161 170 … … 167 176 virtual bool isOnSurface(const Vector &point) const; 168 177 virtual Vector getNormal(const Vector &point) const throw(NotOnSurfaceException); 169 virtual Vector getCenter() const; 170 virtual double getRadius() const; 178 virtual Vector getCenter() const 179 { return *center; } 180 virtual double getRadius() const 181 { return *radius; } 171 182 virtual double getVolume() const; 172 183 virtual double getSurfaceArea() const; … … 177 188 virtual std::vector<Vector> getHomogeneousPointsInVolume(const size_t N) const; 178 189 private: 190 double calculateRadius() const; 191 Vector calculateCenter() const; 192 179 193 Shape::impl_ptr lhs; 180 194 Shape::impl_ptr rhs; 195 Cacheable<double> radius; 196 Cacheable<Vector> center; 181 197 }; 182 198
Note:
See TracChangeset
for help on using the changeset viewer.