OpenStructure
Loading...
Searching...
No Matches
connector_impl.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// This file is part of the OpenStructure project <www.openstructure.org>
3//
4// Copyright (C) 2008-2020 by the OpenStructure authors
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License as published by the Free
8// Software Foundation; either version 3.0 of the License, or (at your option)
9// any later version.
10// This library is distributed in the hope that it will be useful, but WITHOUT
11// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with this library; if not, write to the Free Software Foundation, Inc.,
17// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18//------------------------------------------------------------------------------
19#ifndef OST_CONNECTOR_IMPL_HH
20#define OST_CONNECTOR_IMPL_HH
21
22#include <boost/enable_shared_from_this.hpp>
23
24#include <ost/geom/geom.hh>
25
30
32
33namespace ost { namespace mol { namespace impl {
34
36 public boost::enable_shared_from_this<ConnectorImpl> {
37public:
38 ConnectorImpl(const EntityImplPtr& e, const AtomImplPtr& first,
39 const AtomImplPtr& second, Real l, Real t, Real p, unsigned char bond_order);
41
42 AtomImplPtr GetFirst() const {return first_.lock();}
43 AtomImplPtr GetSecond() const {return second_.lock();}
44
47
48 Real GetLength() const;
49 void SetLength(Real l) {len_=l;}
50
51 // Tests whether this connector is connecting atoms a and b.
52 bool IsConnectorOf(const AtomImplPtr& a, const AtomImplPtr& b) const;
53
54
55
56 // reverse order of atoms, does not affect angles!
57 void Switch();
58
60
62 return local_rot_*geom::Vec3(0, 0, 1);
63 }
64
65 void SetDirAndLength(const geom::Vec3& dir);
66
67 void SetDir(const geom::Vec3& dir);
68
69 const geom::Mat3& GetLocalRot() const { return local_rot_; }
70
71 void SetBondOrder(unsigned char bo) { bond_order_ = bo; }
72
73 unsigned char GetBondOrder() const { return bond_order_; }
74
75private:
76 AtomImplW first_,second_;
77 Real len_;
78 unsigned char bond_order_;
79 // rotation matrix that brings a vector from the local coordinates of the
80 // first to the local coordinate system of the second atom.
81 geom::Mat3 local_rot_;
82};
83
84}}} // ns
85
86#endif
Three dimensional vector class, using Real precision.
Definition vec3.hh:48
base class for the implementation
EntityVisitor interface.
AtomImplPtr GetSecond() const
geom::Vec3 GetOriginalPos() const
geom::Vec3 GetPos() const
void SetDir(const geom::Vec3 &dir)
ConnectorImpl(const EntityImplPtr &e, const AtomImplPtr &first, const AtomImplPtr &second, Real l, Real t, Real p, unsigned char bond_order)
const geom::Mat3 & GetLocalRot() const
void SetBondOrder(unsigned char bo)
unsigned char GetBondOrder() const
void Apply(EntityVisitor &v)
bool IsConnectorOf(const AtomImplPtr &a, const AtomImplPtr &b) const
void SetDirAndLength(const geom::Vec3 &dir)
float Real
Definition base.hh:44
boost::shared_ptr< AtomImpl > AtomImplPtr
boost::shared_ptr< EntityImpl > EntityImplPtr
boost::weak_ptr< AtomImpl > AtomImplW
Definition base.dox:1