Use Line distancTo function
This commit is contained in:
parent
cdb116fa20
commit
ada1141738
@ -1,5 +1,6 @@
|
||||
package space.kscience.kmath.trajectory.segments
|
||||
|
||||
import space.kscience.kmath.geometry.Euclidean2DSpace.distanceTo
|
||||
import space.kscience.kmath.geometry.Line2D
|
||||
import space.kscience.kmath.operations.DoubleField.pow
|
||||
import kotlin.math.PI
|
||||
@ -17,7 +18,7 @@ internal val Line2D.theta: Double
|
||||
get() = atan2(direction.x - base.x, direction.y - base.y).theta
|
||||
|
||||
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
|
||||
get() = (this + (2 * PI)) % (2 * PI)
|
||||
|
Loading…
Reference in New Issue
Block a user