mbsim  4.0.0
MBSim Kernel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
plate_polynomialfrustum.h
1 /* Copyright (C) 2004-2012 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 AREA_POLYNOMIALFRUSTUM_H_
21 #define AREA_POLYNOMIALFRUSTUM_H_
22 
23 #include "contact_kinematics.h"
24 
25 #include <mbsim/contours/polynomial_frustum.h>
26 #include <mbsim/contours/plate.h>
27 #include <mbsim/numerics/nonlinear_algebra/multi_dimensional_newton_method.h>
28 #include <mbsim/contact_kinematics/point_polynomialfrustum.h>
29 
30 namespace MBSim {
31 
35  class edgePolyFrustum : public Function<fmatvec::Vec(fmatvec::Vec)> {
36  public:
40  edgePolyFrustum(const PolynomialFrustum * frustum_);
41 
45  ~edgePolyFrustum() override;
46 
50  void setAdir(const fmatvec::Vec3 & A_, const fmatvec::Vec3 & dir_);
51 
52  fmatvec::Vec operator()(const fmatvec::Vec &xin) override;
53 
54  protected:
59 
63  fmatvec::Vec A;
64 
68  fmatvec::Vec dir;
69  };
70 
72  public:
76  edgePolyFrustumCriteria(const double & tolerance_ = 1e-10);
77 
81  ~edgePolyFrustumCriteria() override= default;;
82 
86  void setFrustumHeight(const double & frustumHeight_) {
87  frustumHeight = frustumHeight_;
88  }
89 
93  void setStartingXCoordinate(const double & ax_) {
94  ax = ax_;
95  }
96 
100  void setdirectionXCoordinate(const double & dx_) {
101  dx = dx_;
102  }
103 
104  /* INHERITED INTERFACE */
105  int operator ()(const fmatvec::Vec &xin) override;
106  bool isBetter(const fmatvec::Vec &x, const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT)) override;
107  void clear() override{criteriaResults.clear();}
108  /*END - INHERITED INTERFACE*/
109 
110  const std::vector<double> & getResults() {
111  return criteriaResults;
112  }
113 
114  protected:
118  bool inBounds(const double & t);
122  double tolerance;
123 
127  double frustumHeight{-1};
128 
132  std::vector<double> criteriaResults;
133 
137  double ax{0.};
138 
142  double dx{0.};
143  };
144 
152  public:
155 
156  /* INHERITED INTERFACE OF CONTACTKINEAMTICS */
157  void assignContours(const std::vector<Contour*> &contour) override;
158  void updateg(SingleContact &contact, int i=0) override;
159 
160  void setGridSizeY(int gridSizeY_);
161  void setGridSizeZ(int gridSizeZ_);
162 
163  protected:
167  void setFrustumOrienationKinematics(const double & x, const double & phi, SingleContact &contact);
168 
169  /***************************************************/
176  bool cpLocationInPlate(SingleContact &contact);
177 
182  bool gridContact(SingleContact &contact);
183 
188  bool cornerContact(SingleContact &contact);
189 
196  bool edgeContact(SingleContact &contact);
197 
204  fmatvec::Vec3 computeContourPointFrustum(const double & x, const fmatvec::Vec3 & n);
205 
212  fmatvec::Vec3 computeContourPoint(const double & x, const fmatvec::Vec3 & n);
213 
219  int checkPossibleContactPoint(const double & x, const fmatvec::Vec3 & n);
220 
225  double distance2Plate(const fmatvec::Vec3 & point);
226 
230  void updateGrid();
231 
235  int iplate{-1};
236 
240  int ifrustum{-1};
241 
245  Plate *plate{nullptr};
246 
251 
255  double signh{1.};
256 
260  int gridSizeY{5};
261 
265  int gridSizeZ{5};
266 
270  double x1{-1};
271 
275  double x2{-1};
276 
280  fmatvec::Vec3 cornerPoints[4];
281 
285  std::vector<std::vector<fmatvec::Vec3>> gridPoints;
286 
291 
296 
301 
306 
311 
316 
321 
326 
331 
336 
340  int ilast{-1};
341 
345  fmatvec::Vec xi;
346 
347  fmatvec::Vec2 zeta;
348  };
349 
350 } /* namespace MBSim */
351 #endif /* AREA_POLYNOMIALFRUSTUM_H_ */
This criteria function class applies the infinity norm globally on the complete vector and compares i...
Definition: criteria_functions.h:170
Newton method for multidimensional root finding.
Definition: multi_dimensional_newton_method.h:41
void setAdir(const fmatvec::Vec3 &A_, const fmatvec::Vec3 &dir_)
set the one corner point A and the direction of the edge with (A + dir) is the other corner point ...
Definition: plate_polynomialfrustum.cc:41
std::vector< double > criteriaResults
saves the results of the criteria
Definition: plate_polynomialfrustum.h:132
fmatvec::Vec3 cornerPoints[4]
array of the four corner points of the plate in the frame of the frustum
Definition: plate_polynomialfrustum.h:280
double distance2Plate(const fmatvec::Vec3 &point)
compute distance between given point and plate
Definition: plate_polynomialfrustum.cc:536
class to compute the Jacobian matrix for the newton method numerically
Definition: newton_method_jacobian_functions.h:60
bool gridContact(SingleContact &contact)
if the unique contact point cannot be found a grid is walked through and a weighted sum results in th...
Definition: plate_polynomialfrustum.cc:239
fmatvec::Vec dir
direction of edge
Definition: plate_polynomialfrustum.h:68
int gridSizeZ
grid size in z-direction for the search with grid points
Definition: plate_polynomialfrustum.h:265
void updateg(SingleContact &contact, int i=0) override
compute contact kinematics for a single contact
Definition: plate_polynomialfrustum.cc:451
~edgePolyFrustumCriteria() override=default
Destructor.
int ilast
index of last edge contact
Definition: plate_polynomialfrustum.h:340
fmatvec::Vec3 computeContourPointFrustum(const double &x, const fmatvec::Vec3 &n)
computes the point on the contour of the frustum due to the height-coordinate x and the normal in wor...
Definition: plate_polynomialfrustum.cc:512
double ax
xPosition of starting Point
Definition: plate_polynomialfrustum.h:137
~edgePolyFrustum() override
standard destructor
GlobalResidualCriteriaFunction criteriaProjectAlongNormal
criteria for newton method
Definition: plate_polynomialfrustum.h:305
class for contact kinematics between convex frustum and an plate
Definition: plate_polynomialfrustum.h:151
std::vector< std::vector< fmatvec::Vec3 > > gridPoints
saves the points for the contact point computation
Definition: plate_polynomialfrustum.h:285
MBSim::projectPointAlongNormalJacobian * jacobianProjectAlongNormal
Jacobian for newton method.
Definition: plate_polynomialfrustum.h:300
Plate * plate
pointer to the contour class for the plate
Definition: plate_polynomialfrustum.h:245
MBSim::NumericalNewtonJacobianFunction jacobianEdge
Jacobian for newton method.
Definition: plate_polynomialfrustum.h:325
void setFrustumOrienationKinematics(const double &x, const double &phi, SingleContact &contact)
set the values for the contact kinematics for the frustum due to the given x and phi ...
Definition: plate_polynomialfrustum.cc:152
edgePolyFrustumCriteria criteriaEdge
criteria for newton method
Definition: plate_polynomialfrustum.h:330
void setStartingXCoordinate(const double &ax_)
set starting x coordinate
Definition: plate_polynomialfrustum.h:93
MBSim::projectPointAlongNormal * funcProjectAlongNormal
function for intersection point
Definition: plate_polynomialfrustum.h:290
Frustum contour with a polynomial radius over height course.
Definition: polynomial_frustum.h:38
double dx
xdirection
Definition: plate_polynomialfrustum.h:142
MBSim::MultiDimensionalNewtonMethod newtonProjectAlongNormal
newton method for solving the edge contact
Definition: plate_polynomialfrustum.h:295
double frustumHeight
height of frustum
Definition: plate_polynomialfrustum.h:127
int iplate
contour index of plate (in cpData)
Definition: plate_polynomialfrustum.h:235
double tolerance
tolerance value for the criteria results
Definition: plate_polynomialfrustum.h:122
bool cpLocationInPlate(SingleContact &contact)
check if there is a contact point within the plate between the frustum and the plate ...
Definition: plate_polynomialfrustum.cc:158
edgePolyFrustum * funcEdge
function for intersection point
Definition: plate_polynomialfrustum.h:315
Function describing the scalar product between normal of frustum point and difference between frustum...
Definition: plate_polynomialfrustum.h:35
RigidContour Plate.
Definition: plate.h:37
Definition: plate_polynomialfrustum.h:71
void setFrustumHeight(const double &frustumHeight_)
set frustum height
Definition: plate_polynomialfrustum.h:86
MBSim::StandardDampingFunction dampingEdge
damping function for newton method
Definition: plate_polynomialfrustum.h:335
edgePolyFrustum(const PolynomialFrustum *frustum_)
constructor
Definition: plate_polynomialfrustum.cc:35
fmatvec::Vec3 computeContourPoint(const double &x, const fmatvec::Vec3 &n)
computes the point on the contour of the frustum due to the height-coordinate x and the normal in wor...
Definition: plate_polynomialfrustum.cc:524
fmatvec::Vec A
position of starting point on the line
Definition: plate_polynomialfrustum.h:63
double signh
sign of height-direction
Definition: plate_polynomialfrustum.h:255
double x2
save last value to use it again as starting value for equation 2
Definition: plate_polynomialfrustum.h:275
function that is zero for a height-coordinate of the polynomial frustum on which the normal on that p...
Definition: point_polynomialfrustum.h:34
Mother class for different criterias that are fulfilled or not.
Definition: criteria_functions.h:33
the Jacobian function for the projectAlongNormal Function
Definition: point_polynomialfrustum.h:64
MBSim::MultiDimensionalNewtonMethod newtonEdge
newton method for solving the edge contact
Definition: plate_polynomialfrustum.h:320
Definition: contact_kinematics.h:32
MBSim::StandardDampingFunction dampingProjectAlongNormal
damping function for newton method
Definition: plate_polynomialfrustum.h:310
int ifrustum
contour index of frustum (in cpData)
Definition: plate_polynomialfrustum.h:240
void assignContours(const std::vector< Contour * > &contour) override
treats ordering of contours
Definition: plate_polynomialfrustum.cc:109
fmatvec::Vec xi
last position of edge contact
Definition: plate_polynomialfrustum.h:345
bool inBounds(const double &t)
checks if current point fullfills the boundary conditions
Definition: plate_polynomialfrustum.cc:93
bool cornerContact(SingleContact &contact)
checks if there is a contact point at one of the corner points
Definition: plate_polynomialfrustum.cc:304
PolynomialFrustum * frustum
pointer to the contour class for the polynomial frustum
Definition: plate_polynomialfrustum.h:250
void updateGrid()
updates the grid for the discrete contact point approximation
Definition: plate_polynomialfrustum.cc:540
Definition: damping_functions.h:63
int operator()(const fmatvec::Vec &xin) override
computes the criteria
Definition: plate_polynomialfrustum.cc:71
class for contacts
Definition: single_contact.h:46
basic class for contact kinematical calculations
Definition: contact_kinematics.h:41
int gridSizeY
grid size in y-direction for the search with grid points
Definition: plate_polynomialfrustum.h:260
void clear() override
deletes the list of criteria results
Definition: plate_polynomialfrustum.h:107
const PolynomialFrustum * frustum
polynomials of frustum contour
Definition: plate_polynomialfrustum.h:58
int checkPossibleContactPoint(const double &x, const fmatvec::Vec3 &n)
check if frustum point identified by coordinate x is possible contact point
Definition: plate_polynomialfrustum.cc:528
edgePolyFrustumCriteria(const double &tolerance_=1e-10)
Constructor.
Definition: plate_polynomialfrustum.cc:67
bool isBetter(const fmatvec::Vec &x, const fmatvec::Vec &fVal=fmatvec::Vec(0, fmatvec::NONINIT)) override
compares the result of given vector with the last result and returns if it got better (for damping) ...
Definition: plate_polynomialfrustum.cc:83
double x1
save last value to use it again as starting value for equation 1
Definition: plate_polynomialfrustum.h:270
void setdirectionXCoordinate(const double &dx_)
set starting x coordinate
Definition: plate_polynomialfrustum.h:100
bool edgeContact(SingleContact &contact)
checks if there is a contact on one edge of the plate
Definition: plate_polynomialfrustum.cc:376