protected final void compute() { if (!(f.isDefined() && P.isDefined())) { tangent.setUndefined(); return; } // first derivative if (df == null || !df.isDefined()) { tangent.setUndefined(); return; } // calc the tangent; double feval[] = new double[2]; double dfeval[] = new double[2]; double tvalue = f.getClosestParameter(P, f.getMinParameter()); f.evaluateCurve(tvalue, feval); df.evaluateCurve(tvalue, dfeval); tangent.setCoords(-dfeval[1], dfeval[0], feval[0] * dfeval[1] - dfeval[0] * feval[1]); if (!pointOnCurve) T.setCoords(feval[0], feval[1], 1.0); }
// calc axes protected final void compute() { // only parabola has directrix if (c.type == GeoConic.CONIC_PARABOLA) { // directrix has direction of second eigenvector // through point (b - p/2* eigenvec1) directrix.x = -eigenvec[1].y; directrix.y = eigenvec[1].x; double px = b.x - c.p / 2.0 * eigenvec[0].x; double py = b.y - c.p / 2.0 * eigenvec[0].y; directrix.z = -(directrix.x * px + directrix.y * py); P.setCoords(px, py, 1.0); } else directrix.setUndefined(); }