Java Distance Calculate distancePointToPlane(final double x0, final double y0, final double z0, final double[] normal, final double xp, final double yp, final double zp)

Here you can find the source of distancePointToPlane(final double x0, final double y0, final double z0, final double[] normal, final double xp, final double yp, final double zp)

Description

Compute the distance to a plane from a point.

License

Open Source License

Parameter

Parameter Description
x0 any point that lies on the plane
y0 any point that lies on the plane
z0 any point that lies on the plane
normal the normal to the plane
xp the other point
yp the other point
zp the other point

Return

the signed distance from the point to the plane.

Declaration

public static double distancePointToPlane(final double x0, final double y0, final double z0,
        final double[] normal, final double xp, final double yp, final double zp) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   w w w .  ja v  a 2 s  .co m*/
     * Compute the distance to a plane from a point. 
     * 
     * @param x0 any point that lies on the plane
     * @param y0 any point that lies on the plane
     * @param z0 any point that lies on the plane
     * @param normal the normal to the plane
     * @param xp the other point
     * @param yp the other point
     * @param zp the other point
     * @return the signed distance from the point to the plane. 
     */
    public static double distancePointToPlane(final double x0, final double y0, final double z0,
            final double[] normal, final double xp, final double yp, final double zp) {
        double x = xp - x0;
        double y = yp - y0;
        double z = zp - z0;

        return normal[0] * x + normal[1] * y + normal[2] * z;
    }
}

Related

  1. distanceLongitude(double latitude, double east, double west)
  2. distanceMat(double[][] m1, double[][] m2)
  3. distanceMeter(double prevLat, double prevLon, double currentLat, double currentLon)
  4. distanceNd(double[] p1, double[] p2, double[] scratchSpace)
  5. distancePointToLine(final double x0, final double y0, final double x1, final double y1, final double xp, final double yp)
  6. distancePointToPoint(final double x1, final double y1, final double x2, final double y2)
  7. distancePointToPoint(float x1, float y1, float x2, float y2)
  8. distances(double[][] arr, int[][] partners)
  9. distanceSq(double[] p1, double[] p2, double[] weights)