Beispiel #1
0
        public override double noise(double x, double y = 0.0427, double z = 0.1996)
        {
            double[] distances = new double[numPoints];

            CellPoint p = new CellPoint(x, y, z);

            for (int i = 0; i < numPoints; i++)
            {
                distances[i] = CellPoint.distance(p, points[i]);
            }

            Array.Sort(distances);

            int n = 0;

            return(distances[n]);
        }
Beispiel #2
0
 public static double distance(CellPoint p1, CellPoint p2)
 {
     //d = ((x2 - x1)^2 + (y2 - y1)^2 + (z2-z1)^2)^(1/2)
     return(Math.Sqrt(Math.Pow((p2.x - p1.x), 2) + Math.Pow((p2.y - p1.y), 2) + Math.Pow((p2.z - p1.z), 2)));
 }