mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 03:46:45 +00:00
Optimized rendering of graph layout and zooming events
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { line, curveCardinalClosed } from 'd3-shape';
|
||||
import range from 'lodash/range';
|
||||
|
||||
const shapeSpline = line().curve(curveCardinalClosed.tension(0.65));
|
||||
|
||||
export function nodeShapePolygon(radius, n) {
|
||||
const innerAngle = (2 * Math.PI) / n;
|
||||
return shapeSpline(range(0, n).map(k => [
|
||||
radius * Math.sin(k * innerAngle),
|
||||
-radius * Math.cos(k * innerAngle)
|
||||
]));
|
||||
}
|
||||
Reference in New Issue
Block a user