Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

layout-base

Package Overview
Dependencies
Maintainers
6
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

layout-base - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "layout-base",
"version": "2.0.0",
"version": "2.0.1",
"description": "Basic layout model and some utilities for Cytoscape.js layout extensions",

@@ -5,0 +5,0 @@ "main": "layout-base.js",

@@ -477,2 +477,3 @@ var LGraph;

var edge;
var edgesToRemove = [];

@@ -486,5 +487,13 @@ var s = this.edges.length;

{
return true;
edgesToRemove.push(edge);
}
}
// Remove invalid edges from graph manager
for (var i = 0; i < edgesToRemove.length; i++)
{
this.remove(edgesToRemove[i]);
}
// Invalid edges are cleared, so return false
return false;

@@ -491,0 +500,0 @@ };

@@ -554,3 +554,57 @@ /**

/**
* This method checks and calculates the intersection of
* a line segment and a circle.
*/
IGeometry.findCircleLineIntersections = function(Ex, Ey, Lx, Ly, Cx, Cy, r) {
// E is the starting point of the ray,
// L is the end point of the ray,
// C is the center of sphere you're testing against
// r is the radius of that sphere
// Compute:
// d = L - E ( Direction vector of ray, from start to end )
// f = E - C ( Vector from center sphere to ray start )
// Then the intersection is found by..
// P = E + t * d
// This is a parametric equation:
// Px = Ex + tdx
// Py = Ey + tdy
// get a, b, c values
let a = (Lx-Ex)*(Lx-Ex) + (Ly-Ey)*(Ly-Ey);
let b = 2*((Ex-Cx)*(Lx-Ex)+(Ey-Cy)*(Ly-Ey)) ;
let c = (Ex-Cx)*(Ex-Cx)+(Ey-Cy)*(Ey-Cy) - r*r ;
// get discriminant
var disc = b*b - 4 * a * c;
if (disc >= 0) {
// insert into quadratic formula
let t1 = (-b + Math.sqrt(b*b - 4 * a * c)) / (2 * a);
let t2 = (-b - Math.sqrt(b*b - 4 * a * c)) / (2 * a);
let intersections = null;
if( t1 >= 0 && t1 <= 1 )
{
// t1 is the intersection, and it's closer than t2
// (since t1 uses -b - discriminant)
// Impale, Poke
return [t1];
}
// here t1 didn't intersect so we are either started
// inside the sphere or completely past it
if( t2 >= 0 && t2 <= 1 )
{
// ExitWound
return [t2] ;
}
return intersections;
}
else
return null;
};
// -----------------------------------------------------------------------------

@@ -557,0 +611,0 @@ // Section: Class Constants

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc