コード例 #1
0
        static void ComputeNormalizationFactorsRecurse(
            Tree <AxisAlignedFeatureResponse, GaussianAggregator2d> t,
            int nodeIndex,
            int nTrainingPoints,
            Bounds bounds,
            double[] normalizationFactors)
        {
            GaussianPdf2d g = t.GetNode(nodeIndex).TrainingDataStatistics.GetPdf();

            // Evaluate integral of bivariate normal distribution within this node's bounds
            double u = CumulativeNormalDistribution2d.M(
                (bounds.Upper[0] - g.MeanX) / Math.Sqrt(g.VarianceX),
                (bounds.Upper[1] - g.MeanY) / Math.Sqrt(g.VarianceY),
                g.CovarianceXY / Math.Sqrt(g.VarianceX * g.VarianceY));

            double l = CumulativeNormalDistribution2d.M(
                (bounds.Lower[0] - g.MeanX) / Math.Sqrt(g.VarianceX),
                (bounds.Lower[1] - g.MeanY) / Math.Sqrt(g.VarianceY),
                g.CovarianceXY / Math.Sqrt(g.VarianceX * g.VarianceY));

            normalizationFactors[nodeIndex] = (double)(t.GetNode(nodeIndex).TrainingDataStatistics.SampleCount) / nTrainingPoints * 1.0 / (u - l);

            if (!t.GetNode(nodeIndex).IsLeaf)
            {
                Bounds leftChildBounds = bounds.Clone();
                leftChildBounds.Upper[t.GetNode(nodeIndex).Feature.Axis] = t.GetNode(nodeIndex).Threshold;
                ComputeNormalizationFactorsRecurse(t, nodeIndex * 2 + 1, nTrainingPoints, leftChildBounds, normalizationFactors);

                Bounds rightChildBounds = bounds.Clone();
                rightChildBounds.Lower[t.GetNode(nodeIndex).Feature.Axis] = t.GetNode(nodeIndex).Threshold;
                ComputeNormalizationFactorsRecurse(t, nodeIndex * 2 + 2, nTrainingPoints, rightChildBounds, normalizationFactors);
            }
        }
コード例 #2
0
        public void ToggleFreeAim()
        {
            var cursor = FreeAimCursor;

            if (cursor == null)
            {
                FreeAimCursor = new Cursor()
                {
                    Bounds = Bounds.Clone()
                };

                if (Target != null && IsExpired == false)
                {
                    FreeAimCursor.Bounds.MoveTo(Target.Bounds.Location);
                    this.FreeAimCursor.RoundToNearestPixel();
                }

                Scene.Add(FreeAimCursor);
                Speed.SpeedX = 0;
                Speed.SpeedY = 0;
                observable.FirePropertyChanged(nameof(AimMode));
            }
            else
            {
                EndFreeAim();
            }
        }
コード例 #3
0
 public override void DisplayCompletionList()
 {
     if (this.Root != null)
     {
         Rect r = Bounds.Clone();
         r.Left  += TextSize.X;
         r.Width -= TextSize.X;
         this.Root.DisplayCompletionList(r);
     }
 }
コード例 #4
0
        public override object Clone()
        {
            MapObjectGroup newMapObject = new MapObjectGroup();

            newMapObject.Bounds = (AABB)Bounds.Clone();
            foreach (MapObject mapObject in MapObjectList)
            {
                newMapObject.MapObjectList.Add((MapObject)mapObject.Clone());
            }

            return(newMapObject);
        }
コード例 #5
0
        protected virtual void UpdateStrategyVectorBounds()
        {
            DoubleMatrix strategyBounds = (DoubleMatrix)Bounds.Clone();

            for (int i = 0; i < strategyBounds.Rows; i++)
            {
                if (strategyBounds[i, 0] < 0)
                {
                    strategyBounds[i, 0] = 0;
                }
                strategyBounds[i, 1] = 0.1 * (Bounds[i, 1] - Bounds[i, 0]);
            }
            strategyVectorCreator.BoundsParameter.Value = strategyBounds;
        }
コード例 #6
0
ファイル: Rect.cs プロジェクト: onamoni/edriven-gui
        public override void Draw()
        {
            //Debug.Log("Drawing rect");

            if (null == Fill && null == Stroke)
            {
                return;
            }

            base.Draw();

            Rectangle fillRect = (Rectangle)Bounds.Clone();

            bool hasStroke = false;

            if (null != Stroke)
            {
                //Debug.Log("Stroke.Border: " + Stroke.Border);
                fillRect = fillRect.Collapse(Stroke.Border.Left, Stroke.Border.Right, Stroke.Border.Top, Stroke.Border.Bottom);
                //Debug.Log("    fillRect: " + fillRect);
                hasStroke = true;
            }

            //Debug.Log("fillRect: " + fillRect);

            //Debug.Log("Bounds.Left: " + Bounds.Left);
            //Debug.Log("Bounds.Right: " + Bounds.Right);
            //Debug.Log("Bounds.Top: " + Bounds.Top);
            //Debug.Log("Bounds.Bottom: " + Bounds.Bottom);

            int left   = (int)Bounds.Left;
            int right  = (int)Bounds.Right;
            int top    = (int)Bounds.Top;
            int bottom = (int)Bounds.Bottom;

            //Debug.Log("Bounds: " + Bounds);

            Color[] pixels = GetPixels();
            //Debug.Log("pixels: " + pixels.Length);

            int count = 0;

            //Debug.Log(string.Format("yMax: {0}; yMin:{1}", yMax, yMin));
            DrawPixels(fillRect, bottom, top, left, right, hasStroke, pixels, count);

            SetPixels(pixels);
        }
コード例 #7
0
        public override object Clone()
        {
            Solid newSolid = new Solid
            {
                Bounds = (AABB)Bounds.Clone(),
                Color  = Color.GetRandomBrushColor(),
                Hidden = Hidden,
                Detail = Detail
            };

            newSolid.VertexPositions.AddRange(VertexPositions);
            for (int i = 0; i < Faces.Count; i++)
            {
                newSolid.Faces.Add((SolidFace)Faces[i].Clone());
            }

            return(newSolid);
        }
コード例 #8
0
ファイル: ChunkAttach.cs プロジェクト: Shadowth117/sa_tools
        public override Attach Clone()
        {
            ChunkAttach result = (ChunkAttach)MemberwiseClone();

            if (Vertex != null)
            {
                result.Vertex = new List <VertexChunk>(Vertex.Count);
                foreach (VertexChunk item in Vertex)
                {
                    result.Vertex.Add(item.Clone());
                }
            }
            if (Poly != null)
            {
                result.Poly = new List <PolyChunk>(Poly.Count);
                foreach (PolyChunk item in Poly)
                {
                    result.Poly.Add(item.Clone());
                }
            }
            result.Bounds = Bounds.Clone();
            return(result);
        }
コード例 #9
0
        public override Attach Clone()
        {
            BasicAttach result = (BasicAttach)MemberwiseClone();

            result.Vertex = new Vertex[Vertex.Length];
            result.Normal = new Vertex[Normal.Length];
            for (int i = 0; i < Vertex.Length; i++)
            {
                result.Vertex[i] = Vertex[i].Clone();
                result.Normal[i] = Normal[i].Clone();
            }
            result.Material = new List <NJS_MATERIAL>(Material.Count);
            foreach (NJS_MATERIAL item in Material)
            {
                result.Material.Add(item.Clone());
            }
            result.Mesh = new List <NJS_MESHSET>(Mesh.Count);
            foreach (NJS_MESHSET item in Mesh)
            {
                result.Mesh.Add(item.Clone());
            }
            result.Bounds = Bounds.Clone();
            return(result);
        }