Esempio n. 1
0
        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 override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode termCode = (ConfigCode)ArticleCodeCz.FACT_CONTRACT_TERM;

                    Result <MonthFromStopValue, string> termFindResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthFromStopValue>(
                        TargetFilters.TargetCodePlusSeedFunc(termCode, InternalTarget.Head()),
                        (x) => (x.IsMonthFromStopValue()));

                    if (termFindResult.IsFailure)
                    {
                        return(ReturnFailureAndError(initValues, termFindResult.Error));
                    }

                    MonthFromStopValue termPrepValues = termFindResult.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        DateTermFrom = initValues.DateTermFrom,
                        DateTermStop = initValues.DateTermStop,
                        PositionType = initValues.PositionType,
                        DayContractFrom = termPrepValues.PeriodDayFrom,
                        DayContractStop = termPrepValues.PeriodDayStop,
                        // PROPERTIES SET
                    });
                }
                public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode scheduleCode = (ConfigCode)ArticleCodeCz.FACT_CONTRACT_TIMESHEET;

                    Result <MonthScheduleValue, string> scheduleResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthScheduleValue>(
                        TargetFilters.TargetCodePlusPartFunc(scheduleCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsRealMonthValue()));

                    if (scheduleResult.IsFailure)
                    {
                        return(ReturnFailureAndError(initValues, scheduleResult.Error));
                    }

                    MonthScheduleValue scheduleValues = scheduleResult.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        AbsenceCode = initValues.AbsenceCode,
                        DayFrom = initValues.DayFrom,
                        DayStop = initValues.DayStop,
                        SchedulePiece = initValues.SchedulePiece,
                        ScheduleHours = initValues.ScheduleHours,
                        ScheduleMonth = scheduleValues.HoursMonth.ToArray(),
                        // PROPERTIES SET
                    });
                }
                public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode declaracyCode = (ConfigCode)ArticleCodeCz.FACT_INS_DECLARATION_SOCIAL;

                    Result <DeclarationSocialValue, string> declaracyResult = InternalValues
                                                                              .FindResultValue <ArticleGeneralResult, DeclarationSocialValue>(
                        TargetFilters.TargetCodePlusHeadAndNullPartFunc(declaracyCode, InternalTarget.Head()),
                        (x) => (x.IsDeclarationSocialValue()));

                    Result <MoneyPaymentSum, string> includeIncome = GetIncludeIncome(InternalValues, InternalTarget);
                    Result <MoneyPaymentSum, string> excludeIncome = GetExcludeIncome(InternalValues, InternalTarget);

                    if (ResultMonadUtils.HaveAnyResultFailed(declaracyResult, includeIncome, excludeIncome))
                    {
                        return(ReturnFailureAndError(initValues,
                                                     ResultMonadUtils.FirstFailedResultError(declaracyResult, includeIncome, excludeIncome)));
                    }

                    DeclarationSocialValue declaracyValues = declaracyResult.Value;

                    MoneyPaymentSum includeValues = includeIncome.Value;
                    MoneyPaymentSum excludeValues = excludeIncome.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        SummarizeType = declaracyValues.SummarizeType,
                        IncludeIncome = includeValues.Balance(),
                        ExcludeIncome = excludeValues.Balance(),
                        // PROPERTIES SET
                    });
                }
Esempio n. 5
0
        public CG_PointData RemoveFields(List <string> notFoundFields)
        {
            int newCount = Fields.Count - notFoundFields.Count;

            CG_PointData modified = new CG_PointData(Array.CreateInstance(typeof(object), newCount, PointCount), new List <string>(), Type);

            int    counter = 0;
            string field;

            bool[] contains = new bool[Fields.Count];
            for (int h = 0; h < Fields.Count; h++)
            {
                field       = Fields[h];
                contains[h] = notFoundFields.Contains(field);
                if (!contains[h])
                {
                    modified.Fields.Add(field);
                }
            }

            for (int i = 0; i < PointCount; i++)
            {
                counter = 0;
                for (int j = 0; j < Fields.Count; j++)
                {
                    if (!contains[j])
                    {
                        modified.InternalValues.SetValue(InternalValues.GetValue(j, i), counter, i);
                        counter++;
                    }
                }
            }

            return(modified);
        }
Esempio n. 6
0
        public CG_PointData PutValue(double Value, List <string> inFields, bool ExceptGivenFields)
        {
            CG_PointData modified = new CG_PointData(Array.CreateInstance(typeof(object), Fields.Count, PointCount), new List <string>(), Type);

            for (int i = 0; i < Fields.Count; i++)
            {
                modified.Fields.Add(Fields[i]);
                if (inFields != null && inFields.Count > 0)
                {
                    if (inFields.Contains(Fields[i]) == !ExceptGivenFields)
                    {
                        for (int j = 0; j < PointCount; j++)
                        {
                            modified.InternalValues.SetValue(Value, i, j);
                        }
                    }
                    else
                    {
                        for (int j = 0; j < PointCount; j++)
                        {
                            modified.InternalValues.SetValue(InternalValues.GetValue(i, j), i, j);
                        }
                    }
                }
                else
                {
                    for (int j = 0; j < PointCount; j++)
                    {
                        modified.InternalValues.SetValue(Value, i, j);
                    }
                }
            }

            return(modified);
        }
Esempio n. 7
0
        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 override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode termCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TERM;

                    Result <MonthFromStopValue, string> termFindResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthFromStopValue>(
                        TargetFilters.TargetCodePlusHeadAndSeedFunc(termCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsMonthFromStopValue()));

                    if (termFindResult.IsFailure)
                    {
                        return(ReturnFailureAndError(initValues, termFindResult.Error));
                    }

                    MonthFromStopValue termPrepValues = termFindResult.Value;

                    var absenceValues = GetAbsenceValues();

                    if (absenceValues.IsFailure)
                    {
                        return(ReturnFailureAndError(initValues, absenceValues.Error));
                    }

                    var completeSorted = absenceValues.Value.OrderBy((p) => (p), new CompareAbsenceTerms());

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        DayPositionFrom = termPrepValues.PeriodDayFrom,
                        DayPositionStop = termPrepValues.PeriodDayStop,
                        AbsenceList = completeSorted.ToList(),
                        // PROPERTIES SET
                    });
                }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
                public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode workCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_SCHEDULE;

                    Result <MonthScheduleValue, string> workFindResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthScheduleValue>(
                        TargetFilters.TargetCodePlusPartFunc(workCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsRealMonthValue()));
                    MonthScheduleValue workValuesPrep = workFindResult.Value;

                    ConfigCode termCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TERM;

                    Result <MonthFromStopValue, string> termFindResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthFromStopValue>(
                        TargetFilters.TargetCodePlusHeadAndSeedFunc(termCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsMonthFromStopValue()));

                    if (ResultMonadUtils.HaveAnyResultFailed(workFindResult, workFindResult))
                    {
                        return(ReturnFailureAndError(initValues,
                                                     ResultMonadUtils.FirstFailedResultError(workFindResult, workFindResult)));
                    }

                    MonthFromStopValue termValuesPrep = termFindResult.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        DayTermFrom = termValuesPrep.PeriodDayFrom,
                        DayTermStop = termValuesPrep.PeriodDayStop,
                        RealMonthHours = workValuesPrep.HoursMonth,
                        // PROPERTIES SET
                    });
                }
                public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode scheduleCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TIMESHEET;
                    ConfigCode absencesCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_ABSENCE;

                    Result <MonthScheduleValue, string> scheduleResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthScheduleValue>(
                        TargetFilters.TargetCodePlusPartFunc(scheduleCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsTermMonthValue()));

                    Result <MonthScheduleValue, string> absencesResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthScheduleValue>(
                        TargetFilters.TargetCodePlusPartFunc(absencesCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsTermMonthValue()));

                    if (ResultMonadUtils.HaveAnyResultFailed(scheduleResult, absencesResult))
                    {
                        return(ReturnFailureAndError(initValues,
                                                     ResultMonadUtils.FirstFailedResultError(scheduleResult, absencesResult)));
                    }

                    MonthScheduleValue scheduleValues = scheduleResult.Value;
                    MonthScheduleValue absencesValues = absencesResult.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        ScheduleMonth = scheduleValues.HoursMonth,
                        AbsencesMonth = absencesValues.HoursMonth,
                        // PROPERTIES SET
                    });
                }
                private Result <IEnumerable <PositionEvaluateSource>, string> GetPositionValues()
                {
                    ConfigCode positionCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TERM;
                    ConfigCode scheduleCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TIMESHEET;

                    Result <IEnumerable <ResultPair>, string> positionList = InternalValues
                                                                             .GetTypedResultsInListAndError <ArticleGeneralResult>(
                        TargetFilters.TargetCodePlusHeadFunc(positionCode, InternalTarget.Head()));
                    Result <IEnumerable <ResultPair>, string> scheduleList = InternalValues
                                                                             .GetTypedResultsInListAndError <ArticleGeneralResult>(
                        TargetFilters.TargetCodePlusHeadFunc(scheduleCode, InternalTarget.Head()));

                    if (ResultMonadUtils.HaveAnyResultFailed(positionList, scheduleList))
                    {
                        return(Result.Fail <IEnumerable <PositionEvaluateSource>, string>(
                                   ResultMonadUtils.FirstFailedResultError(positionList, scheduleList)));
                    }

                    var positionZips = GetZip2Position(positionList.Value, scheduleList.Value);

                    if (positionZips.IsFailure)
                    {
                        return(Result.Fail <IEnumerable <PositionEvaluateSource>, string>(positionZips.Error));
                    }
                    var positionStream = positionZips.Value.Select((tp) => (BuildItem(tp.Key, tp.Value.Item1, tp.Value.Item2))).ToList();

                    return(positionStream.ToResultWithValueListAndError((tp) => (tp)));
                }
Esempio n. 13
0
            public HeadIK(FullBodyIK fullBodyIK)
            {
                _settings       = fullBodyIK.settings;
                _internalValues = fullBodyIK.internalValues;

                _neckBone     = _PrepareBone(fullBodyIK.headBones.neck);
                _headBone     = _PrepareBone(fullBodyIK.headBones.head);
                _leftEyeBone  = _PrepareBone(fullBodyIK.headBones.leftEye);
                _rightEyeBone = _PrepareBone(fullBodyIK.headBones.rightEye);
                _headEffector = fullBodyIK.headEffectors.head;
                _eyesEffector = fullBodyIK.headEffectors.eyes;
            }
Esempio n. 14
0
        public void Add(TKey key, TValue value)
        {
            //if (list.Contains(key))
            if (this.ContainsKey(key))
            {
                throw new global::System.Exception("Argument_AddingDuplicate");
            }


            InternalKeys.Add(key);
            InternalValues.Add(value);
        }
Esempio n. 15
0
                public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode scheduledCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_SCHEDULE;
                    ConfigCode timesheetCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TIMESHEET;
                    ConfigCode worksheetCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_WORKING;

                    Result <WeekScheduleValue, string> fullWeekResult = InternalValues
                                                                        .FindResultValue <ArticleGeneralResult, WeekScheduleValue>(
                        TargetFilters.TargetCodePlusPartFunc(scheduledCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsFullWeeksValue()));
                    Result <WeekScheduleValue, string> realWeekResult = InternalValues
                                                                        .FindResultValue <ArticleGeneralResult, WeekScheduleValue>(
                        TargetFilters.TargetCodePlusPartFunc(scheduledCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsRealWeeksValue()));
                    Result <MonthScheduleValue, string> timesheetResult = InternalValues
                                                                          .FindResultValue <ArticleGeneralResult, MonthScheduleValue>(
                        TargetFilters.TargetCodePlusPartFunc(timesheetCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsRealMonthValue()));
                    Result <MonthScheduleValue, string> worksheetResult = InternalValues
                                                                          .FindResultValue <ArticleGeneralResult, MonthScheduleValue>(
                        TargetFilters.TargetCodePlusPartFunc(worksheetCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsTermMonthValue()));

                    if (ResultMonadUtils.HaveAnyResultFailed(
                            fullWeekResult,
                            realWeekResult,
                            timesheetResult,
                            worksheetResult))
                    {
                        return(ReturnFailureAndError(initValues,
                                                     ResultMonadUtils.FirstFailedResultError(
                                                         fullWeekResult,
                                                         realWeekResult,
                                                         timesheetResult,
                                                         worksheetResult)));
                    }

                    WeekScheduleValue  fullWeekValues  = fullWeekResult.Value;
                    WeekScheduleValue  realWeekValues  = realWeekResult.Value;
                    MonthScheduleValue timesheetValues = timesheetResult.Value;
                    MonthScheduleValue worksheetValues = worksheetResult.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        MonthlyAmount = initValues.MonthlyAmount,
                        ShiftLiable = PeriodUtils.TotalWeekHours(fullWeekValues.HoursWeek),
                        ShiftWorked = PeriodUtils.TotalWeekHours(realWeekValues.HoursWeek),
                        HoursLiable = PeriodUtils.TotalMonthHours(timesheetValues.HoursMonth),
                        HoursWorked = PeriodUtils.TotalMonthHours(worksheetValues.HoursMonth),
                        // PROPERTIES SET
                    });
                }
Esempio n. 16
0
			public HeadIK( FullBodyIK fullBodyIK )
			{
				_settings = fullBodyIK.settings;
				_internalValues = fullBodyIK.internalValues;

				_neckBone = _PrepareBone( fullBodyIK.headBones.neck );
				_headBone = _PrepareBone( fullBodyIK.headBones.head );
				_leftEyeBone = _PrepareBone( fullBodyIK.headBones.leftEye );
				_rightEyeBone = _PrepareBone( fullBodyIK.headBones.rightEye );
				_headEffector = fullBodyIK.headEffectors.head;
				_eyesEffector = fullBodyIK.headEffectors.eyes;
            }
Esempio n. 17
0
        public void Update(CG_PointData curData)
        {
            int index;

            for (int i = 0; i < Fields.Count; i++)
            {
                index = curData.Fields.IndexOf(Fields[i]);

                if (index != -1)
                {
                    for (int j = 0; j < PointCount; j++)
                    {
                        InternalValues.SetValue(curData.InternalValues.GetValue(index, j), i, j);
                    }
                }
            }
        }
Esempio n. 18
0
                public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode declaracyCode = (ConfigCode)ArticleCodeCz.FACT_TAX_DECLARATION;
                    ConfigCode participyCode = (ConfigCode)ArticleCodeCz.FACT_INS_DECLARATION_HEALTH;

                    Result <DeclarationTaxingValue, string> declaracyResult = InternalValues
                                                                              .FindResultValue <ArticleGeneralResult, DeclarationTaxingValue>(
                        TargetFilters.TargetCodePlusHeadAndNullPartFunc(declaracyCode, InternalTarget.Head()),
                        (x) => (x.IsDeclarationTaxingValue()));

                    Result <DeclarationHealthValue, string> participyResult = InternalValues
                                                                              .FindResultValue <ArticleGeneralResult, DeclarationHealthValue>(
                        TargetFilters.TargetCodePlusHeadAndNullPartFunc(participyCode, InternalTarget.Head()),
                        (x) => (x.IsDeclarationHealthValue()));

                    Result <MoneyPaymentSum, string> taxableIncome = GetTaxableIncome(InternalValues, InternalTarget);
                    Result <MoneyPaymentSum, string> partnerIncome = GetPartnerIncome(InternalValues, InternalTarget);
                    Result <MoneyPaymentSum, string> excludeIncome = GetExcludeIncome(InternalValues, InternalTarget);

                    if (ResultMonadUtils.HaveAnyResultFailed(declaracyResult, participyResult, taxableIncome, partnerIncome))
                    {
                        return(ReturnFailureAndError(initValues,
                                                     ResultMonadUtils.FirstFailedResultError(declaracyResult, participyResult, taxableIncome, partnerIncome)));
                    }

                    DeclarationTaxingValue declaracyValues = declaracyResult.Value;
                    DeclarationHealthValue participyValues = participyResult.Value;

                    MoneyPaymentSum taxableValues = taxableIncome.Value;
                    MoneyPaymentSum partnerValues = partnerIncome.Value;
                    MoneyPaymentSum excludeValues = excludeIncome.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        SummarizeType = declaracyValues.SummarizeType,
                        StatementType = declaracyValues.StatementType,
                        DeclaracyType = declaracyValues.DeclaracyType,
                        ResidencyType = declaracyValues.ResidencyType,
                        TaxableIncome = taxableValues.Balance(),
                        PartnerIncome = partnerValues.Balance(),
                        ExcludeIncome = excludeValues.Balance(),
                        // PROPERTIES SET
                    });
                }
Esempio n. 19
0
        public CG_PointData FilterFields(List <string> deformers)
        {
            CG_PointData modified = new CG_PointData(Array.CreateInstance(typeof(object), deformers.Count, PointCount), new List <string>(), Type);

            //Get deformers
            List <string> notFoundFields = new List <string>();

            //ignore deformers that don't exist in ref deformers
            int counter = 0;

            foreach (string defName in Fields)
            {
                if (deformers.Contains(defName))
                {
                    modified.Fields.Add(defName);
                    for (int j = 0; j < PointCount; j++)
                    {
                        modified.InternalValues.SetValue(InternalValues.GetValue(counter, j), modified.Fields.Count - 1, j);
                    }
                }

                counter++;
            }

            //Add deformers that don't exist in old deformers
            foreach (string defName in deformers)
            {
                if (!modified.Fields.Contains(defName))
                {
                    modified.Fields.Add(defName);
                    for (int j = 0; j < PointCount; j++)
                    {
                        modified.InternalValues.SetValue(0.0, modified.Fields.Count - 1, j);
                    }
                }
            }

            return(modified);
        }
Esempio n. 20
0
        public int LimitFields(int inNumFields)
        {
            int removed = 0;

            for (int i = 0; i < PointCount; i++)
            {
                List <DeformerPointWeight> PW = GetPointWeigths(i);
                PW.Sort();
                PW.Reverse();
                int delta = PW.Count - inNumFields;
                if (delta > 0)
                {
                    for (int d = delta; d > 0; d--)
                    {
                        int toDropIndex = PW[PW.Count - d].DeformerIndex;
                        InternalValues.SetValue(0, toDropIndex, i);
                        removed++;
                    }
                }
            }

            return(removed);
        }
Esempio n. 21
0
 public void PutValueInPlace(double Value, List <string> inFields, bool ExceptGivenFields)
 {
     for (int i = 0; i < Fields.Count; i++)
     {
         if (inFields != null && inFields.Count > 0)
         {
             if (inFields.Contains(Fields[i]) == !ExceptGivenFields)
             {
                 for (int j = 0; j < PointCount; j++)
                 {
                     InternalValues.SetValue(Value, i, j);
                 }
             }
         }
         else
         {
             for (int j = 0; j < PointCount; j++)
             {
                 InternalValues.SetValue(Value, i, j);
             }
         }
     }
 }
Esempio n. 22
0
        public CG_PointData Blend(CG_PointData Merged, double Opacity, List <int> indices)
        {
            CG_PointData modified = new CG_PointData(Array.CreateInstance(typeof(object), Fields.Count, PointCount), new List <string>(), Type);

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

                for (int j = 0; j < PointCount; j++)
                {
                    if (indices == null || indices.Count == 0 || indices.Contains(j))
                    {
                        modified.InternalValues.SetValue((double)InternalValues.GetValue(i, j) * (1 - Opacity) + (double)Merged.InternalValues.GetValue(i, j) * Opacity, i, j);
                    }
                    else
                    {
                        modified.InternalValues.SetValue((double)InternalValues.GetValue(i, j), i, j);
                    }
                }
            }

            return(modified);
        }
Esempio n. 23
0
			public LimbIK( FullBodyIK fullBodyIK, LimbIKLocation limbIKLocation )
			{
				Assert( fullBodyIK != null );
				if( fullBodyIK == null ) {
					return;
				}

				_settings = fullBodyIK.settings;
				_internalValues = fullBodyIK.internalValues;

				_limbIKLocation = limbIKLocation;
				_limbIKType = FullBodyIK.ToLimbIKType( limbIKLocation );
				_limbIKSide = FullBodyIK.ToLimbIKSide( limbIKLocation );

				if( _limbIKType == LimbIKType.Leg ) {
					var legBones = (_limbIKSide == Side.Left) ? fullBodyIK.leftLegBones : fullBodyIK.rightLegBones;
					var legEffectors = (_limbIKSide == Side.Left) ? fullBodyIK.leftLegEffectors : fullBodyIK.rightLegEffectors;
					_beginBone = legBones.leg;
					_bendingBone = legBones.knee;
					_endBone = legBones.foot;
					_bendingEffector = legEffectors.knee;
					_endEffector = legEffectors.foot;
				} else if( _limbIKType == LimbIKType.Arm ) {
					var armBones = (_limbIKSide == Side.Left) ? fullBodyIK.leftArmBones : fullBodyIK.rightArmBones;
					var armEffectors = (_limbIKSide == Side.Left) ? fullBodyIK.leftArmEffectors : fullBodyIK.rightArmEffectors;
					_beginBone = armBones.arm;
					_bendingBone = armBones.elbow;
					_endBone = armBones.wrist;
					_bendingEffector = armEffectors.elbow;
					_endEffector = armEffectors.wrist;
					_PrepareRollBones( ref _armRollBones, armBones.armRoll );
					_PrepareRollBones( ref _elbowRollBones, armBones.elbowRoll );
				}

				_Prepare( fullBodyIK );
			}
Esempio n. 24
0
        public CG_PointData TransposeFields(List <string> inFields)
        {
            CG_PointData modified = new CG_PointData(Array.CreateInstance(typeof(object), inFields.Count, PointCount), new List <string>(), Type);

            int index;

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

                if (index == -1)
                {
                    index = i;
                }

                for (int j = 0; j < PointCount; j++)
                {
                    modified.InternalValues.SetValue(InternalValues.GetValue(i, j), index, j);
                }
            }

            return(modified);
        }
Esempio n. 25
0
 public bool ContainsKey(string key)
 {
     return(InternalValues.ContainsKey(key));
 }
                private Result <IEnumerable <AbsenceEvaluateSource>, string> GetAbsenceValues()
                {
                    ConfigCode filterCode = (ConfigCode)ArticleCodeCz.FACT_CONTRACT_ATTEND_ITEM;
                    TargetHead filterHead = InternalTarget.Head();

                    Result <IEnumerable <AbsenceEvaluateSource>, string> absenceList = InternalValues
                                                                                       .GetResultValuesInListAndError <ArticleGeneralResult, MonthAttendanceValue, AbsenceEvaluateSource>(
                        TargetFilters.TargetCodePlusHeadFunc(filterCode, filterHead), ArticleFilters.SelectAllFunc,
                        ResultFilters.MonthAttendanceFunc, BuildItem);

                    return(absenceList);
                }
Esempio n. 27
0
 IQueryable GetQueryable()
 {
     return(queryable ?? (queryable = WasInitialized ? InternalValues.AsQueryable() : this.Query(Session)));
 }
Esempio n. 28
0
			public BodyIK( FullBodyIK fullBodyIK, LimbIK[] limbIK )
			{
				Assert( fullBodyIK != null );

				_limbIK = limbIK;

				_settings = fullBodyIK.settings;
				_internalValues = fullBodyIK.internalValues;

				_hipsBone = _PrepareBone( fullBodyIK.bodyBones.hips );
				_neckBone = _PrepareBone( fullBodyIK.headBones.neck );
				_headBone = _PrepareBone( fullBodyIK.headBones.head );

				_hipsEffector = fullBodyIK.bodyEffectors.hips;
				_neckEffector = fullBodyIK.headEffectors.neck;
				_headEffector = fullBodyIK.headEffectors.head;
				_eyesEffector = fullBodyIK.headEffectors.eyes;

				_armEffectors[0] = fullBodyIK.leftArmEffectors.arm;
				_armEffectors[1] = fullBodyIK.rightArmEffectors.arm;
				_elbowEffectors[0] = fullBodyIK.leftArmEffectors.elbow;
				_elbowEffectors[1] = fullBodyIK.rightArmEffectors.elbow;
				_wristEffectors[0] = fullBodyIK.leftArmEffectors.wrist;
				_wristEffectors[1] = fullBodyIK.rightArmEffectors.wrist;
				_kneeEffectors[0] = fullBodyIK.leftLegEffectors.knee;
				_kneeEffectors[1] = fullBodyIK.rightLegEffectors.knee;
				_footEffectors[0] = fullBodyIK.leftLegEffectors.foot;
				_footEffectors[1] = fullBodyIK.rightLegEffectors.foot;

				_spineBones = _PrepareSpineBones( fullBodyIK.bones );
				if( _spineBones != null && _spineBones.Length > 0 ) {
					int spineLength = _spineBones.Length;
                    _spineBone = _spineBones[0];
					_spineUBone = _spineBones[spineLength - 1];
					_spineEnabled = new bool[spineLength];
                }

				// Memo: These should be pair bones.(Necessary each side bones.)

				_kneeBones = _PrepareBones( fullBodyIK.leftLegBones.knee, fullBodyIK.rightLegBones.knee );
				_elbowBones = _PrepareBones( fullBodyIK.leftArmBones.elbow, fullBodyIK.rightArmBones.elbow );
				_legBones = _PrepareBones( fullBodyIK.leftLegBones.leg, fullBodyIK.rightLegBones.leg );
				_armBones = _PrepareBones( fullBodyIK.leftArmBones.arm, fullBodyIK.rightArmBones.arm );
				_shoulderBones = _PrepareBones( fullBodyIK.leftArmBones.shoulder, fullBodyIK.rightArmBones.shoulder );
				_nearArmBones = (_shoulderBones != null) ? _shoulderBones : _nearArmBones;

				_Prepare( fullBodyIK );
			}
Esempio n. 29
0
 public bool ContainsValue(TValue value)
 {
     return(InternalValues.Contains(value));
 }
Esempio n. 30
0
			public FingerIK( FullBodyIK fullBodyIK, FingerIKType fingerIKType )
			{
				_fingerIKType = fingerIKType;
				_settings = fullBodyIK.settings;
				_internalValues = fullBodyIK.internalValues;

				FingersBones fingerBones = null;
                FingersEffectors fingerEffectors = null;
				switch( fingerIKType ) {
				case FingerIKType.LeftWrist:
					_parentBone		= fullBodyIK.leftArmBones.wrist;
					fingerBones		= fullBodyIK.leftHandFingersBones;
					fingerEffectors	= fullBodyIK.leftHandFingersEffectors;
                    break;
				case FingerIKType.RightWrist:
					_parentBone		= fullBodyIK.rightArmBones.wrist;
					fingerBones		= fullBodyIK.rightHandFingersBones;
					fingerEffectors	= fullBodyIK.rightHandFingersEffectors;
					break;
				}

				_notThumb1PitchUTraceSmooth = new FastAngle( _notThumb1PitchUTrace.angle + _notThumb1PitchUSmooth.angle );

				if( fingerBones != null && fingerEffectors != null ) {
					for( int fingerType = 0; fingerType < (int)FingerType.Max; ++fingerType ) {
						Bone[] bones = null;
						Effector effector = null;
						switch( fingerType ) {
						case (int)FingerType.Thumb:
							bones = fingerBones.thumb;
							effector = fingerEffectors.thumb;
							break;
						case (int)FingerType.Index:
							bones = fingerBones.index;
							effector = fingerEffectors.index;
							break;
						case (int)FingerType.Middle:
							bones = fingerBones.middle;
							effector = fingerEffectors.middle;
							break;
						case (int)FingerType.Ring:
							bones = fingerBones.ring;
							effector = fingerEffectors.ring;
							break;
						case (int)FingerType.Little:
							bones = fingerBones.little;
							effector = fingerEffectors.little;
							break;
						}

						if( bones != null && effector != null ) {
							_PrepareBranch( fingerType, bones, effector );
						}
					}
				}
			}
Esempio n. 31
0
			static Vector3 _GetEffectorPosition(
				InternalValues internalValues,
				Bone rootBone,
				Bone beginLinkBone,
				Effector effector,
				float link0ToEffectorLength,
				ref Matrix3x4 parentTransform )
			{
				if( rootBone != null && beginLinkBone != null && effector != null ) {
					var effectorPosition = effector.worldPosition;
					if( effector.positionWeight < 1.0f - IKEpsilon ) {
						Vector3 endLinkPosition;
						if( internalValues.continuousSolverEnabled || internalValues.resetTransforms ) {
							endLinkPosition = parentTransform * (effector._defaultPosition - rootBone._defaultPosition);
						} else {
							endLinkPosition = effector.bone_worldPosition;
						}

						Vector3 beginLinkPosition = parentTransform * (beginLinkBone._defaultPosition - rootBone._defaultPosition);

						Vector3 moveFrom = endLinkPosition - beginLinkPosition;
						Vector3 moveTo = effectorPosition - beginLinkPosition;

						float lengthFrom = link0ToEffectorLength; // Optimized.
						float lengthTo = moveTo.magnitude;

						if( lengthFrom > IKEpsilon && lengthTo > IKEpsilon ) {
							Vector3 dirFrom = moveFrom * (1.0f / lengthFrom);
							Vector3 dirTo = moveTo * (1.0f / lengthTo);
							Vector3 dir = _LerpDir( ref dirFrom, ref dirTo, effector.positionWeight );
							float len = Mathf.Lerp( lengthFrom, lengthTo, Mathf.Clamp01( 1.0f - (1.0f - effector.positionWeight) * _positionLerpRate ) );
							return dir * len + beginLinkPosition;
						}
					}

					return effectorPosition;
                }

				return Vector3.zero;
			}
Esempio n. 32
0
 public void Add(string key, List <T> value)
 {
     InternalValues.Add(key, value);
 }
Esempio n. 33
0
			void _PrepareHipsToFootLength( int index, Bone legBone, Bone kneeBone, Bone footBone, InternalValues internalValues )
			{
				Assert( internalValues != null );
				if( legBone != null && kneeBone != null && footBone != null ) {
					float hipsToLegLen = legBone._defaultLocalLength.length;
                    float legToKneeLen = kneeBone._defaultLocalLength.length;
					float kneeToFootLen = footBone._defaultLocalLength.length;

					Vector3 hipsToLegDir = legBone._defaultLocalDirection;
                    Vector3 legToKneeDir = kneeBone._defaultLocalDirection;
					Vector3 kneeToFootDir = footBone._defaultLocalDirection;

					SAFBIKMatMultVec( out hipsToFootLength[index].hipsToLeg, ref internalValues.defaultRootBasisInv, ref hipsToLegDir );
					SAFBIKMatMultVec( out hipsToFootLength[index].legToKnee, ref internalValues.defaultRootBasisInv, ref legToKneeDir );
					SAFBIKMatMultVec( out hipsToFootLength[index].kneeToFoot, ref internalValues.defaultRootBasisInv, ref kneeToFootDir );

					hipsToFootLength[index].defaultOffset =
						hipsToFootLength[index].hipsToLeg * hipsToLegLen +
						hipsToFootLength[index].legToKnee * legToKneeLen +
						hipsToFootLength[index].kneeToFoot * kneeToFootLen;
				}
			}