コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Speed.GetHashCode() * 397) ^ Deg.GetHashCode());
     }
 }
コード例 #2
0
ファイル: Window1.xaml.cs プロジェクト: shayan-taheri/StarPad
        private bool ScribbleDelete(Stroq stroq, out StroqCollection erasedStroqs)
        {
            bool canBeScribble = stroq.OldPolylineCusps().Length > 4;

            if (stroq.OldPolylineCusps().Length == 4)
            {
                int[] pcusps = stroq.OldPolylineCusps();
                Deg   a1     = fpdangle(stroq[0], stroq[pcusps[1]], stroq[pcusps[2]] - stroq[pcusps[1]]);
                Deg   a2     = fpdangle(stroq[pcusps[1]], stroq[pcusps[1]], stroq[pcusps[3]] - stroq[pcusps[1]]);
                if (a1 < 35 && a2 < 35)
                {
                    canBeScribble = stroq.BackingStroke.HitTest(stroq.ConvexHull().First(), 1);
                }
            }
            if (canBeScribble)
            {
                IEnumerable <Pt> hull = stroq.ConvexHull();
                StroqCollection  stqs = inqCanvas.Stroqs.HitTest(hull, 1);
                if (stqs.Count > 1)
                {
                    inqCanvas.Stroqs.Remove(stqs);
                    erasedStroqs = stqs;
                    inqCanvas.Stroqs.Remove(stroq);
                    return(true);
                }
            }
            erasedStroqs = null;
            return(false);
        }
コード例 #3
0
        public int GetHash(ref int idx)
        {
            int hash = 1;

            hash += Deg.GetHash(ref idx) * PrimerLUT.GetPrimer(idx++);
            hash += SkillId.GetHash(ref idx) * PrimerLUT.GetPrimer(idx++);
            return(hash);
        }
コード例 #4
0
ファイル: Angle.cs プロジェクト: huohuoya/RP.Math
        /// <summary>
        /// Textual description of the Anlge
        /// </summary>
        /// <param name="format">
        /// Formatting string:
        /// 'd' (degrees),
        /// 'g' (gradians),
        /// 'r' (radians),
        /// '', or
        /// 'v' (verbose)
        /// followed by standard numeric format string characters valid for a double precision floating point</param>
        /// <param name="formatProvider">The culture specific fromatting provider</param>
        /// <returns>Text (String) representing the vector</returns>
        public string ToString(string format, IFormatProvider formatProvider)
        {
            // If no format is passed
            if (string.IsNullOrEmpty(format))
            {
                return(v.ToString());
            }

            char   firstChar = Char.ToLower(format[0]);
            string remainder = null;

            if (format.Length > 1)
            {
                remainder = format.Substring(1);
            }

            switch (firstChar)
            {
            case 'd': return(Deg.ToString(remainder, formatProvider));

            case 'r': return(Rad.ToString(remainder, formatProvider));

            case 'g': return(Grad.ToString(remainder, formatProvider));

            case 'v':
                return
                    (string.Format
                     (
                         "{0} {1} angle of {2} radians ( {3} degrees, {4} gradians )",
                         IsClockwise() ? "Clockwise" : "Counter-clockwise",
                         IsAcute() ?
                         "acute" : IsRightAngle() ?
                         "right" : IsObtuse() ?
                         "obtuse" : IsStraitAngle() ?
                         "strait" : IsReflex() ?
                         "reflex" : IsFullOrZeroAngle() ?
                         "full (or zero)" : "Unknown",
                         Rad.ToString(remainder, formatProvider),
                         Deg.ToString(remainder, formatProvider),
                         Grad.ToString(remainder, formatProvider)
                     ));

            default:
                return(v.ToString(format, formatProvider));
            }
        }
コード例 #5
0
 protected bool Equals(Wind other)
 {
     return(Speed.Equals(other.Speed) && Deg.Equals(other.Deg));
 }
コード例 #6
0
 public void DumpStr(StringBuilder sb, string prefix)
 {
     sb.AppendLine(prefix + "Deg" + ":" + Deg.ToString());
     sb.AppendLine(prefix + "SkillId" + ":" + SkillId.ToString());
 }