android 去除 orx 相关依赖
This commit is contained in:
@@ -121,6 +121,13 @@ data class Vector2D(val x: Double, val y: Double) : IsAlmostEquals<Vector2D> {
|
||||
fun distanceTo(x: Int, y: Int): Double = this.distanceTo(x.toDouble(), y.toDouble())
|
||||
fun distanceTo(that: Vector2D): Double = distanceTo(that.x, that.y)
|
||||
|
||||
/** Calculates the squared Euclidean distance to [other]. */
|
||||
fun squaredDistanceTo(other: Vector2D): Double {
|
||||
val dx = other.x - x
|
||||
val dy = other.y - y
|
||||
return dx * dx + dy * dy
|
||||
}
|
||||
|
||||
infix fun cross(that: Vector2D): Double = crossProduct(this, that)
|
||||
infix fun dot(that: Vector2D): Double = ((this.x * that.x) + (this.y * that.y))
|
||||
|
||||
@@ -195,6 +202,8 @@ data class Vector2D(val x: Double, val y: Double) : IsAlmostEquals<Vector2D> {
|
||||
/** DOWN using screen coordinates as reference (0, +1) */
|
||||
val DOWN_SCREEN = Vector2D(0.0, +1.0)
|
||||
|
||||
val INFINITY = Vector2D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY)
|
||||
|
||||
|
||||
inline operator fun invoke(x: Number, y: Number): Vector2D = Vector2D(x.toDouble(), y.toDouble())
|
||||
//inline operator fun invoke(x: Float, y: Float): Vector2D = Vector2D(x.toDouble(), y.toDouble())
|
||||
|
||||
Reference in New Issue
Block a user