/// <summary> /// Computes exponent of already converted complex number in polar form. /// </summary> /// <param name="polar"></param> /// <param name="f"></param> /// <returns></returns> public static Complexf Pow(Polarf polar, float f) { return(new Complexf(MathHelper.Pow(polar.R, f), polar.Phi * f)); }
//#ifdef PolarClassName Cos Sin /// <summary> /// A polar conversion constructor. /// </summary> /// <param name="polar"></param> public Complexf(Polarf polar) { this.Re = polar.R * MathHelper.Cos(polar.Phi); this.Im = polar.R * MathHelper.Sin(polar.Phi); }
//#endif #endregion #region Additional operations //#ifdef Pow PolarClassName /// <summary> /// Computes exponent. /// </summary> /// <param name="f"></param> /// <returns></returns> public static Complexf Pow(Complexf cmp, float f) { Polarf polar = cmp.Polar; return(Pow(polar, f)); }
/// <summary> /// Checks for near equality. /// </summary> /// <param name="c1">The first cylinder.</param> /// <param name="c2">The second cylinder.</param> /// <param name="eps">The maximum error tolerance.</param> /// <returns>Are they nearly equal.</returns> public static bool NearEqual(Cylindricalf c1, Cylindricalf c2, float eps) { return(Polarf.NearEqual(c1.Polar, c2.Polar, eps) && MathHelper.NearEqual(c1.Z, c2.Z, eps)); }
//#ifdef NearEqual /// <summary> /// Checks for near equality. /// </summary> /// <param name="c1">The first cylinder.</param> /// <param name="c2">The second cylinder.</param> /// <returns>Are they nearly equal.</returns> public static bool NearEqual(Cylindricalf c1, Cylindricalf c2) { return(Polarf.NearEqual(c1.Polar, c2.Polar) && MathHelper.NearEqual(c1.Z, c2.Z)); }
/// <summary> /// Constructor using polar + z. /// </summary> /// <param name="p0">The polar coordinate.</param> /// <param name="zr">The z distance.</param> public Cylindricalf(Polarf p, float z) { Polar = p; Z = z; }
//#endif #endregion #region Constructors /// <summary> /// Constructor using all three parameters. /// </summary> /// <param name="phi">The angle as for normal polar coordinate.</param> /// <param name="r">The distance in X-Y plane.</param> /// <param name="zr">The z offset.</param> public Cylindricalf(float phi, float r, float z) { this.Polar = new Polarf(phi, r); this.Z = z; }