Exemplo n.º 1
0
        //this method calculates the degree of membership for a particular value
        public override double CalculateDOM(double val)
        {
            //test for the case where the triangle's left or right offsets are zero
            //(to prevent divide by zero errors below)
            if (RightOffset.Equals(0.0) && PeakPoint.Equals(val) ||
                LeftOffset.Equals(0.0) && PeakPoint.Equals(val))
            {
                return(1.0);
            }
            //find DOM if left of center
            if ((val <= PeakPoint) && (val >= (PeakPoint - LeftOffset)))
            {
                double grad = 1.0 / LeftOffset;
                return(grad * (val - (PeakPoint - LeftOffset)));
            }
            //find DOM if right of center

            if (val > PeakPoint && (val < (PeakPoint + RightOffset)))
            {
                double grad = 1.0 / -RightOffset;
                return(grad * (val - PeakPoint) + 1.0);
            }
            //out of range of this FLV, return zero

            return(0.0);
        }
Exemplo n.º 2
0
 public override double CalculateDOM(double val)
 {
     //check for case where the offset may be zero
     if (RightOffset == 0 && val.Equals(PeakPoint) || LeftOffset == 0.0 && (PeakPoint.Equals(val)))
     {
         return(1.0);
     }
     //find DOM if left of center
     if ((val <= PeakPoint) && (val > (PeakPoint - LeftOffset)))
     {
         double grad = 1.0 / LeftOffset;
         return(grad * (val - (PeakPoint - LeftOffset)));
     }
     //find DOM if right of center
     if (val > PeakPoint && (val <= PeakPoint + RightOffset))
     {
         return(1.0);
     }
     //out of range of this FLV, return zero
     else
     {
         return(0.0);
     }
 }