예제 #1
0
        // Projection
        public override double referencePositionDefinitionValue(Point2D point)
        {
            if (point == m_center)
            {
                // In this case no projection can happen
                return(double.NaN);
            }

            // Calculates the intersection point of the circle and the line between cneter and the given point
            Point2D intersection = new Point2D(0, 0);
            double  l            = (point - m_center).length();

            intersection.x = m_center.x + (point.x - m_center.x) / l * m_radius;
            intersection.y = m_center.y + (point.y - m_center.y) / l * m_radius;
            // Calculates the absoulte angle of the line between center and the intersection point
            AngleWrapper intersectingAngle = new AngleWrapper(intersection - m_center);
            // Calculates the angle between the statpoint and the intersection point
            AngleWrapper angle = new AngleWrapper();

            angle = m_driveRight != m_reverse
                ? intersectingAngle - startAngle()
                : -intersectingAngle + startAngle();

            // Angle > 0.5*m_angle+PI give negative results
            if (angle.radian() > 3 * Math.PI / 2)
            {
                return((angle.radian() - 2 * Math.PI) * m_radius);
            }
            else
            {
                return(angle.radian() * m_radius);
            }
        }
예제 #2
0
        // updates the start and endangles
        public void updateAngle()
        {
            string s;

            m_endangle   = new AngleWrapper(m_endpoint - m_center).radian();
            m_startangle = new AngleWrapper(m_startpoint - m_center).radian();
            m_angle      = m_driveRight == m_reverse
                ? new AngleWrapper(endAngle() - startAngle()).radian()
                : new AngleWrapper(startAngle() - endAngle()).radian();
            m_direction = new AngleWrapper(m_direction).radian();
        }
예제 #3
0
        // Gives the orientation
        public double orientation(double d)
        {
            AngleWrapper angle = new AngleWrapper(startAngle());

            // Calculates the absolute angle
            angle += (m_driveRight == m_reverse)
                ? d / m_radius
                : -d / m_radius;
            // If in a left curve the orientation is perpencicular to the left and the other way around
            if (m_reverse)
            {
                return(angle.perpendicularRight().radian());
            }
            else
            {
                return(angle.perpendicularLeft().radian());
            }
        }
예제 #4
0
        // Projection

        public override double referencePositionDefinitionValue(Point2D point)
        {
            Point2D directionalVector = new AngleWrapper(m_endpoint - m_startpoint).unitVector();

            return(directionalVector.point(point - m_startpoint));
        }
예제 #5
0
 // Projection
 public override double referencePositionDefinitionValue(Point2D point)
 {
     Point2D directionalVector = new AngleWrapper(m_endpoint - m_startpoint).unitVector();
     return directionalVector.point(point - m_startpoint);
 }
예제 #6
0
 // Gives the orientation
 public double orientation(double d)
 {
     AngleWrapper angle = new AngleWrapper(startAngle());
     // Calculates the absolute angle
     angle += (m_driveRight == m_reverse)
         ? d / m_radius
         : -d / m_radius;
     // If in a left curve the orientation is perpencicular to the left and the other way around
     if (m_reverse)
         return angle.perpendicularRight().radian();
     else
         return angle.perpendicularLeft().radian();
 }
예제 #7
0
 // updates the start and endangles
 public void updateAngle()
 {
     string s;
     m_endangle = new AngleWrapper(m_endpoint - m_center).radian();
     m_startangle = new AngleWrapper(m_startpoint - m_center).radian();
     m_angle = m_driveRight == m_reverse
         ? new AngleWrapper(endAngle() - startAngle()).radian()
         : new AngleWrapper(startAngle() - endAngle()).radian();
     m_direction = new AngleWrapper(m_direction).radian();
 }
예제 #8
0
        // Projection
        public override double referencePositionDefinitionValue(Point2D point)
        {
            if (point == m_center)
                // In this case no projection can happen
                return double.NaN;

            // Calculates the intersection point of the circle and the line between cneter and the given point
            Point2D intersection= new Point2D(0,0);
            double l = (point - m_center).length();
            intersection.x= m_center.x + (point.x - m_center.x)/l * m_radius;
            intersection.y = m_center.y + (point.y - m_center.y) / l * m_radius;
            // Calculates the absoulte angle of the line between center and the intersection point
            AngleWrapper intersectingAngle = new AngleWrapper(intersection - m_center);
            // Calculates the angle between the statpoint and the intersection point
            AngleWrapper angle = new AngleWrapper();
            angle = m_driveRight != m_reverse
                ? intersectingAngle - startAngle()
                : -intersectingAngle + startAngle();

            // Angle > 0.5*m_angle+PI give negative results
            if (angle.radian()>3*Math.PI/2)
                return (angle.radian() - 2 * Math.PI) * m_radius;
            else
                return angle.radian() * m_radius;
        }
예제 #9
0
 public AngleWrapper(AngleWrapper angle)
 {
     setRadian(angle.radian());
 }
예제 #10
0
 public AngleWrapper(AngleWrapper angle)
 {
     setRadian(angle.radian());
 }