using System; namespace Science.Mathematics.VectorCalculus { public class TangentPlaneToLevelSurface : Plane { public TangentPlaneToLevelSurface(Function.ToLastType f, double[] at) { Gradient obj = new Gradient(f, at); obj.Compute(); this.ThroughTip = new Vector(at); this.Normal = new Vector(obj.Result); if (this.Normal[0] == 0.0) { this.Direction1 = this.Normal % UnitVector.i; this.Direction2 = this.Normal % this.Direction1; } else if (this.Normal[1] == 0.0) { this.Direction1 = this.Normal % UnitVector.j; this.Direction2 = this.Normal % this.Direction1; } else { this.Direction1 = this.Normal % UnitVector.k; this.Direction2 = this.Normal % this.Direction1; } } } }