getSubnodeIndex static method

int getSubnodeIndex(
  1. Envelope? env,
  2. double centrex,
  3. double centrey
)

Gets the index of the subquad that wholly contains the given envelope. If none does, returns -1.

@return the index of the subquad that wholly contains the given envelope or -1 if no subquad wholly contains the envelope

Implementation

static int getSubnodeIndex(Envelope? env, double centrex, double centrey) {
  int subnodeIndex = -1;
  if (env!.getMinX() >= centrex) {
    if (env.getMinY() >= centrey) subnodeIndex = 3;
    if (env.getMaxY() <= centrey) subnodeIndex = 1;
  }
  if (env.getMaxX() <= centrex) {
    if (env.getMinY() >= centrey) subnodeIndex = 2;
    if (env.getMaxY() <= centrey) subnodeIndex = 0;
  }
  return subnodeIndex;
}