public Vector2D normalize() { double length = length(); if (length > 0.0) return divide(length); return create(0.0, 0.0); }
public Vector2D normalize() { double length = length(); if (length > 0.0) return divide(length); return create(0.0, 0.0); }
/** * * @param normal Plane normal * @param epsilon Epsilon value ex:1e-12 * @return The steepest slope of this plane in degree. */ public static double getSlopeInPercent(final Vector3D normal, final double epsilon) { Vector3D vector = getSteepestVector(normal, epsilon); if(Math.abs(vector.getZ()) < epsilon) { return 0; } else { return (Math.abs(vector.getZ()) / new Vector2D(vector.getX(), vector.getY()).length()) * 100; } } }
/** * * @param normal Plane normal * @param epsilon Epsilon value ex:1e-12 * @return The steepest slope of this plane in degree. */ public static double getSlopeInPercent(final Vector3D normal, final double epsilon) { Vector3D vector = getSteepestVector(normal, epsilon); if(Math.abs(vector.getZ()) < epsilon) { return 0; } else { return (Math.abs(vector.getZ()) / new Vector2D(vector.getX(), vector.getY()).length()) * 100; } }