Skip to content

Commit

Permalink
Update Math.kt
Browse files Browse the repository at this point in the history
+ Add Vec3f to Vec3d conversion.
  • Loading branch information
EngineMachiner committed May 18, 2024
1 parent 7b3cf06 commit 446cb2f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/kotlin/com/enginemachiner/harmony/Math.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
package com.enginemachiner.harmony

import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.Vec3f
import kotlin.math.PI

/** Convert degree to radians. */
fun rad(angle: Double): Double { return angle % 360 * 2 * PI / 360 }

/** Convert a Vec3f into a Vec3d. */
fun vec3d(vec3f: Vec3f): Vec3d {

return Vec3d( vec3f.x.toDouble(), vec3f.y.toDouble(), vec3f.z.toDouble() )

}

0 comments on commit 446cb2f

Please sign in to comment.