Changeset 7672551


Ignore:
Timestamp:
Mar 30, 2012, 9:18:25 AM (13 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, 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:
c67c65
Parents:
e9ad43
git-author:
Frederik Heber <heber@…> (01/30/12 08:14:10)
git-committer:
Frederik Heber <heber@…> (03/30/12 09:18:25)
Message:

Split off class definition of LinePoint from module Line.cpp

  • added documentation section on the lines.
  • some changes due to new include LinePoint.hpp.
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • LinearAlgebra/src/LinearAlgebra/Line.cpp

    re9ad43 r7672551  
    3131#include "defs.hpp"
    3232#include "Exceptions.hpp"
     33#include "LinePoint.hpp"
    3334#include "MatrixContent.hpp"
    3435#include "Plane.hpp"
     
    308309}
    309310
    310 /******************************** Points on the line ********************/
    311 
    312 LinePoint::LinePoint(const LinePoint &src) :
    313   line(src.line),param(src.param)
    314 {}
    315 
    316 LinePoint::LinePoint(const Line &_line, double _param) :
    317   line(_line),param(_param)
    318 {}
    319 
    320 LinePoint& LinePoint::operator=(const LinePoint &src){
    321   line=src.line;
    322   param=src.param;
    323   return *this;
    324 }
    325 
    326 Vector LinePoint::getPoint() const{
    327   ASSERT(!isInfinite(),"getPoint() on infinite LinePoint called");
    328   return (*line.origin)+param*(*line.direction);
    329 }
    330 
    331 Line LinePoint::getLine() const{
    332   return line;
    333 }
    334 
    335 bool LinePoint::isInfinite() const{
    336   return isPosInfinity() || isNegInfinity();
    337 }
    338 bool LinePoint::isPosInfinity() const{
    339   return param == numeric_limits<double>::infinity();
    340 }
    341 bool LinePoint::isNegInfinity() const{
    342   return param ==-numeric_limits<double>::infinity();
    343 }
    344 
    345 bool operator==(const LinePoint &x, const LinePoint &y){
    346   ASSERT(x.line==y.line,"Operation on two points of different lines");
    347   return x.param == y.param;
    348 
    349 }
    350 bool operator<(const LinePoint &x, const LinePoint &y){
    351   ASSERT(x.line==y.line,"Operation on two points of different lines");
    352   return x.param<y.param;
    353 }
    354 
    355 ostream& operator<<(ostream& ost, const Line& m)
     311std::ostream& operator<<(std::ostream& ost, const Line& m)
    356312{
    357313  const Vector origin = m.getOrigin();
     
    373329};
    374330
     331
     332/******************************** Points on the line ********************/
  • LinearAlgebra/src/LinearAlgebra/Line.hpp

    re9ad43 r7672551  
    2525class LinePoint;
    2626
     27/** This class represents a line in space stretching to infinity.
     28 *
     29 * It is defined by its origin and a direction.
     30 *
     31 * \sa LinePoint and LineSegment
     32 */
    2733class Line : public Space
    2834{
     
    7480Line makeLineThrough(const Vector &x1, const Vector &x2);
    7581
    76 /**
    77  * Class for representing points on a line
    78  * These objects allow comparison of points on the same line as well as specifying the
    79  * infinite "endpoints" of a line.
    80  */
    81 class LinePoint{
    82   friend class Line;
    83   friend bool operator==(const LinePoint&, const LinePoint&);
    84   friend bool operator<(const LinePoint&, const LinePoint&);
    85 public:
    86   LinePoint(const LinePoint&);
    87   LinePoint& operator=(const LinePoint&);
    88   Vector getPoint() const;
    89   Line getLine() const;
    90   bool isInfinite() const;
    91   bool isPosInfinity() const;
    92   bool isNegInfinity() const;
    93 
    94 private:
    95   LinePoint(const Line&,double);
    96   Line line;
    97   double param;
    98 };
    99 
    100 bool operator==(const LinePoint&, const LinePoint&);
    101 bool operator<(const LinePoint&, const LinePoint&);
    102 
    103 inline bool operator!= (const LinePoint& x, const LinePoint& y) { return !(x==y); }
    104 inline bool operator>  (const LinePoint& x, const LinePoint& y) { return y<x; }
    105 inline bool operator<= (const LinePoint& x, const LinePoint& y) { return !(y<x); }
    106 inline bool operator>= (const LinePoint& x, const LinePoint& y) { return !(x<y); }
    107 
    108 
    10982#endif /* LINE_HPP_ */
  • LinearAlgebra/src/LinearAlgebra/LineSegment.cpp

    re9ad43 r7672551  
    2424
    2525#include "Line.hpp"
     26#include "LinePoint.hpp"
    2627#include "Vector.hpp"
    2728
  • LinearAlgebra/src/LinearAlgebra/LineSegment.hpp

    re9ad43 r7672551  
    2121class LinePoint;
    2222
     23/** This class represents a specific segment of a line, defined through
     24 * two points on the same line that form start and end.
     25 *
     26 */
    2327class LineSegment
    2428{
  • LinearAlgebra/src/LinearAlgebra/LineSegmentSet.cpp

    re9ad43 r7672551  
    2424#include "CodePatterns/Assert.hpp"
    2525#include "Line.hpp"
     26#include "LinePoint.hpp"
    2627#include "LineSegment.hpp"
    2728
  • LinearAlgebra/src/LinearAlgebra/LineSegmentSet.hpp

    re9ad43 r7672551  
    2222class LineSegment;
    2323
     24/** This class represents a continous set of LineSegment's all on the same
     25 * underlying line.
     26 *
     27 * Hence, it is basically a sorted container for LinePoints but
     28 * we iterate over it segment-wise.
     29 *
     30 */
    2431class LineSegmentSet {
    2532  friend LineSegmentSet merge(const LineSegmentSet&,const LineSegmentSet&);
  • LinearAlgebra/src/LinearAlgebra/Makefile.am

    re9ad43 r7672551  
    1111  leastsquaremin.cpp \
    1212  Line.cpp \
     13  LinePoint.cpp \
    1314  LineSegment.cpp \
    1415  LineSegmentSet.cpp \
     
    3132  leastsquaremin.hpp \
    3233  Line.hpp \
     34  LinePoint.hpp \
    3335  LineSegment.hpp \
    3436  LineSegmentSet.hpp \
  • LinearAlgebra/src/documentation/mainpage.dox

    re9ad43 r7672551  
    2525 *
    2626 *
     27 * \ref lines Lines and subtypes
     28 *
    2729 * \date 2011-11-02
    2830 *
  • src/Shapes/Shape_impl.hpp

    re9ad43 r7672551  
    2424#include "Shapes/ShapeType.hpp"
    2525#include "LinearAlgebra/Line.hpp"
     26#include "LinearAlgebra/LinePoint.hpp"
    2627#include "LinearAlgebra/LineSegment.hpp"
    2728#include "LinearAlgebra/LineSegmentSet.hpp"
Note: See TracChangeset for help on using the changeset viewer.