MCPcopy Index your code
hub / github.com/plotly/plotly.js / barycentricCircumcenter

Function barycentricCircumcenter

stackgl_modules/index.js:8787–8822  ·  view source on GitHub ↗
(points)

Source from the content-addressed store, hash-verified

8785}
8786
8787function barycentricCircumcenter(points) {
8788 var N = points.length
8789 if(N === 0) {
8790 return []
8791 }
8792
8793 var D = points[0].length
8794 var A = dup([points.length+1, points.length+1], 1.0)
8795 var b = dup([points.length+1], 1.0)
8796 A[N][N] = 0.0
8797 for(var i=0; i<N; ++i) {
8798 for(var j=0; j<=i; ++j) {
8799 A[j][i] = A[i][j] = 2.0 * dot(points[i], points[j])
8800 }
8801 b[i] = dot(points[i], points[i])
8802 }
8803 var x = solve(A, b)
8804
8805 var denom = 0.0
8806 var h = x[N+1]
8807 for(var i=0; i<h.length; ++i) {
8808 denom += h[i]
8809 }
8810
8811 var y = new Array(N)
8812 for(var i=0; i<N; ++i) {
8813 var h = x[i]
8814 var numer = 0.0
8815 for(var j=0; j<h.length; ++j) {
8816 numer += h[j]
8817 }
8818 y[i] = numer / denom
8819 }
8820
8821 return y
8822}
8823
8824function circumcenter(points) {
8825 if(points.length === 0) {

Callers 1

circumcenterFunction · 0.85

Calls 1

dotFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…