MathUtils

Inheritance: java.lang.Object

public class MathUtils

便利な数学ユーティリティのセットです。

メソッド

メソッド説明
calcNormal(Vector3[] points)
clamp(double val, double min, double max)値を範囲 [min, max] にクランプします
equals(Object arg0)
findIntersection(Vector2 p0, Vector2 d0, Vector2 p1, Vector2 d1, Vector2[] results)
getClass()
hashCode()
notify()
notifyAll()
pointInsideTriangle(Vector2 p, Vector2 p0, Vector2 p1, Vector2 p2)点 p が三角形 (p0, p1, p2) の内部にあるか確認します
rayIntersect(Vector2 origin, Vector2 dir, Vector2 a, Vector2 b)光線 (origin, dir) が線分 (start, end) と交差するか確認します
toDegree(Vector3 radian)ラジアンから度へ Vector3 を変換します。
toDegree(double radian)ラジアンから度へ数値を変換します
toDegree(double x, double y, double z)ラジアンから度へ数値を変換します
toDegree(float radian)ラジアンから度へ数値を変換します
toRadian(Vector3 degree)度からラジアンへ Vector3 を変換します
toRadian(double degree)度からラジアンへ数値を変換する
toRadian(double x, double y, double z)度からラジアンへベクトルを変換する
toRadian(float degree)度からラジアンへ数値を変換する
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

calcNormal(Vector3[] points)

public static Vector3 calcNormal(Vector3[] points)

Parameters:

パラメーター説明
pointsVector3[]

Returns: Vector3

clamp(double val, double min, double max)

public static double clamp(double val, double min, double max)

値を範囲 [min, max] にクランプします

Parameters:

パラメーター説明
valdoubleクランプする値。
mindouble最小値。
maxdouble最大値。

Returns: double - [min, max] の間の値 Example:

double val = 195;
     //Clamp value to [0, 100]
     double clampedValue = MathUtils.clamp(val, 0, 100);
     //This will output 100
     System.out.printf("Value = %d", val);

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

パラメーター説明
arg0java.lang.Object

Returns: boolean

findIntersection(Vector2 p0, Vector2 d0, Vector2 p1, Vector2 d1, Vector2[] results)

public static int findIntersection(Vector2 p0, Vector2 d0, Vector2 p1, Vector2 d1, Vector2[] results)

Parameters:

パラメーター説明
p0Vector2
d0Vector2
p1Vector2
d1Vector2
resultsVector2[]

Returns: int

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

pointInsideTriangle(Vector2 p, Vector2 p0, Vector2 p1, Vector2 p2)

public static boolean pointInsideTriangle(Vector2 p, Vector2 p0, Vector2 p1, Vector2 p2)

点 p が三角形 (p0, p1, p2) の内部にあるか確認します

Parameters:

パラメーター説明
pVector2
p0Vector2
p1Vector2
p2Vector2

Returns: boolean

rayIntersect(Vector2 origin, Vector2 dir, Vector2 a, Vector2 b)

public static Vector2 rayIntersect(Vector2 origin, Vector2 dir, Vector2 a, Vector2 b)

光線 (origin, dir) が線分 (start, end) と交差するか確認します

Parameters:

パラメーター説明
originVector2
dirVector2
aVector2
bVector2

Returns: Vector2

toDegree(Vector3 radian)

public static Vector3 toDegree(Vector3 radian)

ラジアンから度へ Vector3 を変換します。

Parameters:

パラメーター説明
radianVector3ラジアンの値。

Returns: Vector3 - The degree value. Example:

Vector3 degrees = MathUtils.toDegree(new Vector3(0.34, 0.9, 0.2));
     System.out.printf("Degrees = %s", degrees);

toDegree(double radian)

public static double toDegree(double radian)

ラジアンから度へ数値を変換します

Parameters:

パラメーター説明
ラジアンdoubleラジアンの値。

Returns: double - 度の値。 Example:

var deg = MathUtils.toDegree(0.3);
     System.out.printf("Degrees = %s", deg);

toDegree(double x, double y, double z)

public static Vector3 toDegree(double x, double y, double z)

ラジアンから度へ数値を変換します

Parameters:

パラメーター説明
xdoubleラジアン値の x 成分。
ydoubleラジアン値の y 成分。
zdoubleラジアン値の z 成分。

Returns: Vector3 - The degree value.

toDegree(float radian)

public static float toDegree(float radian)

ラジアンから度へ数値を変換します

Parameters:

パラメーター説明
ラジアンfloatラジアンの値。

Returns: float - 度の値。 Example:

var deg = MathUtils.toDegree(0.3f);
     System.out.printf("Degrees = %s", deg);

toRadian(Vector3 degree)

public static Vector3 toRadian(Vector3 degree)

度からラジアンへ Vector3 を変換します

Parameters:

パラメーター説明
degreeVector3度の値。

Returns: Vector3 - The radian value. Example:

Vector3 radians = MathUtils.toRadian(new Vector3(90, 134, 0));
     System.out.printf("Radians = %s", radians);

toRadian(double degree)

public static double toRadian(double degree)

度からラジアンへ数値を変換する

Parameters:

パラメーター説明
double度の値。

Returns: double - ラジアンの値。 Example:

var rad = MathUtils.toRadian(0.3);
     System.out.printf("Radian = %d", rad);

toRadian(double x, double y, double z)

public static Vector3 toRadian(double x, double y, double z)

度からラジアンへベクトルを変換する

Parameters:

パラメーター説明
xdouble度値の x 成分。
ydouble度値の y 成分。
zdouble度値の z 成分。

Returns: Vector3 - The radian value.

toRadian(float degree)

public static float toRadian(float degree)

度からラジアンへ数値を変換する

Parameters:

パラメーター説明
float度の値。

Returns: float - ラジアンの値。 Example:

var rad = MathUtils.toRadian(0.3);
     System.out.printf("Radian = %d", rad);

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final void wait(long arg0)

Parameters:

パラメーター説明
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

パラメーター説明
arg0long
arg1int