I think I understand the issue I am having but need some other smart people to help. How do I continue the line that is drawn to the edge of the canvas depending on where I have clicked on the stage. I need to know the point the line should end when it hits the canvas edge.
// Given F, S, W, H or frame, stage, stageW, stageH
let circle = new Circle(20,red).center();
let line;
new Rectangle(W,H,faint).addTo().tap(()=>{
let x1 = Math.floor(S.mouseX),
y1 = Math.floor(S.mouseY),
x2 = circle.x,
y2 = circle.y,
m = (y2 - y1) / (x2 - x1),
b = y2 - (x2*m);
line = new Line({points: [[x2,y2],[x1,y1]],color:black}).reg(x2,y2).addTo().loc(x2,y2);
//zog([x1,y1,],[x2,y2],m,b);
zog(line.x,line.y);
S.update();
});
I appreciate you both. I have been thinking about touching Math.js. @josephd me too but this is good exercise for the brain; which means we do better for work? Right!