java.lang.Object
de.grogra.ext.x3d.util.Util
This class provides usefull static methods for recurring tasks.
- Author:
- Udo Bischof, Uwe Mannl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
colorToInt
(Tuple3f color) Converts a Tuple3f color object (range from 0-1) to an int color.static int
colorToInt
(Tuple4f color) Converts a Tuple4f color object (range from 0-1) to an int color.static AxisAngle4d
convertStringToAxisAngle4d
(AxisAngle4d result, String value) Split string and convert into groimp coordinates.static Tuple3d
convertStringToTuple3d
(Tuple3d result, String value) Split string and convert into groimp coordinates.static Tuple3f
convertStringToTuple3f
(Tuple3f result, String value) Split string and convert into groimp coordinates.static Tuple4f
convertStringToTuple4f
(Tuple4f result, String value) Split string and convert into groimp coordinates.static Vector3d
findOrthogonalVector
(Vector3d vec1) Returns an orthogonal vector to given vector.static ImageAdapter
getImageForURL
(String imgUrl, boolean saveInGroIMP) static ImageAdapter
static String
getRealPath
(FileSource file) Extract the path-part as a String from the FileSource.static String
getRealPath
(File file) Extract the path-part as a String from the URL.static String
getRealPath
(URL url) Extract the path-part as a String from the URL.static float
intToGray
(int color) static RGBColor
intToRGB
(int color) static int
overlapPixel
(int background, int foreground) Calculates to an background pixel a new foreground pixel in consideration of transparency of foreground pixel.static boolean
pointsOnLine
(ArrayList<Point3d> points) Checks if given points are on a straight line.static int
round
(double value) Rounds the value with the Math.round() function and casts the result to int.static float[]
splitStringToArray2f
(String value) static float[]
splitStringToArray2f
(String value, float default1, float default2) static double[]
splitStringToArray3d
(String value) static double[]
splitStringToArray3d
(String value, double default1, double default2, double default3) static float[]
splitStringToArray3f
(String value) static float[]
splitStringToArray3f
(String value, float default1, float default2, float default3) static double[]
splitStringToArray4d
(String value) Split String on Whitespaces and return values as double-Arraystatic double[]
splitStringToArray4d
(String value, double default1, double default2, double default3, double default4) Split String on Whitespaces and return values as double-Arraystatic float[]
splitStringToArray4f
(String value) Split String on Whitespaces and return values as double-Arraystatic float[]
splitStringToArray4f
(String value, float default1, float default2, float default3, float default4) Split String on Whitespaces and return values as double-Arraystatic double[]
splitStringToArrayOfDouble
(String value) static double[]
splitStringToArrayOfDouble
(String value, double[] def) static float[]
splitStringToArrayOfFloat
(String value) static float[]
splitStringToArrayOfFloat
(String value, float[] defaultArray) static int[]
splitStringToArrayOfInt
(String value) static int[]
splitStringToArrayOfInt
(String value, int[] defaultArray) static String[]
splitStringToArrayOfString
(String value) Splits a string containing multiple strings to an array of strings.static String[]
splitStringToArrayOfString
(String value, String[] def) Splits a string containing multiple strings to an array of strings.static AxisAngle4d
splitStringToAxisAngle4d
(AxisAngle4d result, String value) Split string without convert.splitStringToListOfStrings
(String value) static Tuple2f
splitStringToTuple2f
(Tuple2f result, String value) static Tuple3d
splitStringToTuple3d
(Tuple3d result, String value) Split string without convert.static Tuple3f
splitStringToTuple3f
(Tuple3f result, String value) Split string without convert.static Tuple4f
splitStringToTuple4f
(Tuple4f result, String value) Split string without convert.static Matrix4d
vectorsToTransMatrix
(Vector3d vec1, Vector3d vec2) This methode returns a transformation matrix with a rotational component.
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
splitStringToArray2f
- Parameters:
value
-- Returns:
-
splitStringToArray2f
- Parameters:
value
- String valuedefault1
-default2
-- Returns:
-
splitStringToArray3d
- Parameters:
value
-- Returns:
-
splitStringToArray3f
- Parameters:
value
-- Returns:
-
splitStringToArray3d
public static double[] splitStringToArray3d(String value, double default1, double default2, double default3) - Parameters:
value
- String valuedefault1
-default2
-default3
-- Returns:
-
splitStringToArray3f
public static float[] splitStringToArray3f(String value, float default1, float default2, float default3) - Parameters:
value
- String valuedefault1
-default2
-default3
-- Returns:
-
splitStringToTuple2f
- Parameters:
result
- Tuple2f resultvalue
- String value (must not be null!)- Returns:
-
convertStringToTuple3f
Split string and convert into groimp coordinates.- Parameters:
result
- Tuple3f resultvalue
- String value (must not be null!)- Returns:
-
splitStringToTuple3f
Split string without convert.- Parameters:
result
- Tuple3f resultvalue
- String value (must not be null!)- Returns:
-
convertStringToTuple3d
Split string and convert into groimp coordinates.- Parameters:
result
- Tuple3d resultvalue
- String value (must not be null!)- Returns:
-
splitStringToTuple3d
Split string without convert.- Parameters:
result
- Tuple3d resultvalue
- String value (must not be null!)- Returns:
-
splitStringToTuple4f
Split string without convert.- Parameters:
result
- Tuple4f resultvalue
- String value (must not be null!)- Returns:
-
convertStringToTuple4f
Split string and convert into groimp coordinates.- Parameters:
result
- Tuple4f resultvalue
- String value (must not be null!)- Returns:
-
convertStringToAxisAngle4d
Split string and convert into groimp coordinates.- Parameters:
result
- AxisAngle4d resultvalue
- String value (must not be null!)- Returns:
-
splitStringToAxisAngle4d
Split string without convert.- Parameters:
result
- AxisAngle4d resultvalue
- String value (must not be null!)- Returns:
-
splitStringToArrayOfInt
- Parameters:
value
- String with int valuesdef
- default values- Returns:
-
splitStringToArrayOfInt
- Parameters:
value
- String with int valuesdef
- default values- Returns:
-
splitStringToArrayOfFloat
- Parameters:
value
- String with float valuesdef
- default values- Returns:
-
splitStringToArrayOfFloat
- Parameters:
value
- String with float valuesdef
- default values- Returns:
-
splitStringToArrayOfDouble
- Parameters:
value
- String with double values- Returns:
-
splitStringToArrayOfDouble
- Parameters:
value
- String with double valuesdef
- default values- Returns:
-
splitStringToArrayOfString
Splits a string containing multiple strings to an array of strings. The original string can have one of the following forms:- '"bla" "ble"'
- '"bla","ble"'
- '"bla"'
- 'bla'
- "bla"
- Parameters:
value
- String with String valuesdef
- default values- Returns:
-
splitStringToArrayOfString
Splits a string containing multiple strings to an array of strings. The original string can have one of the following forms:- '"bla" "ble"'
- '"bla","ble"'
- '"bla"'
- 'bla'
- "bla"
- Parameters:
value
- String with String valuesdef
- default values- Returns:
-
splitStringToArray4d
Split String on Whitespaces and return values as double-Array- Parameters:
value
-- Returns:
-
splitStringToArray4f
Split String on Whitespaces and return values as double-Array- Parameters:
value
-- Returns:
-
splitStringToArray4d
public static double[] splitStringToArray4d(String value, double default1, double default2, double default3, double default4) Split String on Whitespaces and return values as double-Array- Parameters:
value
- String valuedefault1
-default2
-default3
-default4
-- Returns:
-
splitStringToArray4f
public static float[] splitStringToArray4f(String value, float default1, float default2, float default3, float default4) Split String on Whitespaces and return values as double-Array- Parameters:
value
- String valuedefault1
-default2
-default3
-default4
-- Returns:
-
getRealPath
Extract the path-part as a String from the URL.- Parameters:
URL
- url- Returns:
- String path without the filename
-
getRealPath
Extract the path-part as a String from the URL.- Parameters:
File
- file- Returns:
- String path without the filename
-
getRealPath
Extract the path-part as a String from the FileSource.- Returns:
- String path without the filename
-
vectorsToTransMatrix
This methode returns a transformation matrix with a rotational component. The rotation transforms the vec1 to vec2.- Parameters:
vec1
-vec2
-- Returns:
-
findOrthogonalVector
Returns an orthogonal vector to given vector. This is undefined in any direction and not normalized.- Parameters:
vec1
-- Returns:
-
pointsOnLine
Checks if given points are on a straight line.- Parameters:
vectors
-- Returns:
-
splitStringToListOfStrings
-
intToRGB
-
intToGray
public static float intToGray(int color) -
getImageForURL
-
getImageForURL
-
colorToInt
Converts a Tuple4f color object (range from 0-1) to an int color.- Parameters:
color
-- Returns:
-
colorToInt
Converts a Tuple3f color object (range from 0-1) to an int color.- Parameters:
color
-- Returns:
-
overlapPixel
public static int overlapPixel(int background, int foreground) Calculates to an background pixel a new foreground pixel in consideration of transparency of foreground pixel.- Parameters:
background
-foreground
-- Returns:
-
round
public static int round(double value) Rounds the value with the Math.round() function and casts the result to int.- Parameters:
value
-- Returns:
-