Package de.coreengine.util
Class Toolbox
- java.lang.Object
- 
- de.coreengine.util.Toolbox
 
- 
 public class Toolbox extends Object Class that contains some useful functions- Author:
- Darius Dinger
 
- 
- 
Constructor SummaryConstructors Constructor Description Toolbox()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static float[]addElement(float[] array, float element)Adding an float element to an float arraystatic int[]addElement(int[] array, int element)Adding an int element to an int arraystatic <T> T[]addElement(T[] array, T element)Adding an element to an arraystatic StringarrayToString(float[] arr, String seperator)Convert a float array into a stringstatic float[]calcTangent(float v0x, float v0y, float v0z, float v1x, float v1y, float v1z, float v2x, float v2y, float v2z, float v0u, float v0v, float v1u, float v1v, float v2u, float v2v)Calculating tangent for a trianglestatic ColorgenerateRandomColor()static float[]matrixToFloatArray(javax.vecmath.Matrix4f mat)Transforming a matrix4f from vecmtath to a 16 valued float array.
 Maybe not the most performant procedure...static floatmax(float... values)Getting the greatest float of valuesstatic floatmin(float... values)Getting the smallest float of valuesstatic floatrandomFloat(float min, float max)Generating a random float between min and maxstatic intrandomInt(int min, int max)Generating a random integer between min and maxstatic javax.vecmath.Vector2frandomVector(javax.vecmath.Vector2f min, javax.vecmath.Vector2f max)Generating random vector between min and maxstatic javax.vecmath.Vector3frandomVector(javax.vecmath.Vector3f min, javax.vecmath.Vector3f max)Generating random vector between min and maxstatic float[]stringToArrayf(String str, String seperator)Convert a string into a float arraystatic int[]stringToArrayi(String str, String seperator)Convert a string into a integer arraystatic float[]toArrayf(List<Float> floats)Converting a list of floats into a float array.static int[]toArrayi(List<Integer> ints)Converting a list of integers into a int array.
 
- 
- 
- 
Method Detail- 
addElementpublic static <T> T[] addElement(T[] array, T element)Adding an element to an array- Type Parameters:
- T- Type of the array data
- Parameters:
- array- Array where the element should be added
- element- Element to add into array
- Returns:
- New array with element added
 
 - 
addElementpublic static int[] addElement(int[] array, int element)Adding an int element to an int array- Parameters:
- array- Array where the element should be added
- element- Element to add into array
- Returns:
- New array with element added
 
 - 
addElementpublic static float[] addElement(float[] array, float element)Adding an float element to an float array- Parameters:
- array- Array where the element should be added
- element- Element to add into array
- Returns:
- New array with element added
 
 - 
matrixToFloatArraypublic static float[] matrixToFloatArray(javax.vecmath.Matrix4f mat) Transforming a matrix4f from vecmtath to a 16 valued float array.
 Maybe not the most performant procedure...- Parameters:
- mat- Matrix to transform
- Returns:
- Transformed float array
 
 - 
generateRandomColorpublic static Color generateRandomColor() - Returns:
- Random color
 
 - 
toArrayfpublic static float[] toArrayf(List<Float> floats) Converting a list of floats into a float array. Because java hates that...- Parameters:
- floats- Float list to convert
- Returns:
- Converted float array
 
 - 
toArrayipublic static int[] toArrayi(List<Integer> ints) Converting a list of integers into a int array.- Parameters:
- ints- Integer list to convert
- Returns:
- Converted int array
 
 - 
arrayToStringpublic static String arrayToString(float[] arr, String seperator) Convert a float array into a string- Parameters:
- arr- Array to convert
- seperator- Sperator of the string
- Returns:
- Generated string
 
 - 
stringToArrayfpublic static float[] stringToArrayf(String str, String seperator) Convert a string into a float array- Parameters:
- str- String to convert
- seperator- Seperator of the string
- Returns:
- Generated float array
 
 - 
stringToArrayipublic static int[] stringToArrayi(String str, String seperator) Convert a string into a integer array- Parameters:
- str- String to convert
- seperator- Seperator of the string
- Returns:
- Generated int array
 
 - 
randomFloatpublic static float randomFloat(float min, float max)Generating a random float between min and max- Parameters:
- min- Min value of the float
- max- Max value of the float
- Returns:
- Generated value
 
 - 
randomIntpublic static int randomInt(int min, int max)Generating a random integer between min and max- Parameters:
- min- Min value of the integer
- max- Max value of the integer
- Returns:
- Generated value
 
 - 
randomVectorpublic static javax.vecmath.Vector3f randomVector(javax.vecmath.Vector3f min, javax.vecmath.Vector3f max)Generating random vector between min and max- Parameters:
- min- Min vector values
- max- Max vector values
- Returns:
- Generated vector
 
 - 
randomVectorpublic static javax.vecmath.Vector2f randomVector(javax.vecmath.Vector2f min, javax.vecmath.Vector2f max)Generating random vector between min and max- Parameters:
- min- Min vector values
- max- Max vector values
- Returns:
- Generated vector
 
 - 
minpublic static float min(float... values) Getting the smallest float of values- Parameters:
- values- Floats to gets smallest from
- Returns:
- Smallest float of values
 
 - 
maxpublic static float max(float... values) Getting the greatest float of values- Parameters:
- values- Floats to gets greatest from
- Returns:
- Greatest float of values
 
 - 
calcTangentpublic static float[] calcTangent(float v0x, float v0y, float v0z, float v1x, float v1y, float v1z, float v2x, float v2y, float v2z, float v0u, float v0v, float v1u, float v1v, float v2u, float v2v)Calculating tangent for a triangle- Parameters:
- v0x- X coordinate of vertex 0
- v0y- Y coordinate of vertex 0
- v0z- Z coordinate of vertex 0
- v1x- X coordinate of vertex 1
- v1y- Y coordinate of vertex 1
- v1z- Z coordinate of vertex 1
- v2x- X coordinate of vertex 2
- v2y- Y coordinate of vertex 2
- v2z- Z coordinate of vertex 2
- v0u- U coordinate of vertex 0
- v0v- V coordinate of vertex 0
- v1u- U coordinate of vertex 1
- v1v- V coordinate of vertex 1
- v2u- U coordinate of vertex 2
- v2v- V coordinate of vertex 2
- Returns:
- Tangent as float array [x, y, z]
 
 
- 
 
-