예제 #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
 public AngleWrapper(AngleWrapper angle)
 {
     setRadian(angle.radian());
 }
예제 #3
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;
        }
예제 #4
0
 public AngleWrapper(AngleWrapper angle)
 {
     setRadian(angle.radian());
 }