Esempio n. 1
0
    public JointPoint getOtherJointPoint(JointPoint joint)
    {
        if (joint.Equals(endPoints[0]))
        {
            return(endPoints[1]);
        }

        return(endPoints[0]);
    }
Esempio n. 2
0
    /*
     * Returns the direction (left or right) to that the current path is bent.
     * -1 is left, 1 is right.
     * */
    private int getRedirectionDirection(JointPoint joint, Curve curve)
    {
        if (joint.Equals(data.jointPointA))
        {
            JointPoint endJoint = curve.getOtherJointPoint(joint);
            if (endJoint.Equals(data.jointPointB))
            {
                return(-1);
            }
            if (endJoint.Equals(data.jointPointC))
            {
                return(1);
            }
        }
        if (joint.Equals(data.jointPointB))
        {
            JointPoint endJoint = curve.getOtherJointPoint(joint);
            if (endJoint.Equals(data.jointPointA))
            {
                return(1);
            }
            if (endJoint.Equals(data.jointPointC))
            {
                return(-1);
            }
        }
        if (joint.Equals(data.jointPointC))
        {
            JointPoint endJoint = curve.getOtherJointPoint(joint);
            if (endJoint.Equals(data.jointPointB))
            {
                return(1);
            }
            if (endJoint.Equals(data.jointPointA))
            {
                return(-1);
            }
        }

        return(0);
    }
Esempio n. 3
0
    /*
     * Returns the sign for the angle (curve to the right 1 or left -1?)
     * */
    public int getSignOfCurve(JointPoint startJointPoint, JointPoint endJointPoint)
    {
        if (startJointPoint.Equals(jointPointA))
        {
            if (endJointPoint.Equals(jointPointB))
            {
                return(-1);
            }
            if (endJointPoint.Equals(jointPointC))
            {
                return(1);
            }
        }
        if (startJointPoint.Equals(jointPointB))
        {
            if (endJointPoint.Equals(jointPointA))
            {
                return(1);
            }
            if (endJointPoint.Equals(jointPointC))
            {
                return(-1);
            }
        }
        if (startJointPoint.Equals(jointPointC))
        {
            if (endJointPoint.Equals(jointPointB))
            {
                return(1);
            }
            if (endJointPoint.Equals(jointPointA))
            {
                return(-1);
            }
        }

        return(-1);
    }
Esempio n. 4
0
 /*
  * Returns the index at that a curve/path is connected to a joint/intersection.
  * 0 index is always the curve with large radius to the next joint (e.g. A to B, B to C).
  * Then index is increasing clockwise.
  * */
 public int getPathIndex(JointPoint joint, Curve curve)
 {
     if (joint.Equals(jointPointA))
     {
         if (curve.Equals(curveABsmallRadius))
         {
             return(1);
         }
         if (curve.Equals(curveABlargeRadius))
         {
             return(0);
         }
         if (curve.Equals(curveACsmallRadius))
         {
             return(2);
         }
         if (curve.Equals(curveAClargeRadius))
         {
             return(3);
         }
     }
     if (joint.Equals(jointPointB))
     {
         if (curve.Equals(curveABsmallRadius))
         {
             return(2);
         }
         if (curve.Equals(curveABlargeRadius))
         {
             return(3);
         }
         if (curve.Equals(curveBCsmallRadius))
         {
             return(1);
         }
         if (curve.Equals(curveBClargeRadius))
         {
             return(0);
         }
     }
     if (joint.Equals(jointPointC))
     {
         if (curve.Equals(curveBCsmallRadius))
         {
             return(2);
         }
         if (curve.Equals(curveBClargeRadius))
         {
             return(3);
         }
         if (curve.Equals(curveACsmallRadius))
         {
             return(1);
         }
         if (curve.Equals(curveAClargeRadius))
         {
             return(0);
         }
     }
     return(0);
 }