public static Element drawEuclidean(SVGPlot svgp, Projection2D proj, NumberVector mid, double radius) {
    double[] v_mid = mid.toArray(); // a copy
    long[] dims = proj.getVisibleDimensions2D();

    SVGPath path = new SVGPath();
    for(int dim = BitsUtil.nextSetBit(dims, 0); dim >= 0; dim = BitsUtil.nextSetBit(dims, dim + 1)) {
      v_mid[dim] += radius;
      double[] p1 = proj.fastProjectDataToRenderSpace(v_mid);
      v_mid[dim] -= radius * 2;
      double[] p2 = proj.fastProjectDataToRenderSpace(v_mid);
      v_mid[dim] += radius;
      // delta vector
      double[] dt1 = new double[v_mid.length];
      dt1[dim] = radius;
      double[] d1 = proj.fastProjectRelativeDataToRenderSpace(dt1);
      for(int dim2 = BitsUtil.nextSetBit(dims, 0); dim2 >= 0; dim2 = BitsUtil.nextSetBit(dims, dim2 + 1)) {
        if(dim < dim2) {
          v_mid[dim2] += radius;
          double[] p3 = proj.fastProjectDataToRenderSpace(v_mid);
          v_mid[dim2] -= radius * 2;
          double[] p4 = proj.fastProjectDataToRenderSpace(v_mid);
          v_mid[dim2] += radius;
          // delta vector
          double[] dt2 = new double[v_mid.length];
          dt2[dim2] = radius;
          double[] d2 = proj.fastProjectRelativeDataToRenderSpace(dt2);

          path.moveTo(p1[0], p1[1]) //
              .cubicTo(p1[0] + d2[0] * EUCLIDEAN_KAPPA, p1[1] + d2[1] * EUCLIDEAN_KAPPA, p3[0] + d1[0] * EUCLIDEAN_KAPPA, p3[1] + d1[1] * EUCLIDEAN_KAPPA, p3[0], p3[1]) //
              .cubicTo(p3[0] - d1[0] * EUCLIDEAN_KAPPA, p3[1] - d1[1] * EUCLIDEAN_KAPPA, p2[0] + d2[0] * EUCLIDEAN_KAPPA, p2[1] + d2[1] * EUCLIDEAN_KAPPA, p2[0], p2[1]) //
              .cubicTo(p2[0] - d2[0] * EUCLIDEAN_KAPPA, p2[1] - d2[1] * EUCLIDEAN_KAPPA, p4[0] - d1[0] * EUCLIDEAN_KAPPA, p4[1] - d1[1] * EUCLIDEAN_KAPPA, p4[0], p4[1]) //
              .cubicTo(p4[0] + d1[0] * EUCLIDEAN_KAPPA, p4[1] + d1[1] * EUCLIDEAN_KAPPA, p1[0] - d2[0] * EUCLIDEAN_KAPPA, p1[1] - d2[1] * EUCLIDEAN_KAPPA, p1[0], p1[1]) //
              .close();
        }
      }
    }
    return path.makeElement(svgp);
  }
public static Element drawEuclidean ( SVGPlot svgp , Projection2D proj , NumberVector mid , double radius ) { double [ ] v_mid = mid . toArray ( ) ; long [ ] dims = proj . getVisibleDimensions2D ( ) ; SVGPath path = new SVGPath ( ) ; for ( int dim = BitsUtil . nextSetBit ( dims , 0 ) ; dim >= 0 ; dim = BitsUtil . nextSetBit ( dims , dim + 1 ) ) { v_mid [ dim ] += radius ; double [ ] p1 = proj . fastProjectDataToRenderSpace ( v_mid ) ; v_mid [ dim ] -= radius * 2 ; double [ ] p2 = proj . fastProjectDataToRenderSpace ( v_mid ) ; v_mid [ dim ] += radius ; double [ ] dt1 = new double [ v_mid . length ] ; dt1 [ dim ] = radius ; double [ ] d1 = proj . fastProjectRelativeDataToRenderSpace ( dt1 ) ; for ( int dim2 = BitsUtil . nextSetBit ( dims , 0 ) ; dim2 >= 0 ; dim2 = BitsUtil . nextSetBit ( dims , dim2 + 1 ) ) { if ( dim < dim2 ) { v_mid [ dim2 ] += radius ; double [ ] p3 = proj . fastProjectDataToRenderSpace ( v_mid ) ; v_mid [ dim2 ] -= radius * 2 ; double [ ] p4 = proj . fastProjectDataToRenderSpace ( v_mid ) ; v_mid [ dim2 ] += radius ; double [ ] dt2 = new double [ v_mid . length ] ; dt2 [ dim2 ] = radius ; double [ ] d2 = proj . fastProjectRelativeDataToRenderSpace ( dt2 ) ; path . moveTo ( p1 [ 0 ] , p1 [ 1 ] ) . cubicTo ( p1 [ 0 ] + d2 [ 0 ] * EUCLIDEAN_KAPPA , p1 [ 1 ] + d2 [ 1 ] * EUCLIDEAN_KAPPA , p3 [ 0 ] + d1 [ 0 ] * EUCLIDEAN_KAPPA , p3 [ 1 ] + d1 [ 1 ] * EUCLIDEAN_KAPPA , p3 [ 0 ] , p3 [ 1 ] ) . cubicTo ( p3 [ 0 ] - d1 [ 0 ] * EUCLIDEAN_KAPPA , p3 [ 1 ] - d1 [ 1 ] * EUCLIDEAN_KAPPA , p2 [ 0 ] + d2 [ 0 ] * EUCLIDEAN_KAPPA , p2 [ 1 ] + d2 [ 1 ] * EUCLIDEAN_KAPPA , p2 [ 0 ] , p2 [ 1 ] ) . cubicTo ( p2 [ 0 ] - d2 [ 0 ] * EUCLIDEAN_KAPPA , p2 [ 1 ] - d2 [ 1 ] * EUCLIDEAN_KAPPA , p4 [ 0 ] - d1 [ 0 ] * EUCLIDEAN_KAPPA , p4 [ 1 ] - d1 [ 1 ] * EUCLIDEAN_KAPPA , p4 [ 0 ] , p4 [ 1 ] ) . cubicTo ( p4 [ 0 ] + d1 [ 0 ] * EUCLIDEAN_KAPPA , p4 [ 1 ] + d1 [ 1 ] * EUCLIDEAN_KAPPA , p1 [ 0 ] - d2 [ 0 ] * EUCLIDEAN_KAPPA , p1 [ 1 ] - d2 [ 1 ] * EUCLIDEAN_KAPPA , p1 [ 0 ] , p1 [ 1 ] ) . close ( ) ; } } } return path . makeElement ( svgp ) ; }
Wireframe "euclidean" hypersphere

@param svgp SVG Plot
@param proj Visualization projection
@param mid mean vector
@param radius radius
@return path element