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
  1. Home
  2. General Programming
  3. LINQ
  4. Gouping Angles

Gouping Angles

Scheduled Pinned Locked Moved LINQ
questiontutorial
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I have a custom collection of points that also contain angle info about something. I would like to group them where heavy occurances are. The angle is in 0-pi and 0-(-ve)pi format. So for example If there are many occurances around pi/2 (i.e. lets say these many occurances range +-10% of pi/2) and a different grouping is around pi/4 (i.e. lets say these occurances range -10% of pi/2 to + 10% of the 0 range). In your mind you can now picture the 8 sectors in polar coordiantes. However I would like the grouping to happen intellegently (I do not want to hard code the groupings). How do I create this GroupBy?

    ASCII stupid question, get a stupid ANSI

    D 1 Reply Last reply
    0
    • L Lost User

      I have a custom collection of points that also contain angle info about something. I would like to group them where heavy occurances are. The angle is in 0-pi and 0-(-ve)pi format. So for example If there are many occurances around pi/2 (i.e. lets say these many occurances range +-10% of pi/2) and a different grouping is around pi/4 (i.e. lets say these occurances range -10% of pi/2 to + 10% of the 0 range). In your mind you can now picture the 8 sectors in polar coordiantes. However I would like the grouping to happen intellegently (I do not want to hard code the groupings). How do I create this GroupBy?

      ASCII stupid question, get a stupid ANSI

      D Offline
      D Offline
      Dan Mos
      wrote on last edited by
      #2

      Something like this:

      var groupedPoints =
      from p in points
      group p by p.PolarSector into g
      select new { PolarSector = g.Key, Points = g };

      I have no idea about your underlying data(fields/properties/etc) so this is the best I could come with.

      modified on Tuesday, January 26, 2010 9:37 PM

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

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