Ejemplo n.º 1
0
    public override bool Equals(object obj)
    {
        if (obj == null || obj.GetType() != this.GetType())
        {
            return(false);
        }
        if (object.ReferenceEquals(this, obj))
        {
            return(true);
        }
        XYObstacleLine other = (XYObstacleLine)obj;

        return(this == other);
    }
Ejemplo n.º 2
0
    public static void WriteToText(TextWriter writer, XYObstacleLineList lines)
    {
        List <XYGridPos>      pointList = new List <XYGridPos>(lines.Count * 2);
        List <LinePointIndex> indexList = new List <LinePointIndex>(lines.Count);

        for (int i = 0; i < lines.Count; ++i)
        {
            XYObstacleLine line = lines[i];
            LinePointIndex lpi;
            lpi.p1 = GetPointIndex(pointList, line.Begin);
            lpi.p2 = GetPointIndex(pointList, line.End);
            indexList.Add(lpi);
        }
        //
        writer.WriteLine("{0} {1} 0", pointList.Count.ToString(), indexList.Count.ToString());
        foreach (XYGridPos pos in pointList)
        {
            writer.WriteLine("{0} {1} 0", pos.x.ToString(), pos.y.ToString());
        }
        foreach (LinePointIndex lpi in indexList)
        {
            writer.WriteLine("{0} {1}", (lpi.p1 + 1).ToString(), (lpi.p2 + 1).ToString());
        }
    }
Ejemplo n.º 3
0
 // 判断两线是否相交
 public static bool LinesIntersect(XYObstacleLine line1, XYObstacleLine line2)
 {
     return(LinesIntersect(line1.Begin, line1.End, line2.Begin, line2.End));
 }
Ejemplo n.º 4
0
 // 判断两条线的斜率是否相等
 public bool IsSlopeEqual(XYObstacleLine other)
 {
     return(deltaY * other.deltaX == deltaX * other.deltaY);
 }