コード例 #1
0
 public Face(int x, int y, PBUtilities.Axis direction, Grid2d grid)
 {
     _grid     = grid;
     Index     = new Vector2dInt(x, y);
     Direction = direction;
     Center    = GetCenter();
 }
コード例 #2
0
        public bool AddVoxel(Vector2d position, Vector2dInt index, double resolution)
        {
            if (Voxels.TryGetValue(index, out _))
            {
                return(false);
            }

            var voxel = new SmartCell(position, resolution, this);

            Voxels.Add(index, voxel);

            int x       = index.X;
            int y       = index.Y;
            var indices = new[]
            {
                new AxisVector2dInt(PBUtilities.Axis.X, x - 1, y),
                new AxisVector2dInt(PBUtilities.Axis.X, x + 1, y),
                new AxisVector2dInt(PBUtilities.Axis.Y, x, y - 1),
                new AxisVector2dInt(PBUtilities.Axis.Y, x, y + 1),
            };

            foreach (var i in indices)
            {
                if (Faces.TryGetValue(i, out _))
                {
                    continue;
                }

                var face = new Face(i.Index.X, i.Index.Y, i.Axis, this);
                Faces.Add(i, face);
            }

            return(true);
        }
コード例 #3
0
        public SmartCell(Vector2d location, double _resolution, Grid2d grid)
        {
            _grid            = grid;
            this._resolution = _resolution;
            this.location    = location;
            int roundedX = (int)location.X;

            roundedX *= 5;
            int roundedY = (int)(location.Y);

            roundedY *= 5;

            //index = new Vector2d(Math.Round(roundedX / this._resolution * 5.0), Math.Round(roundedX / this._resolution * 5.0));

            index = new Vector2dInt((int)Math.Round(location.X / this._resolution), (int)Math.Round(location.Y / this._resolution));

            this.metric1      = 0.0;
            this.metric2      = 0.0;
            this.metric3      = 0.0;
            this.metric4      = 0.0;
            this.metric5      = 0.0;
            this.mspRaw       = 0.0;
            this.tempMetric   = 0.0;
            this.neighSize    = 0.0;
            this.neighSizeRaw = 0.0;
            this.covidMetric  = 0;
            Interval interval = new Interval(-this._resolution / 2.0, this._resolution / 2.0);
            Plane    plane    = new Plane(new Point3d(location.X, location.Y, 0), Vector3d.ZAxis);

            rect     = new Rectangle3d(plane, interval, interval);
            isActive = true;

            isovistIndeces    = new List <Vector2dInt>();
            rtreeIndices      = new List <Vector2dInt>();
            this.clusterRaw   = 0.0;
            this.clusterRemap = 0.0;
            isoPolyline       = new Polyline();
        }
コード例 #4
0
 public AxisVector2dInt(PBUtilities.Axis axis, int x, int y)
 {
     Index = new Vector2dInt(x, y);
     Axis  = axis;
 }