public void copyValue(myObj updateParam) { mLPoint = updateParam.mLPoint; mr = updateParam.mr; mLvec = updateParam.mLvec; mPen = updateParam.mPen; }
public myObj(DataRow row) { myObj Session = new myObj(); myObj.Sid = row["SID"].ToString(); myObj.Serial = row["SERIAL#"].ToString(); myObj.Username = row["USERNAME"].ToString(); myObj.RunTime = Convert.ToDouble(row["RUN_TIME"].ToString()); myObj.LogonTime = row["LOGON_TIME"].ToString(); myObj.SqlText = row["SQL_FULLTEXT"].ToString(); myObj.Database = row["DATABASE"].ToString(); return(Session); }
public IActionResult FetchStats() { // need to return total # of expeditons, total number of peaks, number of climbed peaks int totalNumExps = _context.Expeditions.Count(); int totalNumPeaks = _context.Peaks.Count(); int numPeaksClimbed = _context.Peaks.Where(p => p.ClimbingStatus == true).Count(); string stats = "{ \"numExpeditions\": " + totalNumExps + ", \"numPeaks\": " + totalNumPeaks + ", \"numClimbs\": " + numPeaksClimbed + "}"; myObj thing = new myObj(totalNumExps, totalNumPeaks, numPeaksClimbed); //string stats = JsonSerializer.Serialize(thing); return(Json(stats)); }
//bool isCross(RectangleF a, RectangleF b) //{ // float ar = a.Width / 2; // float br = b.Width / 2; // float acx = a.Location.X + ar; // float acy = a.Location.Y + ar; // float bcx = b.Location.X + br; // float bcy = b.Location.Y + br; // double d = Math.Sqrt( // Math.Pow(acx - bcx, 2) + // Math.Pow(acy - bcy, 2)); // float maxd = ar+br; // return d < maxd; //} float isCross(myObj a, myObj b) { //if (Math.Min(a.mr, b.mr) > Math.Abs(a.mr - b.mr)) return -1; //if(Math.Abs(a.mr - b.mr)>50)return 1; double dx = //50.0f / Math.Min(a.mr , b.mr) ; Math.Sqrt(1 - (Math.Max(a.mr, b.mr) - Math.Min(a.mr, b.mr)) / Math.Max(a.mr, b.mr)); //dx = 1; //Math.Min(a.mr, b.mr); double d = Math.Sqrt( Math.Pow(a.mLPoint.X - b.mLPoint.X, 2) + Math.Pow(a.mLPoint.Y - b.mLPoint.Y, 2)); float maxd = a.mr + b.mr; return(maxd * (float)dx - (float)d); }
public void randamposition(int cercleLimit) { //cercles.Clear(); int sw = Width; int sh = Height; int minr = (int)(Math.Min(sw, sh) / 100); int maxr = (int)(Math.Max(sw, sh) / 20); int sleshCount = 2000;// (sw*sh)>>(4*101); int count = 0; while (count < sleshCount) { //System.Threading.Thread.Sleep(100); int r = (int)(minr + (maxr - minr) * random.NextDouble()); int cx; //= (int)(sw * random.NextDouble()); int cy; //= (int)(sh * random.NextDouble()); if (cercleLimit > 0 || true) { double x = random.NextDouble() * 2 * (sw + sh); if (x < sw) { cx = (int)(x - 0); cy = -2 * r; } else if (x < 2 * sw) { cx = (int)(x - sw); cy = sh + 2 * r; } else if (x < 2 * sw + sh) { cx = -2 * r; cy = (int)(x - 2 * sw); } else if (x < 2 * sw + 2 * sh) { cx = sw + 2 * r; cy = (int)(x - 2 * sw - sh); } else { cx = 0; cy = 0; int yabai = 0; } } else { cx = (int)(sw * random.NextDouble()); cy = (int)(sh * random.NextDouble()); } SizeF vec = new SizeF(0, 0); do { vec.Width = (float)(random.NextDouble() - 0.5); vec.Height = (float)(random.NextDouble() - 0.5); } while(vec.Width == 0 && vec.Height == 0); double d = Math.Sqrt(vec.Width * vec.Width + vec.Height * vec.Height); vec.Width /= (float)d; vec.Height /= (float)d; myObj newcercle = new myObj( new PointF(cx, cy), r, vec ); newcercle.initPens(); bool findCross = false; foreach (myObj tgt in cercles) { if (isCross(newcercle, tgt) >= 0) { findCross |= true; break; } } if (!findCross) { cercles.Add(newcercle); if (cercleLimit != 0 && cercles.Count > cercleLimit) { break; } continue; //errorCount = 0; } //else count++; } if (initialcount == 0) { initialcount = cercles.Count; } return; }