1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

How to properly select a polygon

Discussion in 'Development' started by Thunder33345, Nov 13, 2016.

  1. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    So out of curiositity i decided to ask this question. This question come in mine when i read this thread (http://forums.pocketmine.net/threads/protect-new-protect-or-guard-plugin-ideas.18638/) where someone requested a world protect like plugin, but the twist is to select and protect a non rectangular area. (image below)
    [​IMG]
    For the sake of simplicity : I will use this function to check when an event is triggered, What i do doesn't matter here, that is not the point this thread the point is to discuss and help future developers who could do with this.
    Keep in mind i an very bad on math so if there something obvious i am missing please point it out kindly and fancy math talk just confuses me further so explain it like i am 5 should make our life easier.
    First idea come into mind would be to split it into 2 squares sounds easy right?
    No not that easy if you are not a human.
    so How do you even:
    efficiently pass all the points into the function,
    efficiently cut the selection into pieces
    efficiently check if player is in bound

    Keep in mind that the function provided should work with how many points present
    Edit a better term "polygon"
     
    Last edited: Nov 13, 2016
    Kenn Fatt likes this.
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    This was exactly my question. I really have problem trying to think of a way of doing this.
     
    Kenn Fatt likes this.
  3. KnownUnown

    KnownUnown Spider Jockey Poggit Reviewer

    Messages:
    47
    GitHub:
    knownunown
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    Thanks a bit of research here and there i think i should look into volex ray casting
    as since this is a voxle based game anyway
     
  5. Kenn Fatt

    Kenn Fatt Slime

    Messages:
    82
    GitHub:
    kennfatt
    Nice, i hope you will start that project.
     
  6. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    nope
    i dont think i could do it unless i blindly translate without understanding what it even does
    (i recommend you to just re make a plugin request maybe it will get some attention)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.