Package jme3utilities.math
Class RectangularSolid
java.lang.Object
jme3utilities.math.RectangularSolid
- All Implemented Interfaces:
com.jme3.export.Savable
A rectangular solid whose axes might not be aligned with the world axes.
Immutable except for
read(com.jme3.export.JmeImporter).-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInstantiate a zero-extent rectangular solid at the origin.RectangularSolid(float[] inputArray) Instantiate a compact solid that bounds the sample locations in the specified float array.RectangularSolid(com.jme3.bounding.BoundingBox aabb) Instantiate a solid that matches the specified axis-aligned bounding box.RectangularSolid(com.jme3.math.Vector3f halfExtents) Instantiate a centered solid with the specified half extents.RectangularSolid(com.jme3.math.Vector3f min, com.jme3.math.Vector3f max, com.jme3.math.Quaternion orientation) Instantiate a solid with the specified minima, maxima, and rotation.RectangularSolid(com.jme3.scene.shape.AbstractBox mesh) Instantiate a solid that exactly matches the specified mesh.RectangularSolid(FloatBuffer buffer, int startPosition, int endPosition) Instantiate a compact solid that bounds the sample locations in the specified FloatBuffer range.RectangularSolid(Collection<com.jme3.math.Vector3f> sampleLocations) Instantiate a compact solid that bounds the specified collection of sample locations.RectangularSolid(RectangularSolid otherSolid, com.jme3.math.Vector3f scaleFactors) Instantiate a rectangular solid by scaling another solid around its center. -
Method Summary
Modifier and TypeMethodDescriptioncom.jme3.math.Vector3fcenterLocal(com.jme3.math.Vector3f storeResult) Return the center location in local coordinates.com.jme3.math.Vector3fcenterWorld(com.jme3.math.Vector3f storeResult) Return the center location in world coordinates.com.jme3.math.Vector3fhalfExtents(com.jme3.math.Vector3f storeResult) Determine the half extents of the solid.List<com.jme3.math.Vector3f>Enumerate the corner locations of the specified RectangularSolid.com.jme3.math.QuaternionlocalToWorld(com.jme3.math.Quaternion storeResult) Copy the local-to-world rotation.com.jme3.math.Vector3flocalToWorld(com.jme3.math.Vector3f local, com.jme3.math.Vector3f storeResult) Rotate from local coordinates to world coordinates.com.jme3.math.Vector3fmaxima(com.jme3.math.Vector3f storeResult) Copy the maximum coordinate value for each local axis.com.jme3.math.Vector3fminima(com.jme3.math.Vector3f storeResult) Copy minimum coordinate value for each local axis.voidread(com.jme3.export.JmeImporter importer) De-serialize this solid, for example when loading from a J3O file.toString()Represent this solid as a text string.floatvolume()Determine the volume of the solid.voidwrite(com.jme3.export.JmeExporter exporter) Serialize this solid, for example when saving to a J3O file.
-
Field Details
-
logger
message logger for this class
-
-
Constructor Details
-
RectangularSolid
public RectangularSolid()Instantiate a zero-extent rectangular solid at the origin. -
RectangularSolid
public RectangularSolid(com.jme3.scene.shape.AbstractBox mesh) Instantiate a solid that exactly matches the specified mesh.- Parameters:
mesh- the input mesh (not null, finite, non-negative extents, unaffected)
-
RectangularSolid
public RectangularSolid(com.jme3.bounding.BoundingBox aabb) Instantiate a solid that matches the specified axis-aligned bounding box.- Parameters:
aabb- the axis-aligned bounding box (not null, finite, non-negative extents, unaffected)
-
RectangularSolid
Instantiate a compact solid that bounds the specified collection of sample locations.- Parameters:
sampleLocations- the sample locations (not null, at least 2, unaffected)
-
RectangularSolid
public RectangularSolid(float[] inputArray) Instantiate a compact solid that bounds the sample locations in the specified float array.- Parameters:
inputArray- the sample locations (not null, at least 6 elements, length a multiple of 3, unaffected)
-
RectangularSolid
Instantiate a compact solid that bounds the sample locations in the specified FloatBuffer range.- Parameters:
buffer- the buffer that contains the sample locations (not null, unaffected)startPosition- the position at which the sample locations start (≥0, ≤endPosition-6)endPosition- the position at which the sample locations end (≥startPosition+6, ≤capacity)
-
RectangularSolid
public RectangularSolid(com.jme3.math.Vector3f halfExtents) Instantiate a centered solid with the specified half extents.- Parameters:
halfExtents- half extents the axis-aligned bounding box (not null, unaffected)
-
RectangularSolid
public RectangularSolid(com.jme3.math.Vector3f min, com.jme3.math.Vector3f max, com.jme3.math.Quaternion orientation) Instantiate a solid with the specified minima, maxima, and rotation.- Parameters:
min- the minimum coordinate value for each local axis (not null, finite, unaffected)max- the maximum coordinate value for each local axis (not null, finite, unaffected)orientation- the orientation of the local axes (not null, not zero, unaffected)
-
RectangularSolid
Instantiate a rectangular solid by scaling another solid around its center.- Parameters:
otherSolid- (not null, unaffected)scaleFactors- (not null, all components non-negative, unaffected)
-
-
Method Details
-
centerLocal
public com.jme3.math.Vector3f centerLocal(com.jme3.math.Vector3f storeResult) Return the center location in local coordinates.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- a location vector in local coordinates (either storeResult or a new vector, not null)
-
centerWorld
public com.jme3.math.Vector3f centerWorld(com.jme3.math.Vector3f storeResult) Return the center location in world coordinates.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- a location vector in world coordinates (either storeResult or a new vector, not null)
-
halfExtents
public com.jme3.math.Vector3f halfExtents(com.jme3.math.Vector3f storeResult) Determine the half extents of the solid.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- the half extent of each local axis (either storeResult or a new vector, not null, all components non-negative)
-
listCorners
Enumerate the corner locations of the specified RectangularSolid.- Returns:
- a new list of new vectors
-
localToWorld
public com.jme3.math.Quaternion localToWorld(com.jme3.math.Quaternion storeResult) Copy the local-to-world rotation.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- the maxima (either storeResult or a new vector, not null)
-
localToWorld
public com.jme3.math.Vector3f localToWorld(com.jme3.math.Vector3f local, com.jme3.math.Vector3f storeResult) Rotate from local coordinates to world coordinates.It is safe for
localandstoreResultto be the same object.- Parameters:
local- the input coordinates (not null, unaffected)storeResult- storage for the result (modified if not null)- Returns:
- the corresponding world coordinates (either storeResult or a new vector, not null)
-
maxima
public com.jme3.math.Vector3f maxima(com.jme3.math.Vector3f storeResult) Copy the maximum coordinate value for each local axis.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- the maxima (either storeResult or a new vector, not null)
-
minima
public com.jme3.math.Vector3f minima(com.jme3.math.Vector3f storeResult) Copy minimum coordinate value for each local axis.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- the minima (either storeResult or a new vector, not null)
-
volume
public float volume()Determine the volume of the solid.- Returns:
- the volume (in cubic world units, ≥0)
-
toString
Represent this solid as a text string. -
read
De-serialize this solid, for example when loading from a J3O file.- Specified by:
readin interfacecom.jme3.export.Savable- Parameters:
importer- (not null)- Throws:
IOException- from importer
-
write
Serialize this solid, for example when saving to a J3O file.- Specified by:
writein interfacecom.jme3.export.Savable- Parameters:
exporter- (not null)- Throws:
IOException- from exporter
-