⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geometry.h

📁 uva trilearn的robocup源程序
💻 H
📖 第 1 页 / 共 2 页
字号:
  bool               isInFrontOf            ( const double      &d            );  bool               isBehindOf             ( const VecPosition &p            );  bool               isBehindOf             ( const double      &d            );  bool               isLeftOf               ( const VecPosition &p            );  bool               isLeftOf               ( const double      &d            );  bool               isRightOf              ( const VecPosition &p            );  bool               isRightOf              ( const double      &d            );  bool               isBetweenX             ( const VecPosition &p1,                                              const VecPosition &p2           );  bool               isBetweenX             ( const double      &d1,                                              const double      &d2           );  bool               isBetweenY             ( const VecPosition &p1,                                              const VecPosition &p2           );  bool               isBetweenY             ( const double      &d1,                                              const double      &d2           );  // conversion methods for positions  VecPosition        normalize              (                                 );  VecPosition        rotate                 ( AngDeg            angle         );  VecPosition        globalToRelative       ( VecPosition       orig,                                              AngDeg            ang           );  VecPosition        relativeToGlobal       ( VecPosition       orig,                                              AngDeg            ang           );  VecPosition        getVecPositionOnLineFraction( VecPosition  &p,                                              double            dFrac         );  // static class methods  static VecPosition getVecPositionFromPolar( double            dMag,                                              AngDeg            ang           );  static AngDeg      normalizeAngle         ( AngDeg            angle         );};/******************************************************************************//*********************   CLASS GEOMETRY   *************************************//******************************************************************************//*! This class contains several static methods dealing with geometry.*/class Geometry{public:  // geometric series  static double getLengthGeomSeries(double dFirst,double dRatio,double dSum   );  static double getSumGeomSeries   (double dFirst,double dRatio,double dLength);  static double getSumInfGeomSeries(double dFirst,double dRatio               );  static double getFirstGeomSeries (double dSum,  double dRatio,double dLength);  static double getFirstInfGeomSeries(double dSum,double dRatio               );  // abc formula  static int    abcFormula(double a,double b, double c, double *s1, double *s2);};/******************************************************************************//********************** CLASS CIRCLE ******************************************//******************************************************************************//*!This class represents a circle. A circle is defined by one VecPosition   (which denotes the center) and its radius. */class Circle{    VecPosition m_posCenter;            /*!< Center of the circle  */    double      m_dRadius;              /*!< Radius of the circle  */public:    Circle( );    Circle( VecPosition pos, double dR );    void        show                  ( ostream& os = cout );    // get and set methods    bool        setCircle             ( VecPosition pos,                                         double      dR  );    bool        setRadius             ( double dR       );    double      getRadius             (                 );    bool        setCenter             ( VecPosition pos );    VecPosition getCenter             (                 );    double      getCircumference      (                 );    double      getArea               (                 );    // calculate intersection points and area with other circle    bool        isInside              ( VecPosition pos );    int         getIntersectionPoints ( Circle      c,                                         VecPosition *p1,                                         VecPosition *p2 );    double      getIntersectionArea   ( Circle c        );}  ;/******************************************************************************//*********************** CLASS LINE *******************************************//******************************************************************************//*!This class contains the representation of a line. A line is defined   by the formula ay + bx + c = 0. The coefficients a, b and c are stored   and used in the calculations. */class Line{  // a line is defined by the formula: ay + bx + c = 0  double m_a; /*!< This is the a coefficient in the line ay + bx + c = 0 */  double m_b; /*!< This is the b coefficient in the line ay + bx + c = 0 */  double m_c; /*!< This is the c coefficient in the line ay + bx + c = 0 */public:  Line( double a, double b, double c );  // print methods  void        show( ostream& os = cout );  friend      ostream& operator << (ostream & os, Line l);  // get intersection points with this line  VecPosition getIntersection            ( Line        line                   );  int         getCircleIntersectionPoints( Circle      circle,                                           VecPosition *posSolution1,                                           VecPosition *posSolution2          );  Line        getTangentLine             ( VecPosition pos                    );  VecPosition getPointOnLineClosestTo    ( VecPosition pos                    );  double      getDistanceWithPoint       ( VecPosition pos                    );  bool        isInBetween                ( VecPosition pos,                                           VecPosition point1,                                           VecPosition point2                 );  // calculate associated variables in the line  double getYGivenX                      ( double      x );  double getXGivenY                      ( double      y );  double getACoefficient                 (               ) const;  double getBCoefficient                 (               ) const;  double getCCoefficient                 (               ) const;  // static methods to make a line using an easier representation.  static Line makeLineFromTwoPoints      ( VecPosition pos1,                                           VecPosition pos2                   );  static Line makeLineFromPositionAndAngle( VecPosition vec,                                           AngDeg angle                       );};/******************************************************************************//********************** CLASS RECTANGLE ***************************************//******************************************************************************//*!This class represents a rectangle. A rectangle is defined by two VecPositions   the one at the upper left corner and the one at the right bottom. */class Rectangle{  VecPosition m_posLeftTop;     /*!< top left position of the rectangle       */  VecPosition m_posRightBottom; /*!< bottom right position of the rectangle   */public:  Rectangle                     ( VecPosition pos, VecPosition pos2 );  void        show              ( ostream& os = cout                );  // checks whether point lies inside the rectangle  bool        isInside          ( VecPosition pos                   );  // standard get and set methosd  void        setRectanglePoints( VecPosition pos1,                                  VecPosition pos2                  );  bool        setPosLeftTop     ( VecPosition pos                   );  VecPosition getPosLeftTop     ( VecPosition pos                   );  bool        setPosRightBottom ( VecPosition pos                   );  VecPosition getPosRightBottom ( VecPosition pos                   );};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -