Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
 public DetectedObjectBase(Direction dir, Distance dist)
     : this()
 {
     relPosition = new RelPosition(dir, dist);
 }
Ejemplo n.º 5
0
        public MapCell relCellAt(Direction dir, Distance dist)
        {
            RelPosition pos = new RelPosition(dir, dist);

            return(relCellAt(pos));
        }