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ceRoot":"..","sourcesContent":["type Point = [number, number];\r\ntype Line = [Point, Point];\r\n\r\nexport class App {\r\n    private canvas: HTMLCanvasElement;\r\n    private ctx: CanvasRenderingContext2D;\r\n\r\n    private boundaries: Line[] = [];\r\n    private intersections: Array<{ point: Point, lines: Line[] }> = [];\r\n\r\n    constructor() {\r\n        this.canvas = document.getElementById('image') as HTMLCanvasElement;\r\n        this.ctx = this.canvas.getContext('2d');\r\n\r\n        this.canvas.width = window.innerWidth;\r\n        this.canvas.height = window.innerHeight ;\r\n    }\r\n\r\n    public run(): void {\r\n        console.clear();\r\n\r\n        const count = 5000;\r\n        const angle = Math.PI / 2 / count;\r\n        let n = 1000;\r\n        const routine = () => {\r\n            this.clear();\r\n            this.reset();\r\n\r\n            this.ctx.lineWidth = 0.5;\r\n            this.ctx.strokeStyle = '#000';\r\n            this.draw(this.intersections[0].point, n * angle);\r\n\r\n            n = n >= count ? 0 : n + 1;\r\n            window.requestAnimationFrame(routine);\r\n            // window.setTimeout(routine, 500);\r\n        };\r\n\r\n        window.requestAnimationFrame(routine);\r\n    }\r\n\r\n    public clear () {\r\n        this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\r\n    }\r\n\r\n    private reset () {\r\n        this.boundaries = [];\r\n        this.intersections = [];\r\n\r\n        const lt: Point = [0, 0];\r\n        const rt: Point = [this.canvas.width, 0];\r\n        const rb: Point = [this.canvas.width, this.canvas.height];\r\n        const lb: Point = [0, this.canvas.height];\r\n\r\n        this.intersections.push({ point: lt, lines: [[lt, rt], [lt, lb]]});\r\n        this.intersections.push({ point: rt, lines: [[rt, rb], [rt, lt]]});\r\n        this.intersections.push({ point: rb, lines: [[rb, rt], [rb, lb]]});\r\n        this.intersections.push({ point: lb, lines: [[lb, lt], [lb, rb]]});\r\n\r\n        this.boundaries.push([lt, rt]);\r\n        this.boundaries.push([rt, rb]);\r\n        this.boundaries.push([lb, rb]);\r\n        this.boundaries.push([lt, lb]);\r\n    }\r\n\r\n    private draw (point: Point = [0, 0], angle: number = (Math.PI / 2) * Math.random(), crossSelf: boolean = false) {\r\n        const maxLength = Math.sqrt(this.canvas.width * this.canvas.width + this.canvas.height * this.canvas.height);\r\n        const minLength = this.ctx.lineWidth * 2;\r\n        const lines: Line[] = [];\r\n\r\n        for (let i = 0; i < 1000; i++) {\r\n            const length = maxLength;\r\n            const target = [point[0] + length * Math.cos(angle), point[1] + length * Math.sin(angle)];\r\n\r\n            const int = this.boundaries.map((line, index) => {\r\n                const intersection = this.getLineIntersection(point[0], point[1], target[0], target[1], line[0][0], line[0][1], line[1][0], line[1][1]);\r\n                let distance = intersection !== null ? this.getDistance(point[0], point[1], intersection[0], intersection[1]) : 0;\r\n                distance = Math.round(distance * 10) / 10;\r\n                if (intersection === null || distance <= 0) { return null; }\r\n                return { intersection, distance, line };\r\n            }).filter((x) => x !== null).sort((a, b) => a.distance > b.distance ? 1 : -1)[0];\r\n\r\n            // exit condition\r\n            if (!int || this.getDistance(point[0], point[1], int.intersection[0], int.intersection[1]) <= minLength) {\r\n                break;\r\n            }\r\n\r\n            lines.push([point, int.intersection]);\r\n            if (!crossSelf) { this.boundaries.push(lines[lines.length - 1]); }\r\n            this.intersections.push({ point: int.intersection, lines: [[int.intersection, point], [int.intersection, int.line[0]]]});\r\n\r\n            const angleFix = this.getLineAngle(int.line);\r\n            const lineAngle = this.getLineAngle([point, target] as Line);\r\n\r\n            let fixedLineAngle = lineAngle - angleFix;\r\n\r\n            while (fixedLineAngle > Math.PI) { fixedLineAngle -= Math.PI * 2; }\r\n            while (fixedLineAngle < - Math.PI) { fixedLineAngle += Math.PI * 2; }\r\n\r\n            angle = -fixedLineAngle + angleFix;\r\n            point = int.intersection;\r\n        }\r\n\r\n        if (crossSelf) { this.boundaries = this.boundaries.concat(lines); }\r\n        this.drawLines(lines);\r\n    }\r\n\r\n    private drawPoint (point: Point, r: number = 5) {\r\n        this.ctx.lineWidth = 1;\r\n        this.ctx.strokeStyle = '#000';\r\n        this.ctx.fillStyle = '#900';\r\n\r\n        this.ctx.beginPath();\r\n        this.ctx.arc(point[0], point[1], r, 0, Math.PI * 2);\r\n        this.ctx.closePath();\r\n        this.ctx.stroke();\r\n\r\n        this.ctx.beginPath();\r\n        this.ctx.arc(point[0], point[1], 1, 0, Math.PI * 2);\r\n        this.ctx.closePath();\r\n        this.ctx.fill();\r\n    }\r\n\r\n    private drawLines(lines: Line[]) {\r\n        this.ctx.lineCap = 'round';\r\n        this.ctx.beginPath();\r\n        for (const line of lines) {\r\n            this.ctx.moveTo(line[0][0], line[0][1]);\r\n            this.ctx.lineTo(line[1][0], line[1][1]);\r\n        }\r\n        this.ctx.stroke();\r\n    }\r\n\r\n    private drawLine (from: Point, to: Point) {\r\n        this.ctx.lineCap = 'round';\r\n\r\n        this.ctx.beginPath();\r\n        this.ctx.moveTo(from[0], from[1]);\r\n        this.ctx.lineTo(to[0], to[1]);\r\n        this.ctx.stroke();\r\n    }\r\n\r\n    private getDistance (x1: number, y1: number, x2: number, y2: number): number {\r\n        const a = x2 - x1;\r\n        const b = y2 - y1;\r\n\r\n        return Math.sqrt(a * a + b * b);\r\n    }\r\n\r\n    private getLineIntersection(p0x: number, p0y: number, p1x: number, p1y: number, p2x: number, p2y: number, p3x: number, p3y: number): Point {\r\n        const s1x = p1x - p0x;\r\n        const s1y = p1y - p0y;\r\n        const s2x = p3x - p2x;\r\n        const s2y = p3y - p2y;\r\n\r\n        let ix: number;\r\n        let iy: number;\r\n\r\n        const s = (-s1y * (p0x - p2x) + s1x * (p0y - p2y)) / (-s2x * s1y + s1x * s2y);\r\n        const t = (s2x * (p0y - p2y) - s2y * (p0x - p2x)) / (-s2x * s1y + s1x * s2y);\r\n\r\n        if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {\r\n            ix = p0x + (t * s1x);\r\n            iy = p0y + (t * s1y);\r\n            return [ix, iy];\r\n        }\r\n\r\n        return null;\r\n    }\r\n\r\n    private getAngle (p1: Point, p2: Point, p3: Point): number {\r\n        const d12 = this.getDistance(p1[0], p1[1], p2[0], p2[1]);\r\n        const d13 = this.getDistance(p1[0], p1[1], p3[0], p2[1]);\r\n        const d23 = this.getDistance(p2[0], p2[1], p3[0], p2[1]);\r\n\r\n        return Math.acos((Math.pow(d23, 2) + Math.pow(d12, 2) - Math.pow(d13, 2)) / (2 * d23 * d12));\r\n    }\r\n\r\n    // private getAngle (x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): number {\r\n    //     const d12 = this.getDistance(x1, y1, x2, y2);\r\n    //     const d13 = this.getDistance(x1, y1, x3, y3);\r\n    //     const d23 = this.getDistance(x2, y2, x3, y3);\r\n    //     return Math.acos((Math.pow(d23, 2) + Math.pow(d12, 2) - Math.pow(d13, 2)) / (2 * d23 * d12));\r\n    // }\r\n\r\n    private getLineAngle (line: Line): number {\r\n        const angle = Math.atan((line[1][1] - line[0][1]) / (line[1][0] - line[0][0]));\r\n\r\n        if (line[1][0] - line[0][0] < 0) {\r\n            return angle + Math.PI;\r\n        } else if ((line[1][0] - line[0][0]) > 0 && (line[1][1] - line[0][1]) < 0) {\r\n            return angle + Math.PI * 2;\r\n        } else {\r\n            return angle;\r\n        }\r\n    }\r\n}\r\n","import { App } from './App';\r\n\r\nconst app = new App();\r\napp.run();\r\n"]}