// perhaps this should be called translate public void shift(float radius, float degrees) { float newX, newY; PointR shiftVector = new PointR(radius, degrees); newX = this.X + shiftVector.X; newY = this.Y + shiftVector.Y; this._radius = (float)Math.Sqrt((double)(newX * newX) + (newY * newY)); if (newX == 0f) this._radians = 0f; else { this._radians = (float)Math.Atan((double)(newY / newX)); if (newX < 0) this._radians += (float)Math.PI; } }
//public PointR(PointF p) //{ // _radius = (float) Math.Pow((Math.Pow((double)p.X ,2.0) + Math.Pow((double)p.Y, 2.0)), 0.5); // _radians = (float) Math.Atan((double) p.Y / (double) p.X); //} #endregion #region Public Methods public void shift(float radius, float degrees) // perhaps this should be called translate { float newX, newY; PointR shiftVector = new PointR(radius, degrees); newX = this.X + shiftVector.X; newY = this.Y + shiftVector.Y; this._radius = (float)Math.Sqrt((double)(newX * newX) + (newY * newY)); if (newX == 0f) { this._radians = 0f; } else { this._radians = (float)Math.Atan((double)(newY / newX)); if (newX < 0) { this._radians += (float)Math.PI; } } }