public object Clone()
        {
            RelPosition ret = (RelPosition)this.MemberwiseClone();   // shallow copy, only value types are cloned

            ret.dist = (Distance)this.dist.Clone();
            ret.dir  = (Direction)this.dir.Clone();

            return(ret);
        }
        public MapCell relCellAt(RelPosition pos)
        {
            // relate the relative position to a cell:
            int cellXindex = (int)Math.Floor(RelMapWidth / 2.0d + pos.X / MapperSettings.elementSizeMeters);
            int cellYindex = (int)Math.Floor(RelMapHeight / 2.0d - pos.Y / MapperSettings.elementSizeMeters);

            MapCell cell = relCellAt(cellXindex, cellYindex);

            return(cell); // may be null
        }
Beispiel #3
0
        }                                                       // we should only set it via updateRelPosition()

        /// <summary>
        /// recalculates relPosition
        /// </summary>
        /// <param name="myPos">usually robot position</param>
        /// <param name="myDir">usually robot direction</param>
        public void updateRelPosition(GeoPosition myPos, Direction myDir)
        {
            this.relPosition = new RelPosition(this.directionTo(myPos, myDir), this.distanceTo(myPos));
        }
Beispiel #4
0
 public DetectedObjectBase(Direction dir, Distance dist)
     : this()
 {
     relPosition = new RelPosition(dir, dist);
 }
        public MapCell relCellAt(Direction dir, Distance dist)
        {
            RelPosition pos = new RelPosition(dir, dist);

            return(relCellAt(pos));
        }