mbsim  4.0.0
MBSim Kernel
funcpair_conesection_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_CONESECTION_CIRCLE_H_
21#define _FUNCPAIR_CONESECTION_CIRCLE_H_
22
23#include <mbsim/functions/function.h>
24
25namespace MBSim {
26
32 class FuncPairConeSectionCircle : public Function<double(double)> {
33 public:
41 FuncPairConeSectionCircle(double R_,double a_,double b_) : R(R_), a(a_), b(b_), sec_IN_ci(true) {}
42
50 FuncPairConeSectionCircle(double R_, double a_, double b_, bool sec_IN_ci_) :
51 R(R_), a(a_), b(b_), sec_IN_ci(sec_IN_ci_) {
52 }
53
54 /* INHERITED INTERFACE OF DISTANCEFUNCTION */
55 double operator()(const double &phi) override = 0;
56 double operator[](const double &phi);
57 virtual fmatvec::Vec3 evalWrD(const double &phi) = 0;
58 /*************************************************/
59
60 /* GETTER / SETTER */
61 void setDiffVec(fmatvec::Vec3 d_);
62
63 void setSectionCOS(fmatvec::Vec3 b1_, fmatvec::Vec3 b2_);
64 /*************************************************/
65
66 protected:
70 double R, a, b;
71
76
80 fmatvec::Vec3 b1, b2;
81
85 fmatvec::Vec3 d;
86 };
87
88 inline void FuncPairConeSectionCircle::setDiffVec(fmatvec::Vec3 d_) {
89 d = d_;
90 }
91 inline void FuncPairConeSectionCircle::setSectionCOS(fmatvec::Vec3 b1_, fmatvec::Vec3 b2_) {
92 b1 = b1_;
93 b2 = b2_;
94 }
95 inline double FuncPairConeSectionCircle::operator[](const double &phi) {
96 if (sec_IN_ci)
97 return R - nrm2(evalWrD(phi));
98 else
99 return nrm2(evalWrD(phi)) - R;
100 }
101
102}
103
104#endif
base root function for planar pairing ConeSection and Circle
Definition: funcpair_conesection_circle.h:32
fmatvec::Vec3 b1
normed base-vectors of cone-section
Definition: funcpair_conesection_circle.h:80
bool sec_IN_ci
cone-section in circle
Definition: funcpair_conesection_circle.h:75
FuncPairConeSectionCircle(double R_, double a_, double b_, bool sec_IN_ci_)
constructor
Definition: funcpair_conesection_circle.h:50
fmatvec::Vec3 d
distance-vector of cone-section- and circle-midpoint
Definition: funcpair_conesection_circle.h:85
double R
radius of circle as well as length in b1- and b2-direction
Definition: funcpair_conesection_circle.h:70
FuncPairConeSectionCircle(double R_, double a_, double b_)
constructor
Definition: funcpair_conesection_circle.h:41
Definition: function.h:53
namespace MBSim
Definition: bilateral_constraint.cc:30