Beispiel #1
0
        public virtual void translate(Distance dist, IDirection dir)
        {
            double distMeters = dist.Meters;
            double dTheta     = -DirectionMath.toRad(dir.bearing.Value); // radians; theta is positive to left, bearing - positive to right

            this.translate(distMeters * Math.Cos(dTheta), distMeters * Math.Sin(dTheta));
        }
Beispiel #2
0
        public Direction dir;   // straight forward is 0, right is positive


        public RelPosition(Direction direction, Distance distance)
        {
            this.dir  = (Direction)direction.Clone();
            this.dist = (Distance)distance.Clone();

            if (direction.bearingRelative.HasValue)
            {
                double bearingRad = DirectionMath.toRad(direction.bearingRelative.Value);

                XMeters = distance.Meters * Math.Sin(bearingRad);
                YMeters = -distance.Meters * Math.Cos(bearingRad);
            }
            else if (direction.bearing.HasValue)
            {
                double bearingRad = DirectionMath.toRad(direction.bearing.Value);

                XMeters = distance.Meters * Math.Sin(bearingRad);
                YMeters = -distance.Meters * Math.Cos(bearingRad);
            }
        }