mbsim 4.0.0 MBSim Kernel

funcpair_ellipse_circle.h
1 /* Copyright (C) 2004-2010 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: martin.o.foerg@googlemail.com
18 */
19
20 #ifndef _FUNCPAIR_ELLIPSE_CIRCLE_H_
21 #define _FUNCPAIR_ELLIPSE_CIRCLE_H_
22
23 #include <mbsim/functions/contact/funcpair_conesection_circle.h>
24
25 namespace MBSim {
26
33 class FuncPairEllipseCircle : public FuncPairConeSectionCircle {
34 public:
42 FuncPairEllipseCircle(double R_, double a_, double b_) :
43 FuncPairConeSectionCircle(R_, a_, b_) {
44 }
45
53 FuncPairEllipseCircle(double R_, double a_, double b_, bool el_IN_ci_) :
54 FuncPairConeSectionCircle(R_, a_, b_, el_IN_ci_) {
55 }
56
57 /* INHERITED INTERFACE OF DISTANCEFUNCTION */
58 double operator()(const double &phi) override;
59 fmatvec::Vec3 evalWrD(const double &phi) override;
60 /*************************************************/
61
62 /* GETTER / SETTER */
63 void setEllipseCOS(fmatvec::Vec3 b1e_, fmatvec::Vec3 b2e_);
64 /*************************************************/
65 };
66
67 inline void FuncPairEllipseCircle::setEllipseCOS(fmatvec::Vec3 b1e_, fmatvec::Vec3 b2e_) {
68 setSectionCOS(b1e_, b2e_);
69 }
70 inline double FuncPairEllipseCircle::operator()(const double &phi) {
71 return -2 * b * (b2(0) * d(0) + b2(1) * d(1) + b2(2) * d(2)) * cos(phi) + 2 * a * (b1(0) * d(0) + b1(1) * d(1) + b1(2) * d(2)) * sin(phi) + ((a * a) - (b * b)) * sin(2 * phi);
72 }
73 inline fmatvec::Vec3 FuncPairEllipseCircle::evalWrD(const double &phi) {
74 return d + b1 * a * cos(phi) + b2 * b * sin(phi);
75 }
76
77 }
78
79 #endif
MBSim::FuncPairEllipseCircle
root function for planar pairing Ellipse and Circle
Definition: funcpair_ellipse_circle.h:33
MBSim::FuncPairEllipseCircle::FuncPairEllipseCircle
FuncPairEllipseCircle(double R_, double a_, double b_, bool el_IN_ci_)
constructor
Definition: funcpair_ellipse_circle.h:53
MBSim::FuncPairEllipseCircle::FuncPairEllipseCircle
FuncPairEllipseCircle(double R_, double a_, double b_)
constructor
Definition: funcpair_ellipse_circle.h:42
MBSim::FuncPairConeSectionCircle
base root function for planar pairing ConeSection and Circle
Definition: funcpair_conesection_circle.h:32
MBSim::FuncPairConeSectionCircle::b1
fmatvec::Vec3 b1
normed base-vectors of cone-section
Definition: funcpair_conesection_circle.h:80
MBSim::FuncPairConeSectionCircle::d
fmatvec::Vec3 d
distance-vector of cone-section- and circle-midpoint
Definition: funcpair_conesection_circle.h:85
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30