@Override
public Set<Vector3> getExteriorPoints(IFieldInteraction projector)
{
final Set<Vector3> fieldBlocks = new HashSet<Vector3>();
final Vector3 posScale = projector.getPositiveScale();
final Vector3 negScale = projector.getNegativeScale();
final int xStretch = posScale.intX() + negScale.intX();
final int yStretch = posScale.intY() + negScale.intY();
final int zStretch = posScale.intZ() + negScale.intZ();
final Vector3 translation = new Vector3(0, -negScale.intY(), 0);
final int inverseThickness = (int) Math.max((yStretch + zStretch) / 4f, 1);
System.out.println(inverseThickness);
for (float y = 0; y <= yStretch; y += 1f)
{
for (float x = -xStretch; x <= xStretch; x += 1f)
{
for (float z = -zStretch; z <= zStretch; z += 1f)
{
double yTest = (y / yStretch) * inverseThickness;
double xzPositivePlane = (1 - (x / xStretch) - (z / zStretch)) * inverseThickness;
double xzNegativePlane = (1 + (x / xStretch) - (z / zStretch)) * inverseThickness;
// Positive Positive Plane
if (x >= 0 && z >= 0 && Math.round(xzPositivePlane) == Math.round(yTest))
{
fieldBlocks.add(new Vector3(x, y, z).add(translation));
fieldBlocks.add(new Vector3(x, y, -z).add(translation));
}
// Negative Positive Plane
if (x <= 0 && z >= 0 && Math.round(xzNegativePlane) == Math.round(yTest))
{
fieldBlocks.add(new Vector3(x, y, -z).add(translation));
fieldBlocks.add(new Vector3(x, y, z).add(translation));
}
// Ground Level Plane
if (y == 0 && (Math.abs(x) + Math.abs(z)) < (xStretch + yStretch) / 2)
{
fieldBlocks.add(new Vector3(x, y, z).add(translation));
}
}
}
}