directional-tangent.js

total 0
used 0
limit 0
/* --- categories: tangents bisector files: head stroke ../point_src/point-content.js pointlist point ../point_src/tangents.js ../point_src/bisector.js ../point_src/math.js mouse dragging ../point_src/functions/clamp.js stage --- Acute kite form, where a single item always points towards its acute angle. */ function triples(arr) { const triples = []; const len = arr.length; for (let i = 0; i < len; i++) { triples.push([ arr[i % len], arr[(i + 1) % len], arr[(i + 2) % len] ]); } return triples; } const isOuterPoint = function(a,b,c) { return calculateAngleWithRef(a,b,c) > 180 // return obtuseBisect(previousPoint, p, nextPoint) > -1 } class MainStage extends Stage { canvas='playspace' mounted(){ this.points = new PointList( {x:130, y:230, radius: 30} ,{x:300, y:240, radius: 30} ,{x:540, y:140, radius: 30} ,{x:440, y:440, radius: 30} ,{x:400, y:40, radius: 30} ).cast() // stage.points.siblings(1).forEach(pair=>{}) this.dragging.addPoints(...this.points) } draw(ctx){ this.clear(ctx) triples(this.points).forEach((t)=>{ let outer = acuteBisect(t[0], t[1], t[2]) t[1].radians = outer t[1].color = isOuterPoint(t[0], t[1], t[2])? 'red': 'yellow' }); this.points.pen.indicator(ctx) this.points.pen.line(ctx, {color:'green'}) this.points[0].pen.line(ctx, this.points.last()) } } ;stage = MainStage.go();
Run
Meta Data
imports ()
files ('head', 'stroke', '../point_src/point-content.js', 'pointlist', 'point', '../point_src/tangents.js', '../point_src/bisector.js', '../point_src/math.js', 'mouse', 'dragging', '../point_src/functions/clamp.js', 'stage')
unused_keys ('title',)
unknown_keys ('categories',)
categories ['tangents', 'bisector']
filepath_exists True
path directional-tangent.js
filepath directional-tangent.js
clean_files ('../point_src/core/head.js', '../point_src/setunset.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/pointlistpen.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/tangents.js', '../point_src/bisector.js', '../point_src/math.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/functions/clamp.js', '../point_src/distances.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js')
markdown {'html': '<p>Acute kite form, where a single item always points towards its acute angle.</p>', 'content': '---\ncategories: tangents\n bisector\nfiles:\n head\n stroke\n ../point_src/point-content.js\n pointlist\n point\n ../point_src/tangents.js\n ../point_src/bisector.js\n ../point_src/math.js\n mouse\n dragging\n ../point_src/functions/clamp.js\n stage\n---\n\nAcute kite form, where a single item always points towards its acute angle.'}