bool OutOfBounds(AAPrism current) { bool returnval = false; current.Contract(VoxelSize * .1f); foreach (var point in current.GetCorners()) { if (!bounds.Contains(point)) { returnval = true; } } current.Expand(VoxelSize * .1f); return(returnval); }
bool KnitStep(AAPrism current, Axis axis, float posneg) { current.Expand(axis, posneg * VoxelSize); current.Contract(VoxelSize * .1f); //This is a little hack to prevent coplanar hits along non-expanding sides //we have to make sure to expand again before exiting foreach (var point in current.GetCorners()) //check if we hit the outside bounds //TODO only do max and min? { if (!bounds.Contains(point)) { current.Expand(VoxelSize * .1f); current.Contract(axis, posneg * VoxelSize); return(false); } } foreach (var item in a) //check if we hit another prism { if (item.Equals(current)) { continue; } if (item.bounds.Intersects(current.bounds)) { current.Expand(VoxelSize * .1f); current.Contract(axis, posneg * VoxelSize); //log the neighbour relation current.AddNeighbour(item); item.AddNeighbour(current); return(false); } } current.Expand(VoxelSize * .1f); if (current.Intersects) //check if we hit an object { current.Contract(axis, posneg * VoxelSize); return(false); } else //no intersections so growth continues, remove all covered seeds { Bounds b = current.bounds; seeds.RemoveAll(item => b.Contains(item.Centre)); //TODO change to just intersection? (can't be full sized) return(true); } }