GeometryUtils

Collection of methods useful for positioning in the world.

Author

Aton

Functions

Link copied to clipboard
fun cosDeg(alpha: Double): Double
fun cosDeg(alpha: Float): Double
Link copied to clipboard
fun distanceBetweenLines(pointA0: Vec3, pointB0: Vec3, pointA1: Vec3, pointB1: Vec3): Double

Returns the distance between two lines in 3D space. The lines are passes as two points for each line.

Link copied to clipboard
fun getDirection(vec0: Vec3, vec1: Vec3): DoubleArray

Returns array(distance, yaw, pitch) in minecraft coordinate system to get from vec0 to vec1.

fun EntityPlayerSP.getDirection(entity: Entity, offset: Double): DoubleArray

Returns array(distance, yaw, pitch) in minecraft coordinate system to get from the Player to the given entity at the same height. offset can be used to offset the target height.

fun EntityPlayerSP.getDirection(vec: Vec3, offset: Double): DoubleArray

Returns array(distance, yaw, pitch) in minecraft coordinate system to get from the Player feet to the given vec. offset can be used to offset the target height.

fun getDirection(X0: Double, Y0: Double, Z0: Double, X1: Double, Y1: Double, Z1: Double): DoubleArray

Returns array(distance, yaw, pitch) in minecraft coordinate system to get from x0y0z0 to x1y1z1.

Link copied to clipboard
fun pitch(): Float
Link copied to clipboard
fun Vec3.rotateYawTo(yaw: Float): Vec3

Rotates the vector to the given Yaw and returns the result.

Link copied to clipboard
fun Vec3.scale(factor: Double): Vec3

Scales the vector by the given factor and returns the result.

Link copied to clipboard
fun Vec3.scaleHorizontal(factor: Double): Vec3

Scales the horizontal part (x and z) of the vector by the given factor and returns the result.

Link copied to clipboard
fun Vec3.scaleVertical(factor: Double): Vec3

Scales the vertical part (y) of the vector by the given factor and returns the result.

Link copied to clipboard
fun sinDeg(alpha: Double): Double
fun sinDeg(alpha: Float): Double
Link copied to clipboard
fun yaw(): Float