Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 11889214

@User 11889214
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Check if xy point is within a polygon Console App
    U User 11889214

    I didn't add the drawing reference. Not my day. Thank you Richard. It works

    C# help question csharp database mysql

  • Check if xy point is within a polygon Console App
    U User 11889214

    I have create a Win form app and create Polygons as follows: private List> Polygons = new List>(); I store this polygons with Xml.Serialization, into a MySQL database as string and Deserialize it with my console app into a list of polygons again. In my console app, which eventually is going to run from Raspberry Pi, I'm getting data from USB, which consist of floating X and floating Y coordinates. Now I want to know how do I check if this point is within one of the polygons. I've tried it first with WinForms app and it works great. public static bool IsPointInPolygon(IList polygon, PointF testPoint) { try { bool result = false; int j = polygon.Count() - 1; for (int i = 0; i < polygon.Count(); i++) { if (polygon[i].Y < testPoint.Y && polygon[j].Y >= testPoint.Y || polygon[j].Y < testPoint.Y && polygon[i].Y >= testPoint.Y) { if (polygon[i].X + (testPoint.Y - polygon[i].Y) / (polygon[j].Y - polygon[i].Y) * (polygon[j].X - polygon[i].X) < testPoint.X) { result = !result; } } j = i; } return result; } catch (Exception ex) { MessageBox.Show("error - " + ex.ToString()); return false; } I don't want to draw something, I know it's a console app, just getting a bool or int value back from the Test. Any suggestions or help please?

    C# help question csharp database mysql
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups