mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-11 06:54:07 +01:00
chore: Cleanup intersect
This commit is contained in:
@@ -1,10 +1,5 @@
|
|||||||
import intersectEllipse from './intersect-ellipse.js';
|
import intersectEllipse from './intersect-ellipse.js';
|
||||||
|
|
||||||
/**
|
|
||||||
* @param node
|
|
||||||
* @param rx
|
|
||||||
* @param point
|
|
||||||
*/
|
|
||||||
function intersectCircle(node, rx, point) {
|
function intersectCircle(node, rx, point) {
|
||||||
return intersectEllipse(node, rx, rx, point);
|
return intersectEllipse(node, rx, rx, point);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
/**
|
|
||||||
* @param node
|
|
||||||
* @param rx
|
|
||||||
* @param ry
|
|
||||||
* @param point
|
|
||||||
*/
|
|
||||||
function intersectEllipse(node, rx, ry, point) {
|
function intersectEllipse(node, rx, ry, point) {
|
||||||
// Formulae from: https://mathworld.wolfram.com/Ellipse-LineIntersection.html
|
// Formulae from: https://mathworld.wolfram.com/Ellipse-LineIntersection.html
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Returns the point at which two lines, p and q, intersect or returns undefined if they do not intersect.
|
* Returns the point at which two lines, p and q, intersect or returns undefined if they do not intersect.
|
||||||
*
|
|
||||||
* @param p1
|
|
||||||
* @param p2
|
|
||||||
* @param q1
|
|
||||||
* @param q2
|
|
||||||
*/
|
*/
|
||||||
function intersectLine(p1, p2, q1, q2) {
|
function intersectLine(p1, p2, q1, q2) {
|
||||||
// Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
|
// Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
|
||||||
@@ -67,10 +62,6 @@ function intersectLine(p1, p2, q1, q2) {
|
|||||||
return { x: x, y: y };
|
return { x: x, y: y };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param r1
|
|
||||||
* @param r2
|
|
||||||
*/
|
|
||||||
function sameSign(r1, r2) {
|
function sameSign(r1, r2) {
|
||||||
return r1 * r2 > 0;
|
return r1 * r2 > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
/**
|
|
||||||
* @param node
|
|
||||||
* @param point
|
|
||||||
*/
|
|
||||||
function intersectNode(node, point) {
|
function intersectNode(node, point) {
|
||||||
return node.intersect(point);
|
return node.intersect(point);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,8 @@
|
|||||||
/* eslint "no-console": off */
|
|
||||||
|
|
||||||
import intersectLine from './intersect-line.js';
|
import intersectLine from './intersect-line.js';
|
||||||
|
|
||||||
export default intersectPolygon;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the point ({x, y}) at which the point argument intersects with the node argument assuming
|
* Returns the point ({x, y}) at which the point argument intersects with the node argument assuming
|
||||||
* that it has the shape specified by polygon.
|
* that it has the shape specified by polygon.
|
||||||
*
|
|
||||||
* @param node
|
|
||||||
* @param polyPoints
|
|
||||||
* @param point
|
|
||||||
*/
|
*/
|
||||||
function intersectPolygon(node, polyPoints, point) {
|
function intersectPolygon(node, polyPoints, point) {
|
||||||
let x1 = node.x;
|
let x1 = node.x;
|
||||||
@@ -67,3 +59,5 @@ function intersectPolygon(node, polyPoints, point) {
|
|||||||
}
|
}
|
||||||
return intersections[0];
|
return intersections[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default intersectPolygon;
|
||||||
|
|||||||
Reference in New Issue
Block a user