Changeset 6c438f for src/Shapes/ShapeOps.cpp
- Timestamp:
- Aug 28, 2010, 3:21:11 AM (15 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:
- a6e6b5, f8982c
- Parents:
- 2ad482 (diff), fd4905 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Frederik Heber <heber@…> (08/28/10 03:17:48)
- git-committer:
- Frederik Heber <heber@…> (08/28/10 03:21:11)
- File:
-
- 1 edited
-
src/Shapes/ShapeOps.cpp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Shapes/ShapeOps.cpp
r2ad482 r6c438f 1 /* 2 * Project: MoleCuilder 3 * Description: creates and alters molecular systems 4 * Copyright (C) 2010 University of Bonn. All rights reserved. 5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. 6 */ 7 1 8 /* 2 9 * ShapeOps.cpp … … 6 13 */ 7 14 15 // include config.h 16 #ifdef HAVE_CONFIG_H 17 #include <config.h> 18 #endif 19 20 #include "Helpers/MemDebug.hpp" 21 8 22 #include "Shapes/ShapeOps.hpp" 9 23 #include "Shapes/ShapeOps_impl.hpp" 10 24 25 #include "LinearAlgebra/Vector.hpp" 11 26 #include "Helpers/Assert.hpp" 12 27 … … 55 70 } 56 71 57 Shape::impl_ptr ShapeOpsBase_impl::getArg(){ 72 std::vector<Vector> ShapeOpsBase_impl::getHomogeneousPointsOnSurface(const size_t N) const { 73 return getArg()->getHomogeneousPointsOnSurface(N);; 74 } 75 76 Shape::impl_ptr ShapeOpsBase_impl::getArg() const{ 58 77 return arg; 59 78 } … … 69 88 Resize_impl::~Resize_impl(){} 70 89 90 bool Resize_impl::isInside(const Vector& point){ 91 return getArg()->isInside((1/size) * point); 92 } 93 71 94 Vector Resize_impl::translateIn(const Vector& point){ 72 95 return (1/size) * point; … … 86 109 return sstr.str(); 87 110 } 111 112 std::vector<Vector> Resize_impl::getHomogeneousPointsOnSurface(const size_t N) const { 113 std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N); 114 for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) { 115 *iter *= size; 116 } 117 return PointsOnSurface; 118 } 119 88 120 89 121 Shape resize(const Shape &arg,double size){ … … 100 132 Translate_impl::~Translate_impl(){} 101 133 134 bool Translate_impl::isInside(const Vector& point){ 135 return getArg()->isInside(point-offset); 136 } 137 102 138 Vector Translate_impl::translateIn(const Vector& point){ 103 139 return point-offset; … … 116 152 sstr << "translate(" << getArg()->toString() << "," << offset << ")"; 117 153 return sstr.str(); 154 } 155 156 std::vector<Vector> Translate_impl::getHomogeneousPointsOnSurface(const size_t N) const { 157 std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N); 158 for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) { 159 *iter += offset; 160 } 161 return PointsOnSurface; 118 162 } 119 163 … … 138 182 Stretch_impl::~Stretch_impl(){} 139 183 184 bool Stretch_impl::isInside(const Vector& point){ 185 Vector helper=point; 186 helper.ScaleAll(reciFactors); 187 return getArg()->isInside(helper); 188 } 189 140 190 Vector Stretch_impl::translateIn(const Vector& point){ 141 191 Vector helper=point; … … 168 218 } 169 219 220 std::vector<Vector> Stretch_impl::getHomogeneousPointsOnSurface(const size_t N) const { 221 std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N); 222 for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) { 223 (*iter).ScaleAll(reciFactors); 224 } 225 return PointsOnSurface; 226 } 227 170 228 Shape stretch(const Shape &arg, const Vector &factors){ 171 229 Shape::impl_ptr impl = Shape::impl_ptr(new Stretch_impl(getShapeImpl(arg),factors)); … … 183 241 Transform_impl::~Transform_impl(){} 184 242 243 bool Transform_impl::isInside(const Vector& point){ 244 return getArg()->isInside(transformationInv * point); 245 } 246 185 247 Vector Transform_impl::translateIn(const Vector& point){ 186 248 return transformationInv * point; … … 202 264 } 203 265 266 std::vector<Vector> Transform_impl::getHomogeneousPointsOnSurface(const size_t N) const { 267 std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N); 268 for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) { 269 *iter = transformation * (*iter); 270 } 271 return PointsOnSurface; 272 } 273 204 274 Shape transform(const Shape &arg, const Matrix &transformation){ 205 275 Shape::impl_ptr impl = Shape::impl_ptr(new Transform_impl(getShapeImpl(arg),transformation));
Note:
See TracChangeset
for help on using the changeset viewer.
