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를 라디안에서 도(degree)로 변환합니다.
toDegree(double radian)숫자를 라디안에서 도(degree)로 변환합니다
toDegree(double x, double y, double z)숫자를 라디안에서 도(degree)로 변환합니다
toDegree(float radian)숫자를 라디안에서 도(degree)로 변환합니다
toRadian(Vector3 degree)Vector3를 도(degree)에서 라디안으로 변환합니다
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를 라디안에서 도(degree)로 변환합니다.

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)

숫자를 라디안에서 도(degree)로 변환합니다

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)

숫자를 라디안에서 도(degree)로 변환합니다

Parameters:

매개변수형식설명
xdouble라디안 값의 x 구성 요소.
ydouble라디안 값의 y 구성 요소.
zdouble라디안 값의 z 구성 요소.

Returns: Vector3 - The degree value.

toDegree(float radian)

public static float toDegree(float radian)

숫자를 라디안에서 도(degree)로 변환합니다

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를 도(degree)에서 라디안으로 변환합니다

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