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:
41 
45  virtual ~edgePolyFrustum();
46 
50  void setAdir(const fmatvec::Vec3 & A, const fmatvec::Vec3 & dir);
51 
52  fmatvec::Vec operator()(const fmatvec::Vec &x);
53 
54  protected:
59 
64 
69  };
70 
72  public:
76  edgePolyFrustumCriteria(const double & tolerance_ = 1e-10);
77 
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  virtual int operator ()(const fmatvec::Vec &x);
106  virtual bool isBetter(const fmatvec::Vec &x, const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT));
107  virtual void clear(){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 
128 
132  std::vector<double> criteriaResults;
133 
137  double ax;
138 
142  double dx;
143  };
144 
152  public:
155 
156  /* INHERITED INTERFACE OF CONTACTKINEAMTICS */
157  void assignContours(const std::vector<Contour*> &contour);
158  virtual void updateg(double & g, std::vector<ContourFrame*> &cFrame, int index = 0);
159  virtual void updatewb(fmatvec::Vec& wb, double g, std::vector<ContourFrame*> &cFrame) {
160  throw MBSimError("(ContactKinematicsPlatePolynomialFrustum::updatewb): not implemented!");
161  }
162 
163  void setGridSizeY(int gridSizeY_);
164  void setGridSizeZ(int gridSizeZ_);
165 
166  protected:
170  void setFrustumOrienationKinematics(const double & x, const double & phi, std::vector<ContourFrame*> &cFrame);
171 
172  /***************************************************/
179  bool cpLocationInPlate(double & g, std::vector<ContourFrame*> &cFrame);
180 
185  bool gridContact(double & g, std::vector<ContourFrame*> &cFrame);
186 
191  bool cornerContact(double & g, std::vector<ContourFrame*> &cFrame);
192 
199  bool edgeContact(double & g, std::vector<ContourFrame*> &cFrame);
200 
207  fmatvec::Vec3 computeContourPointFrustum(const double & x, const fmatvec::Vec3 & n);
208 
215  fmatvec::Vec3 computeContourPoint(const double & x, const fmatvec::Vec3 & n);
216 
222  int checkPossibleContactPoint(const double & x, const fmatvec::Vec3 & n);
223 
228  double distance2Plate(const fmatvec::Vec3 & point);
229 
233  void updateGrid();
234 
238  int iplate;
239 
243  int ifrustum;
244 
249 
254 
258  double signh;
259 
264 
269 
273  double x1;
274 
278  double x2;
279 
283  fmatvec::Vec3 cornerPoints[4];
284 
288  std::vector<std::vector<fmatvec::Vec3> > gridPoints;
289 
294 
299 
304 
309 
314 
319 
324 
329 
334 
339 
343  int ilast;
344 
349 
350  fmatvec::Vec2 zeta;
351  };
352 
353 } /* namespace MBSim */
354 #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
std::vector< double > criteriaResults
saves the results of the criteria
Definition: plate_polynomialfrustum.h:132
virtual void clear()
deletes the list of criteria results
Definition: plate_polynomialfrustum.h:107
fmatvec::Vec3 cornerPoints[4]
array of the four corner points of the plate in the frame of the frustum
Definition: plate_polynomialfrustum.h:283
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:61
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:268
int ilast
index of last edge contact
Definition: plate_polynomialfrustum.h:343
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
virtual ~edgePolyFrustumCriteria()
Destructor.
Definition: plate_polynomialfrustum.h:81
double ax
xPosition of starting Point
Definition: plate_polynomialfrustum.h:137
GlobalResidualCriteriaFunction criteriaProjectAlongNormal
criteria for newton method
Definition: plate_polynomialfrustum.h:308
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:288
bool cornerContact(double &g, std::vector< ContourFrame * > &cFrame)
checks if there is a contact point at one of the corner points
Definition: plate_polynomialfrustum.cc:307
MBSim::projectPointAlongNormalJacobian * jacobianProjectAlongNormal
Jacobian for newton method.
Definition: plate_polynomialfrustum.h:303
Plate * plate
pointer to the contour class for the plate
Definition: plate_polynomialfrustum.h:248
MBSim::NumericalNewtonJacobianFunction jacobianEdge
Jacobian for newton method.
Definition: plate_polynomialfrustum.h:328
edgePolyFrustumCriteria criteriaEdge
criteria for newton method
Definition: plate_polynomialfrustum.h:333
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:293
Frustum contour with a polynomial radius over height course.
Definition: polynomial_frustum.h:38
virtual void updateg(double &g, std::vector< ContourFrame * > &cFrame, int index=0)
compute normal distance, possible contact point positions and orientation (cf. contact.cc)
Definition: plate_polynomialfrustum.cc:451
double dx
xdirection
Definition: plate_polynomialfrustum.h:142
MBSim::MultiDimensionalNewtonMethod newtonProjectAlongNormal
newton method for solving the edge contact
Definition: plate_polynomialfrustum.h:298
double frustumHeight
height of frustum
Definition: plate_polynomialfrustum.h:127
int iplate
contour index of plate (in cpData)
Definition: plate_polynomialfrustum.h:238
double tolerance
tolerance value for the criteria results
Definition: plate_polynomialfrustum.h:122
virtual bool isBetter(const fmatvec::Vec &x, const fmatvec::Vec &fVal=fmatvec::Vec(0, fmatvec::NONINIT))
compares the result of given vector with the last result and returns if it got better (for damping) ...
Definition: plate_polynomialfrustum.cc:83
edgePolyFrustum * funcEdge
function for intersection point
Definition: plate_polynomialfrustum.h:318
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:338
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:258
double x2
save last value to use it again as starting value for equation 2
Definition: plate_polynomialfrustum.h:278
void assignContours(const std::vector< Contour * > &contour)
treats ordering of contours
Definition: plate_polynomialfrustum.cc:115
function that is zero for a height-coordinate of the polynomial frustum on which the normal on that p...
Definition: point_polynomialfrustum.h:34
virtual void updatewb(fmatvec::Vec &wb, double g, std::vector< ContourFrame * > &cFrame)
compute acceleration in terms of contour parameters for event driven integration
Definition: plate_polynomialfrustum.h:159
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
bool gridContact(double &g, std::vector< ContourFrame * > &cFrame)
if the unique contact point cannot be found a grid is walked through and a weighted sum results in th...
Definition: plate_polynomialfrustum.cc:244
MBSim::MultiDimensionalNewtonMethod newtonEdge
newton method for solving the edge contact
Definition: plate_polynomialfrustum.h:323
Definition: planar_contour.h:31
MBSim::StandardDampingFunction dampingProjectAlongNormal
damping function for newton method
Definition: plate_polynomialfrustum.h:313
int ifrustum
contour index of frustum (in cpData)
Definition: plate_polynomialfrustum.h:243
bool cpLocationInPlate(double &g, std::vector< ContourFrame * > &cFrame)
check if there is a contact point within the plate between the frustum and the plate ...
Definition: plate_polynomialfrustum.cc:164
fmatvec::Vec xi
last position of edge contact
Definition: plate_polynomialfrustum.h:348
bool inBounds(const double &t)
checks if current point fullfills the boundary conditions
Definition: plate_polynomialfrustum.cc:96
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
PolynomialFrustum * frustum
pointer to the contour class for the polynomial frustum
Definition: plate_polynomialfrustum.h:253
void updateGrid()
updates the grid for the discrete contact point approximation
Definition: plate_polynomialfrustum.cc:540
basic error class for mbsim
Definition: mbsim_event.h:38
Definition: damping_functions.h:64
virtual int operator()(const fmatvec::Vec &x)
computes the criteria
Definition: plate_polynomialfrustum.cc:71
basic class for contact kinematical calculations
Definition: contact_kinematics.h:39
int gridSizeY
grid size in y-direction for the search with grid points
Definition: plate_polynomialfrustum.h:263
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
void setFrustumOrienationKinematics(const double &x, const double &phi, std::vector< ContourFrame * > &cFrame)
set the values for the contact kinematics for the frustum due to the given x and phi ...
Definition: plate_polynomialfrustum.cc:158
edgePolyFrustumCriteria(const double &tolerance_=1e-10)
Constructor.
Definition: plate_polynomialfrustum.cc:67
double x1
save last value to use it again as starting value for equation 1
Definition: plate_polynomialfrustum.h:273
bool edgeContact(double &g, std::vector< ContourFrame * > &cFrame)
checks if there is a contact on one edge of the plate
Definition: plate_polynomialfrustum.cc:377
edgePolyFrustum(const PolynomialFrustum *frustum)
constructor
Definition: plate_polynomialfrustum.cc:34
void setdirectionXCoordinate(const double &dx_)
set starting x coordinate
Definition: plate_polynomialfrustum.h:100
virtual ~edgePolyFrustum()
standard destructor
Definition: plate_polynomialfrustum.cc:38

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML