ThoughtWorks.QRCode/ThoughtWorks/QRCode/Geom/Line.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace ThoughtWorks.QRCode.Geom
{
    using System;
    using ThoughtWorks.QRCode.Codec.Util;

    public class Line
    {
        internal int x1;
        internal int y1;
        internal int x2;
        internal int y2;

        public Line()
        {
            this.x1 = this.y1 = this.x2 = this.y2 = 0;
        }

        public Line(Point p1, Point p2)
        {
            this.x1 = p1.X;
            this.y1 = p1.Y;
            this.x2 = p2.X;
            this.y2 = p2.Y;
        }

        public Line(int x1, int y1, int x2, int y2)
        {
            this.x1 = x1;
            this.y1 = y1;
            this.x2 = x2;
            this.y2 = y2;
        }

        public static Line getLongest(Line[] lines)
        {
            Line line = new Line();
            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].Length > line.Length)
                {
                    line = lines[i];
                }
            }
            return line;
        }

        public virtual Point getP1() => 
            new Point(this.x1, this.y1);

        public virtual Point getP2() => 
            new Point(this.x2, this.y2);

        public static bool isCross(Line line1, Line line2)
        {
            if (line1.Horizontal && line2.Vertical)
            {
                if ((((line1.getP1().Y > line2.getP1().Y) && (line1.getP1().Y < line2.getP2().Y)) && (line2.getP1().X > line1.getP1().X)) && (line2.getP1().X < line1.getP2().X))
                {
                    return true;
                }
后面还有 81 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。