intersection-line-line.js

total 0
used 0
limit 0
/* categories: intersections files: ../point_src/core/head.js ../point_src/pointpen.js ../point_src/pointdraw.js ../point_src/setunset.js ../point_src/pointlistpen.js ../point_src/stroke.js ../point_src/point-content.js ../point_src/pointlist.js ../point_src/point.js ../point_src/events.js ../point_src/automouse.js ../point_src/distances.js ../point_src/dragging.js ../point_src/functions/clamp.js ../point_src/mirror.js ../point_src/stage.js ../point_src/text/label.js ../point_src/intersections.js --- Discover the intersection of two straight _lines_, the returned point will be the intersection of those lines. A line is a list of two points [{x:10, y:10}, {x:50, y:50}] lineA = new PointList( new Point({x:406, y:76, radius: 20}) , new Point({x:145, y:397, radius: 20}) ) lineB = new PointList( new Point({x:206, y:176, radius: 20}) , new Point({x:245, y:297, radius: 20}) ) checkLinesIntersection(lineA, lineB) We can project (at a length) from line a _through_ line b, essentially as a ray beam for a defined distance. checkLinesIntersection(lineA, lineB, 400) When ray projecting, the _lineB_ is essentially a _direction_ rather than just a collision. */ class MainStage extends Stage { canvas='playspace' mounted(){ this.lineA = new PointList( new Point({x:406, y:76, radius: 20}) , new Point({x:145, y:397, radius: 20}) ) this.lineB = new PointList( new Point({x:206, y:176, radius: 20}) , new Point({x:245, y:297, radius: 20}) ) this.dragging.addPoints(...this.lineA, ...this.lineB) let l = new Label(this.ctx, { text: 'Milkshake before breakfast.' , fontSize: 14 // , fontName: 'barlow' // , fontName: 'Arial' // , fillStyle: 'green' }) l.position = new Point(100, 100) l.position.rotation = 0 // l.position.radians % Math.PI this.l = l } draw(ctx){ this.clear(ctx) this.lineA.pen.line(ctx) this.lineB.pen.line(ctx) let int = checkLinesIntersection(this.lineA, this.lineB) if(int) { let iPoint = (new Point).copy(int).update({radius: 30}) // iPoint.radius = 30 iPoint.pen.indicator(ctx) } this.l.text = `Denominator: ${denomText}` this.l.draw(ctx) this.dragging.drawIris(ctx) } } ;stage = MainStage.go();
Run
Meta Data
imports ()
files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/setunset.js', '../point_src/pointlistpen.js', '../point_src/stroke.js', '../point_src/point-content.js', '../point_src/pointlist.js', '../point_src/point.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/distances.js', '../point_src/dragging.js', '../point_src/functions/clamp.js', '../point_src/mirror.js', '../point_src/stage.js', '../point_src/text/label.js', '../point_src/intersections.js')
unused_keys ('title',)
unknown_keys ('categories',)
categories ['intersections']
filepath_exists True
path intersection-line-line.js
filepath intersection-line-line.js
clean_files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/setunset.js', '../point_src/pointlistpen.js', '../point_src/stroke.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.js', '../point_src/pointlistdraw.js', '../point_src/pointlistgradient.js', '../point_src/pointlistshape.js', '../point_src/pointlistgenerator.js', '../point_src/unpack.js', '../point_src/pointlist.js', '../point_src/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/distances.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js', '../point_src/functions/clamp.js', '../point_src/mirror.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/text/label.js', '../point_src/intersections.js')
markdown {'html': '<hr />\n<p>Discover the intersection of two straight <em>lines</em>, the returned point\nwill be the intersection of those lines.</p>\n<p>A line is a list of two points [{x:10, y:10}, {x:50, y:50}]</p>\n<pre><code> lineA = new PointList(\n new Point({x:406, y:76, radius: 20})\n , new Point({x:145, y:397, radius: 20})\n )\n\n lineB = new PointList(\n new Point({x:206, y:176, radius: 20})\n , new Point({x:245, y:297, radius: 20})\n )\n\n checkLinesIntersection(lineA, lineB)\n</code></pre>\n<p>We can project (at a length) from line a <em>through</em> line b, essentially as a\nray beam for a defined distance.</p>\n<pre><code>checkLinesIntersection(lineA, lineB, 400)\n</code></pre>\n<p>When ray projecting, the <em>lineB</em> is essentially a <em>direction</em> rather than just\na collision.</p>', 'content': 'categories: intersections\nfiles:\n ../point_src/core/head.js\n ../point_src/pointpen.js\n ../point_src/pointdraw.js\n ../point_src/setunset.js\n ../point_src/pointlistpen.js\n ../point_src/stroke.js\n ../point_src/point-content.js\n ../point_src/pointlist.js\n ../point_src/point.js\n ../point_src/events.js\n ../point_src/automouse.js\n ../point_src/distances.js\n ../point_src/dragging.js\n ../point_src/functions/clamp.js\n ../point_src/mirror.js\n ../point_src/stage.js\n ../point_src/text/label.js\n ../point_src/intersections.js\n\n---\n\nDiscover the intersection of two straight _lines_, the returned point\nwill be the intersection of those lines.\n\nA line is a list of two points [{x:10, y:10}, {x:50, y:50}]\n\n lineA = new PointList(\n new Point({x:406, y:76, radius: 20})\n , new Point({x:145, y:397, radius: 20})\n )\n\n lineB = new PointList(\n new Point({x:206, y:176, radius: 20})\n , new Point({x:245, y:297, radius: 20})\n )\n\n checkLinesIntersection(lineA, lineB)\n\nWe can project (at a length) from line a _through_ line b, essentially as a\nray beam for a defined distance.\n\n checkLinesIntersection(lineA, lineB, 400)\n\nWhen ray projecting, the _lineB_ is essentially a _direction_ rather than just\na collision.'}