private boolean setQuadric() {
    // check end points
    if (!((GeoElement) origin).isDefined()
        || origin.isInfinite()
        || !((GeoElement) secondPoint).isDefined()
        || secondPoint.isInfinite()
        || !radius.isDefined()) {
      getQuadric().setUndefined();
      return false;
    }

    Coords o = origin.getInhomCoordsInD3();
    Coords o2 = secondPoint.getInhomCoordsInD3();
    Coords d = o2.sub(o);

    if (d.equalsForKernel(0, Kernel.STANDARD_PRECISION)) {
      getQuadric().setUndefined();
      return false;
    }

    double r = radius.getDouble();

    d.calcNorm();
    double altitude = d.getNorm();

    quadric.setDefined();

    setQuadric(o, o2, d.mul(1 / altitude), r, 0, altitude);

    return true;
  }
  @Override
  public void compute() {

    if (!setQuadric()) {
      bottom.setUndefined();
      top.setUndefined();
      side.setUndefined();
      return;
    }

    computeHelpers();

    quadric.calcVolume();
  }
  public AlgoQuadricLimitedPointPointRadius(
      Construction c,
      String[] labels,
      GeoPointND origin,
      GeoPointND secondPoint,
      NumberValue r,
      int type) {
    super(c);

    this.origin = origin;
    this.secondPoint = secondPoint;
    this.radius = r;

    quadric = new GeoQuadric3DLimited(c); // ,origin,secondPoint);
    quadric.setType(type);

    input = new GeoElement[] {(GeoElement) origin, (GeoElement) secondPoint, (GeoElement) r};

    ((GeoElement) origin).addAlgorithm(this);
    ((GeoElement) secondPoint).addAlgorithm(this);
    ((GeoElement) r).addAlgorithm(this);

    // parent of output
    quadric.setParentAlgorithm(this);
    cons.addToAlgorithmList(this);

    setQuadric();

    algoSide = new AlgoQuadricSide(cons, quadric, true, null);
    cons.removeFromConstructionList(algoSide);
    side = (GeoQuadric3DPart) algoSide.getQuadric();
    side.setParentAlgorithm(this);
    quadric.setSide(side);

    algoEnds = createEnds();
    bottom.setParentAlgorithm(this);
    top.setParentAlgorithm(this);
    quadric.setBottomTop(bottom, top);

    // output = new GeoElement[] {quadric,bottom,top,side};
    setOutput();

    quadric.initLabelsIncludingBottom(labels);
    quadric.updatePartsVisualStyle();

    // force update for side
    update();
  }