Пример #1
0
        public IActionResult RezultatiCelice(CellResultsViewModel results)
        {
            var result = new CellResults
            {
                SampleUsed = _dbContext.Samples.FirstOrDefault(m => m.NewId.ToString() == results.Sample),
                CellNumber = results.CellNumber
            };

            _dbContext.Add(result);
            _dbContext.SaveChanges();
            return(Index());
        }
Пример #2
0
            public void Execute(int index)
            {
                //now based on results determine if cell is front or back facing
                CellResults results = Results[index];

                int combinedHits = results.FrontTotalHits + results.BackTotalHits;

                float finalDistance = 0f;
                float sign          = 1f;
                float fh            = max(0.000001f, results.FrontTotalHits);
                float bh            = max(0.000001f, results.BackTotalHits);

                //NOTE only take if combined hits are greater than 0, otherwise no hit
                if (combinedHits > 0)
                {
                    if (fh / bh >= 1f)  //more front hits
                    {
                        finalDistance = results.FrontMinDistance;
                        sign          = 1f;
                    }
                    else //more back
                    {
                        finalDistance = results.BackMinDistance;
                        sign          = -1f;
                    }
                }

                //extra safety
                if (float.IsInfinity(finalDistance) || float.IsNaN(finalDistance))
                {
                    finalDistance = float.MaxValue;
                }

                //store signed distance
                Distances[index] = finalDistance * sign;
            }