21 lines
522 B
C#
21 lines
522 B
C#
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using System;
|
||
|
|
|
||
|
|
public class GaussFunction : Function2D {
|
||
|
|
|
||
|
|
public double a;
|
||
|
|
public double b;
|
||
|
|
public double c = 1.0;
|
||
|
|
|
||
|
|
public bool NormalDistrubution = true;
|
||
|
|
|
||
|
|
public override double Evaluate(double u, double v) {
|
||
|
|
double x = Math.Sqrt(u * u + v * v);
|
||
|
|
double aValue = NormalDistrubution ? (1.0 / (c * Math.Sqrt(2.0 * Math.PI))) : a;
|
||
|
|
|
||
|
|
return aValue * Math.Exp(-(((x - b)* (x - b)) / (2*c*c)));
|
||
|
|
}
|
||
|
|
}
|