public CG_PointData RemoveFieldsWithValue(double inValue, double Tolerance)
        {
            List <string> MatchString = new List <string>();
            bool          match;

            for (int i = 0; i < Fields.Count; i++)
            {
                match = true;
                for (int j = 0; j < PointCount; j++)
                {
                    if (!TypesHelper.DoubleIsFuzzyEqual(inValue, (double)InternalValues.GetValue(i, j), Tolerance))
                    {
                        match = false;
                        break;
                    }
                }

                if (match)
                {
                    MatchString.Add(Fields[i]);
                }
            }

            return(RemoveFields(MatchString));
        }
        public string FindStaticField(List <int> Indices, double Value)
        {
            bool Equals = true;

            for (int i = 0; i < Fields.Count; i++)
            {
                for (int j = 0; j < PointCount; j++)
                {
                    if (Indices.Contains(j))
                    {
                        if (!TypesHelper.DoubleIsFuzzyEqual((double)InternalValues.GetValue(i, j), Value, EPSILON))
                        {
                            Equals = false;
                            break;
                        }
                    }
                }

                if (Equals)
                {
                    return(Fields[i]);
                }

                Equals = true;
            }

            return(string.Empty);
        }
        public CG_PointData LevelValues(double inValue, double Tolerance)
        {
            CG_PointData modified = new CG_PointData(Array.CreateInstance(typeof(object), Fields.Count, PointCount), new List <string>(), Type);
            bool         changed  = false;

            for (int i = 0; i < Fields.Count; i++)
            {
                modified.Fields.Add(Fields[i]);

                for (int j = 0; j < PointCount; j++)
                {
                    if (TypesHelper.DoubleIsFuzzyEqual((double)InternalValues.GetValue(i, j), inValue, Tolerance))
                    {
                        modified.InternalValues.SetValue(0.0, i, j);
                        changed = true;
                    }
                    else
                    {
                        modified.InternalValues.SetValue((double)InternalValues.GetValue(i, j), i, j);
                    }
                }
            }

            return(changed ? modified : this);
        }
Beispiel #4
0
 public bool FuzzyEquals(CG_Vector3 vec, double epsilon)
 {
     return(TypesHelper.DoubleIsFuzzyEqual(X, vec.X, epsilon) && TypesHelper.DoubleIsFuzzyEqual(Y, vec.Y, epsilon) && TypesHelper.DoubleIsFuzzyEqual(Z, vec.Z, epsilon));
 }