Remove unused function
This commit is contained in:
@@ -1135,40 +1135,6 @@ function isLandable(edge) {
|
|||||||
// return Object.is(slope(edge), +0);
|
// return Object.is(slope(edge), +0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function edgeContactPosition(xc, yc, x, y, edge, radius) {
|
|
||||||
const baseSlope = slope(edge);
|
|
||||||
// if (Object.is(baseSlope, 0)) s.isLanded = true;
|
|
||||||
let { xa, ya, xb, yb } = edge;
|
|
||||||
const positionSeg = { x1: x, y1: y, x2: xc, y2: yc };
|
|
||||||
const edgeSeg = { x1: xa, y1: ya, x2: xb, y2: yb };
|
|
||||||
|
|
||||||
drawLine(x, y, xc, yc, "green");
|
|
||||||
|
|
||||||
const baseNrmlIntxn = perpIntxn(baseSlope, xa, ya, x, y);
|
|
||||||
const basePosIntxn = lineIntxnPt(edgeSeg, positionSeg);
|
|
||||||
|
|
||||||
const baseSegLength = distance(baseNrmlIntxn.x, baseNrmlIntxn.y, basePosIntxn.x, basePosIntxn.y);
|
|
||||||
const normalSegLength = distance(baseNrmlIntxn.x, baseNrmlIntxn.y, x, y);
|
|
||||||
|
|
||||||
drawLine(baseNrmlIntxn.x, baseNrmlIntxn.y, basePosIntxn.x, basePosIntxn.y, "blue");
|
|
||||||
drawLine(baseNrmlIntxn.x, baseNrmlIntxn.y, x, y, "purple");
|
|
||||||
|
|
||||||
const theta = Math.atan(normalSegLength / baseSegLength);
|
|
||||||
const h = (radius)/ Math.sin(theta);
|
|
||||||
|
|
||||||
const cl = document.createElementNS(namespaceURIsvg, 'line');
|
|
||||||
cl.setAttribute('x1', basePosIntxn.x);
|
|
||||||
cl.setAttribute('y1', basePosIntxn.y);
|
|
||||||
cl.setAttribute('x2', x);
|
|
||||||
cl.setAttribute('y2', y);
|
|
||||||
|
|
||||||
const pt = cl.getPointAtLength(h);
|
|
||||||
drawLine(basePosIntxn.x, basePosIntxn.y, pt.x, pt.y, "yellow");
|
|
||||||
|
|
||||||
// return cl.getPointAtLength(h);
|
|
||||||
return pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
function lineIntxnPt({ x1, y1, x2, y2 }, { x1: x3, y1: y3, x2: x4, y2: y4 }) {
|
function lineIntxnPt({ x1, y1, x2, y2 }, { x1: x3, y1: y3, x2: x4, y2: y4 }) {
|
||||||
// https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line
|
// https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line
|
||||||
const denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
|
const denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 49 KiB |
Reference in New Issue
Block a user