-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/kotlin/org/mechdancer/geometry/rotation3d/Builder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.mechdancer.geometry.rotation3d | ||
|
||
import org.mechdancer.algebra.core.Matrix | ||
import org.mechdancer.geometry.angle.Angle | ||
|
||
/** | ||
* 构造内旋 [Angle3D] | ||
*/ | ||
fun euler(first: Angle, second: Angle, third: Angle, axesOrder: AxesOrder = AxesOrder.ZYZ) = | ||
Angle3D(first, second, third, axesOrder.reverse()) | ||
|
||
/** | ||
* 构造外旋 [Angle3D] | ||
*/ | ||
fun rollPitchYaw(first: Angle, second: Angle, third: Angle, axesOrder: AxesOrder = AxesOrder.XYZ) = | ||
Angle3D(first, second, third, axesOrder) | ||
|
||
/** | ||
* 从矩阵反解旋转角度 | ||
* | ||
* 请见 [Angle3D.fromMatrix] | ||
*/ | ||
fun Matrix.toRollPitchYaw(axesOrder: AxesOrder) = | ||
Angle3D.fromMatrix(this, axesOrder) | ||
|
||
/** | ||
* 从矩阵反解旋转角度 | ||
* | ||
* 请见 [Angle3D.fromMatrix] | ||
*/ | ||
fun Matrix.toEuler(axesOrder: AxesOrder) = | ||
Angle3D.fromMatrix(this, axesOrder.reverse()) | ||
|