public Node FindNodeWhichContains(UV point) { Node n = null; if (IsLeafNode) { if (Contains(point)) { return(this); } } else { if (NW.Contains(point)) { n = NW.FindNodeWhichContains(point); } else if (NE.Contains(point)) { n = NE.FindNodeWhichContains(point); } else if (SW.Contains(point)) { n = SW.FindNodeWhichContains(point); } else if (SE.Contains(point)) { n = SE.FindNodeWhichContains(point); } } return(n); }
public bool TryFind(UV uv, out Node node) { if (!Contains(uv)) { node = null; return(false); } if (IsLeafNode) { if (Point.IsAlmostEqualTo(uv)) { node = this; return(true); } else { node = null; return(false); } } if (NW.Contains(uv)) { if (NW.TryFind(uv, out node)) { return(true); } } else if (NE.Contains(uv)) { if (NE.TryFind(uv, out node)) { return(true); } } else if (SW.Contains(uv)) { if (SW.TryFind(uv, out node)) { return(true); } } else if (SE.Contains(uv)) { if (SE.TryFind(uv, out node)) { return(true); } } node = null; return(false); }