// calc tangent at x=a
  public final void compute() {
    if (!(f.isDefined() && P.isDefined() && deriv.isDefined())) {
      tangent.setUndefined();
      return;
    }

    // calc the tangent;
    double a = P.inhomX;
    double fa = f.evaluate(a);
    double slope = deriv.evaluate(a);
    tangent.setCoords(-slope, 1.0, a * slope - fa);

    if (!pointOnFunction) T.setCoords(a, fa, 1.0);
  }
예제 #2
0
  // calc axes
  @Override
  public final void compute() {
    // only parabola has directrix
    if (c.type == GeoConicNDConstants.CONIC_PARABOLA) {
      // directrix has direction of second eigenvector
      // through point (b - p/2* eigenvec1)
      directrix.x = -eigenvec[1].getY();
      directrix.y = eigenvec[1].getX();
      double px = b.getX() - c.p / 2.0 * eigenvec[0].getX();
      double py = b.getY() - c.p / 2.0 * eigenvec[0].getY();
      directrix.z = -(directrix.x * px + directrix.y * py);

      P.setCoords(px, py, 1.0);
    } else directrix.setUndefined();
  }