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. C#
  4. Point Arrangement and Orientation

Point Arrangement and Orientation

Scheduled Pinned Locked Moved C#
graphicsdata-structureshelp
3 Posts 2 Posters 0 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.
  • G Offline
    G Offline
    gigahertz205
    wrote on last edited by
    #1

    Many overloads of System.Drawing.Graphics use Point array as a parameter. But I've found a puzzling problem with the Point array. The order in which the points are stored in the array creates different shape than intended. I used System.Drawing.Graphics.FillPolygon using four points and two different results came out depending on the order of points(http://img509.imageshack.us/img509/2944/boxch5.jpg[^]). Yes, i could have used the FillRectangle, but i will use figures with more than 4 sides. I want to know if there is a way to arrange the points so that they have a counterclockwise or clockwise rotation.

    G 1 Reply Last reply
    0
    • G gigahertz205

      Many overloads of System.Drawing.Graphics use Point array as a parameter. But I've found a puzzling problem with the Point array. The order in which the points are stored in the array creates different shape than intended. I used System.Drawing.Graphics.FillPolygon using four points and two different results came out depending on the order of points(http://img509.imageshack.us/img509/2944/boxch5.jpg[^]). Yes, i could have used the FillRectangle, but i will use figures with more than 4 sides. I want to know if there is a way to arrange the points so that they have a counterclockwise or clockwise rotation.

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      gigahertz205 wrote:

      The order in which the points are stored in the array creates different shape than intended.

      The result is exactly as expected. The FillPolygon doesn't do any calculations to find out which points are nearest to each other, it just draws a polygon using the points in the exact order that you specified.

      gigahertz205 wrote:

      I want to know if there is a way to arrange the points so that they have a counterclockwise or clockwise rotation.

      Where do you get the points from, and what's the reason that they are not in that order already?

      Despite everything, the person most likely to be fooling you next is yourself.

      G 1 Reply Last reply
      0
      • G Guffa

        gigahertz205 wrote:

        The order in which the points are stored in the array creates different shape than intended.

        The result is exactly as expected. The FillPolygon doesn't do any calculations to find out which points are nearest to each other, it just draws a polygon using the points in the exact order that you specified.

        gigahertz205 wrote:

        I want to know if there is a way to arrange the points so that they have a counterclockwise or clockwise rotation.

        Where do you get the points from, and what's the reason that they are not in that order already?

        Despite everything, the person most likely to be fooling you next is yourself.

        G Offline
        G Offline
        gigahertz205
        wrote on last edited by
        #3

        Well if you look at my previous posts, you will get a basic idea of what im trying to do. I want to divide up an image using arbitrarily oriented lines, and use points of the polygons to edit the contents within that region. Basically, i use two points to create line segments, whose points will be added to Point arrays of that region. But then again, i as i create the line segments, i have no way to enforce which points to add first.

        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