Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Irregular selections

Comments in 'Plugin Development' started by PEMapModder, Jul 22, 2014.

  1. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Hello, I would like to ask how to check if a point is inside an irregular selection. Since 3D is too complicated, I only tried 2D. https://github.com/PEMapModder/smal...rc/pemapmodder/customareas/math/Irregular.php shows my attempt to make it, but it doesn't work with concave shapes. Only convex shapes work with it. I used the formula of y = slope * x + y-intercept to find out if a point is above/on/below a line (as the edge of a shape), so a Vector2 point is inside that shape if for any two adjacent lines it is "inside" (on either line, or above first line and below second line, or above second line and below first line). However, this "inside" theory doesn't work if it is a concave shape. Therefore, I am asking for help here.

    P.S. I know @Falk is the expert on these :p
    Dutok likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    If you don't know, just don't post.
    Dutok, iJoshuaHD and swagboy47 like this.
  3. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    64FF00 and PEMapModder like this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Falk likes this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
  6. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    What exactly do you need to do?
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    For example, set a prism of that shape with a given height to a given type of block.
    Which means I need to get a list of the blocks.

Share This Page

Advertisement