-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Boxes need the ability to be expanded properly by rotation.
- Loading branch information
AfterLifeLochie
committed
Oct 4, 2014
1 parent
e3f93ee
commit 9374eb2
Showing
5 changed files
with
119 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package lc.common.util.math; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class VectorAABB { | ||
|
||
private Vector3 min; | ||
private Vector3 max; | ||
|
||
public static VectorAABB box(Vector3 min, Vector3 max) { | ||
return new VectorAABB(min, max); | ||
} | ||
|
||
public static VectorAABB boxOf(Vector3 origin, Vector3 dim) { | ||
return new VectorAABB(origin, origin.add(dim)); | ||
} | ||
|
||
public static VectorAABB boxOf(Vector3 origin, int width, int height, int length) { | ||
return new VectorAABB(origin, origin.add(new Vector3(width, height, length))); | ||
} | ||
|
||
private VectorAABB(Vector3 min, Vector3 max) { | ||
this.min = min; | ||
this.max = max; | ||
} | ||
|
||
public VectorAABB expand(Vector3 size) { | ||
return new VectorAABB(min, max.add(size)); | ||
} | ||
|
||
public List<Vector3> contents() { | ||
ArrayList<Vector3> result = new ArrayList<Vector3>(); | ||
for (int x = min.floorX(); x < max.floorX(); x++) | ||
for (int z = min.floorZ(); z < max.floorZ(); z++) | ||
for (int y = min.floorY(); y < max.floorY(); y++) | ||
result.add(new Vector3(x, y, z)); | ||
return result; | ||
} | ||
|
||
public void apply(Vector3 point, Matrix3 rotation) { | ||
// TODO Auto-generated method stub | ||
} | ||
} |