Calculate Distance for 3D points - CSharp System

CSharp examples for System:Math Geometry

Description

Calculate Distance for 3D points

Demo Code


using System;/*from  ww  w  .  j  a  v  a2 s. co m*/

public class Main{
        public static double CalcDistance3D(double x1, double y1, double z1, double x2, double y2, double z2)
        {
            double distance3D = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1));
            return distance3D;
        }
}

Related Tutorials