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

Solved How to get the smaller region?

Discussion in 'Development' started by Yexeed, Jan 23, 2018.

  1. Yexeed

    Yexeed Slime

    Messages:
    76
    Here is the example:
    I have two regions. One region is inside of other. Region.php is a class, which contains info about region(flags, members). Here is the picture upload_2018-1-23_18-14-34.png
    Smaller region is marked by blue concrete, the bigger one is marked by red concrete.
    In code they are linked with variables.

    PHP:
    $reg1 = new Region($args); //bigger region
    $reg2 = new Region($args); //smaller region
    So, how can I get the smallest?
    Something like this I asking:
    PHP:
    $smallestReg = *here is the statement that i asking for*
    I have some ideas that i tried, but no one of them helped alot.
    I think I can use AABB that PMMP is provided but i dont know how.
     
  2. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    The simplest way would be to compare the distance between the two points, or you could loop over all the blocks in each region but that will take much longer (lag).
     
    Yexeed likes this.
  3. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Why not just calculate the volume of the region?
     
    jasonwynn10 and Yexeed like this.
  4. Yexeed

    Yexeed Slime

    Messages:
    76
    Very many thanks! I do not know how I could forget about this method to compare
     
  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.