FieldVector3D implements Serializable { public FieldVector3D<T> orthogonal() throws MathArithmeticException { final double threshold = 0.6 * getNorm().getReal(); if (threshold == 0) { throw new MathArithmeticException(LocalizedFormats.ZERO_NORM); } if (FastMath.abs(x.getReal()) <= threshold) { final T inverse = y.multiply(y).add(z.multiply(z)).sqrt().reciprocal(); return new FieldVector3D<T>(inverse.getField().getZero(), inverse.multiply(z), inverse.multiply(y).negate()); } else if (FastMath.abs(y.getReal()) <= threshold) { final T inverse = x.multiply(x).add(z.multiply(z)).sqrt().reciprocal(); return new FieldVector3D<T>(inverse.multiply(z).negate(), inverse.getField().getZero(), inverse.multiply(x)); } else { final T inverse = x.multiply(x).add(y.multiply(y)).sqrt().reciprocal(); return new FieldVector3D<T>(inverse.multiply(y), inverse.multiply(x).negate(), inverse.getField().getZero()); } } FieldVector3D(final T x, final T y, final T z);  FieldVector3D(final T[] v);  FieldVector3D(final T alpha, final T delta);  FieldVector3D(final T a, final FieldVector3D<T>u);  FieldVector3D(final T a, final Vector3D u);  FieldVector3D(final double a, final FieldVector3D<T> u);  FieldVector3D(final T a1, final FieldVector3D<T> u1,
                         final T a2, final FieldVector3D<T> u2);  FieldVector3D(final T a1, final Vector3D u1,
                         final T a2, final Vector3D u2);  FieldVector3D(final double a1, final FieldVector3D<T> u1,
                         final double a2, final FieldVector3D<T> u2);  FieldVector3D(final T a1, final FieldVector3D<T> u1,
                         final T a2, final FieldVector3D<T> u2,
                         final T a3, final FieldVector3D<T> u3);  FieldVector3D(final T a1, final Vector3D u1,
                         final T a2, final Vector3D u2,
                         final T a3, final Vector3D u3);  FieldVector3D(final double a1, final FieldVector3D<T> u1,
                         final double a2, final FieldVector3D<T> u2,
                         final double a3, final FieldVector3D<T> u3);  FieldVector3D(final T a1, final FieldVector3D<T> u1,
                         final T a2, final FieldVector3D<T> u2,
                         final T a3, final FieldVector3D<T> u3,
                         final T a4, final FieldVector3D<T> u4);  FieldVector3D(final T a1, final Vector3D u1,
                         final T a2, final Vector3D u2,
                         final T a3, final Vector3D u3,
                         final T a4, final Vector3D u4);  FieldVector3D(final double a1, final FieldVector3D<T> u1,
                         final double a2, final FieldVector3D<T> u2,
                         final double a3, final FieldVector3D<T> u3,
                         final double a4, final FieldVector3D<T> u4); T getX(); T getY(); T getZ(); T[] toArray(); Vector3D toVector3D(); T getNorm1(); T getNorm(); T getNormSq(); T getNormInf(); T getAlpha(); T getDelta(); FieldVector3D<T> add(final FieldVector3D<T> v); FieldVector3D<T> add(final Vector3D v); FieldVector3D<T> add(final T factor, final FieldVector3D<T> v); FieldVector3D<T> add(final T factor, final Vector3D v); FieldVector3D<T> add(final double factor, final FieldVector3D<T> v); FieldVector3D<T> add(final double factor, final Vector3D v); FieldVector3D<T> subtract(final FieldVector3D<T> v); FieldVector3D<T> subtract(final Vector3D v); FieldVector3D<T> subtract(final T factor, final FieldVector3D<T> v); FieldVector3D<T> subtract(final T factor, final Vector3D v); FieldVector3D<T> subtract(final double factor, final FieldVector3D<T> v); FieldVector3D<T> subtract(final double factor, final Vector3D v); FieldVector3D<T> normalize(); FieldVector3D<T> orthogonal(); static T angle(final FieldVector3D<T> v1, final FieldVector3D<T> v2); static T angle(final FieldVector3D<T> v1, final Vector3D v2); static T angle(final Vector3D v1, final FieldVector3D<T> v2); FieldVector3D<T> negate(); FieldVector3D<T> scalarMultiply(final T a); FieldVector3D<T> scalarMultiply(final double a); boolean isNaN(); boolean isInfinite(); @Override boolean equals(Object other); @Override int hashCode(); T dotProduct(final FieldVector3D<T> v); T dotProduct(final Vector3D v); FieldVector3D<T> crossProduct(final FieldVector3D<T> v); FieldVector3D<T> crossProduct(final Vector3D v); T distance1(final FieldVector3D<T> v); T distance1(final Vector3D v); T distance(final FieldVector3D<T> v); T distance(final Vector3D v); T distanceInf(final FieldVector3D<T> v); T distanceInf(final Vector3D v); T distanceSq(final FieldVector3D<T> v); T distanceSq(final Vector3D v); static T dotProduct(final FieldVector3D<T> v1,
                                                                   final FieldVector3D<T> v2); static T dotProduct(final FieldVector3D<T> v1,
                                                                   final Vector3D v2); static T dotProduct(final Vector3D v1,
                                                                   final FieldVector3D<T> v2); static FieldVector3D<T> crossProduct(final FieldVector3D<T> v1,
                                                                                    final FieldVector3D<T> v2); static FieldVector3D<T> crossProduct(final FieldVector3D<T> v1,
                                                                                    final Vector3D v2); static FieldVector3D<T> crossProduct(final Vector3D v1,
                                                                                    final FieldVector3D<T> v2); static T distance1(final FieldVector3D<T> v1,
                                                                  final FieldVector3D<T> v2); static T distance1(final FieldVector3D<T> v1,
                                                                  final Vector3D v2); static T distance1(final Vector3D v1,
                                                                  final FieldVector3D<T> v2); static T distance(final FieldVector3D<T> v1,
                                                                 final FieldVector3D<T> v2); static T distance(final FieldVector3D<T> v1,
                                                                 final Vector3D v2); static T distance(final Vector3D v1,
                                                                 final FieldVector3D<T> v2); static T distanceInf(final FieldVector3D<T> v1,
                                                                    final FieldVector3D<T> v2); static T distanceInf(final FieldVector3D<T> v1,
                                                                    final Vector3D v2); static T distanceInf(final Vector3D v1,
                                                                    final FieldVector3D<T> v2); static T distanceSq(final FieldVector3D<T> v1,
                                                                   final FieldVector3D<T> v2); static T distanceSq(final FieldVector3D<T> v1,
                                                                   final Vector3D v2); static T distanceSq(final Vector3D v1,
                                                                   final FieldVector3D<T> v2); @Override String toString(); String toString(final NumberFormat format);  }
@Test public void testOrthogonal() throws MathArithmeticException { FieldVector3D<DerivativeStructure> v1 = createVector(0.1, 2.5, 1.3, 3); Assert.assertEquals(0.0, FieldVector3D.dotProduct(v1, v1.orthogonal()).getReal(), 1.0e-12); FieldVector3D<DerivativeStructure> v2 = createVector(2.3, -0.003, 7.6, 3); Assert.assertEquals(0.0, FieldVector3D.dotProduct(v2, v2.orthogonal()).getReal(), 1.0e-12); FieldVector3D<DerivativeStructure> v3 = createVector(-1.7, 1.4, 0.2, 3); Assert.assertEquals(0.0, FieldVector3D.dotProduct(v3, v3.orthogonal()).getReal(), 1.0e-12); FieldVector3D<DerivativeStructure> v4 = createVector(4.2, 0.1, -1.8, 3); Assert.assertEquals(0.0, FieldVector3D.dotProduct(v4, v4.orthogonal()).getReal(), 1.0e-12); try { createVector(0, 0, 0, 3).orthogonal(); Assert.fail("an exception should have been thrown"); } catch (MathArithmeticException ae) { } }