Ejemplo n.º 1
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private static List <Cvalue> EvaluateCvalue(Audience audience, CvalueSettings settings, Polyline playingArea, Point focalPoint = null)
        {
            List <Cvalue> results = new List <Cvalue>();

            if (audience.Spectators.Count == 0)
            {
                return(results);
            }

            SetKDTree(audience);

            m_CvalueSettings           = settings;
            m_FarClippingPlaneDistance = settings.FarClippingPlaneDistance;

            if (focalPoint == null)
            {
                focalPoint = new Point();
            }

            foreach (Spectator s in audience.Spectators)
            {
                m_CvalueExists = true;

                Point  focal  = GetFocalPoint(s, playingArea, focalPoint);
                double cvalue = GetCValue(s, focal);

                results.Add(CvalueResult(s, focal, cvalue));
            }
            return(results);
        }
Ejemplo n.º 2
0
        public static List <List <Cvalue> > CvalueAnalysis(List <Audience> audience, CvalueSettings settings, Polyline focalPolyline)
        {
            List <List <Cvalue> > results = new List <List <Cvalue> >();

            foreach (Audience a in audience)
            {
                results.Add(EvaluateCvalue(a, settings, focalPolyline));
            }
            return(results);
        }
Ejemplo n.º 3
0
        public static List <Cvalue> CvalueAnalysis(this Audience audience, CvalueSettings settings, Polyline playingArea, Point focalPoint = null)
        {
            if (audience == null || settings == null || playingArea == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot query the CvalueAnalysis if the audience, settings, or playing area are null.");
                return(new List <Cvalue>());
            }

            List <Cvalue> results = EvaluateCvalue(audience, settings, playingArea, focalPoint);

            return(results);
        }
Ejemplo n.º 4
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/
        private static List <Cvalue> EvaluateCvalue(Audience audience, CvalueSettings settings, Polyline focalPolyline)
        {
            List <Cvalue>      results       = new List <Cvalue>();
            KDTree <Spectator> spectatorTree = SetKDTree(audience);

            foreach (Spectator s in audience.Spectators)
            {
                bool   cvalueExists = true;
                Vector rowVector    = Geometry.Query.CrossProduct(Vector.ZAxis, s.Head.PairOfEyes.ViewDirection);

                Spectator infront     = GetSpecInfront(s, spectatorTree);
                double    riserHeight = 0;
                double    rowWidth    = 0;
                Point     focal       = new Point();
                if (infront == null)
                {
                    //no spectator infront
                    cvalueExists = false;
                }
                else
                {
                    //check the infront and current are on parallel rows
                    if (infront.Head.PairOfEyes.ViewDirection != s.Head.PairOfEyes.ViewDirection)
                    {
                        cvalueExists = false;
                    }
                }
                if (cvalueExists)
                {
                    riserHeight = s.Head.PairOfEyes.ReferenceLocation.Z - infront.Head.PairOfEyes.ReferenceLocation.Z;
                    rowWidth    = GetRowWidth(s, infront, rowVector);
                    focal       = GetFocalPoint(rowVector, s, settings.FocalMethod, focalPolyline);
                }

                results.Add(CvalueResult(s, focal, riserHeight, rowWidth, cvalueExists, rowVector, settings));
            }
            return(results);
        }
Ejemplo n.º 5
0
        public static List <Cvalue> CvalueAnalysis(Audience audience, CvalueSettings settings, Polyline focalPolyline)
        {
            List <Cvalue> results = EvaluateCvalue(audience, settings, focalPolyline);

            return(results);
        }
Ejemplo n.º 6
0
        /***************************************************/
        private static Cvalue CvalueResult(Spectator s, Point focal, double riser, double rowWidth, bool cvalueExists, Vector rowV, CvalueSettings settings)
        {
            Cvalue result = new Cvalue();
            Vector d      = s.Head.PairOfEyes.ReferenceLocation - focal;

            result.AbsoluteDist     = d.Length();
            result.Focalpoint       = focal;
            result.HorizDist        = Geometry.Create.Vector(d.X, d.Y, 0).Length();
            result.HeightAbovePitch = s.Head.PairOfEyes.ReferenceLocation.Z - focal.Z;

            if (!cvalueExists || riser > settings.RowTolerance)//
            {
                result.CValue = settings.DefaultCValue;
            }
            else
            {
                result.CValue = (result.HorizDist - rowWidth) * (result.HeightAbovePitch / result.HorizDist) - (result.HeightAbovePitch - riser);
            }
            return(result);
        }