Use Line distancTo function

This commit is contained in:
Erik Schouten 2022-07-15 18:57:10 +02:00
parent cdb116fa20
commit ada1141738

View File

@ -1,5 +1,6 @@
package space.kscience.kmath.trajectory.segments package space.kscience.kmath.trajectory.segments
import space.kscience.kmath.geometry.Euclidean2DSpace.distanceTo
import space.kscience.kmath.geometry.Line2D import space.kscience.kmath.geometry.Line2D
import space.kscience.kmath.operations.DoubleField.pow import space.kscience.kmath.operations.DoubleField.pow
import kotlin.math.PI import kotlin.math.PI
@ -17,7 +18,7 @@ internal val Line2D.theta: Double
get() = atan2(direction.x - base.x, direction.y - base.y).theta get() = atan2(direction.x - base.x, direction.y - base.y).theta
internal val Line2D.length: Double internal val Line2D.length: Double
get() = sqrt((direction.x - base.x).pow(2) + (direction.y - base.y).pow(2)) get() = base.distanceTo(direction)
internal val Double.theta: Double internal val Double.theta: Double
get() = (this + (2 * PI)) % (2 * PI) get() = (this + (2 * PI)) % (2 * PI)