Esempio n. 1
0
        //rotates a point around a center and an angle
        public static Point2D rotate(Point2D point, Point2D center, double angle)
        {
            double length   = Point2D.sub(point, center).length();
            double oldAngle = angleToPoint(point, center);

            return(new Point2D(
                       Point2D.add(
                           Point2D.multiplyBy(
                               new Point2D(Math.Cos(oldAngle + angle), Math.Sin(oldAngle + angle)), length),
                           center)));
        }
Esempio n. 2
0
 public void setAttributes(Point2D startpoint, Point2D endpoint, Point2D center, bool driveRight, bool reverse, double speed, double angle, double direction)
 {
     if (!m_initialized)
     {
         setAttributes(startpoint, endpoint, reverse, speed, direction);
         m_center     = center;
         m_driveRight = driveRight;
         m_angle      = angle;
         m_radius     = Point2D.sub(m_center, m_startpoint).length();
         m_direction  = direction;
         updateAngle();
         m_initialized = true;
     }
 }
Esempio n. 3
0
 public override Point2D position(double d)
 {
     return(Point2D.add(m_startpoint, Point2D.multiplyBy((Point2D.sub(m_endpoint, m_startpoint).normalize()), d)));
 }
Esempio n. 4
0
 public override double pathlength()
 {
     return(Point2D.sub(m_startpoint, m_endpoint).length());
 }