Пример #1
0
        public PolarPoint <TRadius, TAngle> ToPolar <TRadius, TAngle>(AngleRange range)
            where TRadius : LinearUnit, new()
            where TAngle : AngularUnit, new()
        {
            TRadius radius = new TRadius();

            double tempX = this.X.ChangeTo <TRadius>().Value;

            double tempY = this.Y.ChangeTo <TRadius>().Value;

            radius.Value = Math.Sqrt(tempX * tempX + tempY * tempY);

            Radian angle = new Radian(Math.Atan2(tempY, tempX), range);                  //use tempX and tempY

            return(new PolarPoint <TRadius, TAngle>(radius, angle.ChangeTo <TAngle>())); //do not need to cast!
        }