public bool Intersects(Hop5DPoly other) { if (!valid || !other.valid) { return(false); } if (minX >= other.maxX || other.minX >= maxX || minY >= other.maxY || other.minY >= maxY || minZ >= other.maxZ || other.minZ >= maxZ) { return(false); } if (this.HasSeparatingAxis(other)) { return(false); } if (other.HasSeparatingAxis(this)) { return(false); } return(true); }
bool HasSeparatingAxis(Hop5DPoly other) { for (int i = 0; i < points.Count; ++i) { bool clean = true; for (int j = 0; j < other.points.Count; ++j) { int det = Determinant(points[i], points[(i + 1) % points.Count], other.points[j]); if (det < 0) clean = false; } if (clean) return true; } return false; }
public bool Intersects(Hop5DPoly other) { if (!valid || !other.valid) return false; if (minX >= other.maxX || other.minX >= maxX || minY >= other.maxY || other.minY >= maxY || minZ >= other.maxZ || other.minZ >= maxZ) return false; if (this.HasSeparatingAxis(other)) return false; if (other.HasSeparatingAxis(this)) return false; return true; }
bool HasSeparatingAxis(Hop5DPoly other) { for (int i = 0; i < points.Count; ++i) { bool clean = true; for (int j = 0; j < other.points.Count; ++j) { int det = Determinant(points[i], points[(i + 1) % points.Count], other.points[j]); if (det < 0) { clean = false; } } if (clean) { return(true); } } return(false); }