diff --git a/README.md b/README.md index 1dc0aea..b3bda8f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ repositories { jcenter() } dependencies { - compile 'org.mechdancer:linearalgebra:0.2.5-dev-3' + implementation 'org.mechdancer:linearalgebra:${latest_version}' } ``` @@ -37,7 +37,7 @@ dependencies { org.mechdancer linearalgebra - 0.2.5-dev-3 + latest_version pom ``` diff --git a/build.gradle.kts b/build.gradle.kts index b1db42b..9448c64 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,9 +2,9 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { kotlin("jvm") version "1.3.50" apply (true) -// id("org.jetbrains.dokka") version "0.9.18" -// id("com.jfrog.bintray") version "1.8.4" -// `maven-publish` + id("org.jetbrains.dokka") version "0.9.18" + id("com.jfrog.bintray") version "1.8.4" + `maven-publish` `build-scan` } @@ -33,17 +33,17 @@ tasks.withType { } } -//tasks.dokka { -// outputFormat = "javadoc" -// outputDirectory = "$buildDir/javadoc" -//} +tasks.dokka { + outputFormat = "javadoc" + outputDirectory = "$buildDir/javadoc" +} -//val doc = tasks.register("javadocJar") { -// group = JavaBasePlugin.DOCUMENTATION_GROUP -// description = "Assembles Kotlin docs with Dokka" -// archiveClassifier.set("javadoc") -// from(tasks.dokka) -//} +val doc = tasks.register("javadocJar") { + group = JavaBasePlugin.DOCUMENTATION_GROUP + description = "Assembles Kotlin docs with Dokka" + archiveClassifier.set("javadoc") + from(tasks.dokka) +} val sources = tasks.register("sourcesJar") { group = JavaBasePlugin.BUILD_TASK_NAME @@ -51,78 +51,78 @@ val sources = tasks.register("sourcesJar") { archiveClassifier.set("sources") from(sourceSets.main.get().allSource) } -// -//val fat = tasks.register("fatJar") { -// group = JavaBasePlugin.BUILD_TASK_NAME -// description = "Packs binary output with dependencies" -// archiveClassifier.set("all") -// from(sourceSets.main.get().output) -// from({ -// configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) } -// }) -//} -// -//tasks.register("allJars") { -// group = JavaBasePlugin.BUILD_TASK_NAME -// description = "Assembles all jars in one task" -// dependsOn(doc, sources, fat, tasks.jar) -//} -// -//val rename = tasks.register("renamePomFile") { -// dependsOn(tasks.publishToMavenLocal) -// doLast { -// val path = "${buildDir.absolutePath}/publications/maven/" -// val old = File(path + "pom-default.xml") -// val f = File("$path${project.name}-$version.pom") -// old.renameTo(f) -// } -//} -// -//tasks.bintrayUpload.configure { -// dependsOn(rename) -//} -// -//bintray { -// user = "berberman" -// key = System.getenv("BintrayToken") -// setConfigurations("archives") -// val v = version.toString() -// val url = "https://github.com/MechDancer/linearalgebra" -// publish = true -// pkg.apply { -// name = project.name -// desc = "linearalgebra kotlin utilities" -// repo = "maven" -// userOrg = "mechdancer" -// githubRepo = "MechDancer/linearalgebra" -// vcsUrl = "$url.git" -// issueTrackerUrl = "$url/issues" -// publicDownloadNumbers = true -// setLicenses("WTFPL") -// version.apply { -// name = v -// vcsTag = v -// websiteUrl = "$url/releases/tag/$v" -// } -// } -//} -// -//publishing { -// repositories { -// maven("$buildDir/repo") -// } -// -// publications { -// create("maven") { -// from(components["java"]) -// } -// } -//} -// -//artifacts { -// add("archives", tasks.jar) -// add("archives", fat) -// add("archives", sources) -// add("archives", doc) -// add("archives", File("${buildDir.absolutePath}/publications/maven/${project.name}-$version.pom")) -//} + +val fat = tasks.register("fatJar") { + group = JavaBasePlugin.BUILD_TASK_NAME + description = "Packs binary output with dependencies" + archiveClassifier.set("all") + from(sourceSets.main.get().output) + from({ + configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) } + }) +} + +tasks.register("allJars") { + group = JavaBasePlugin.BUILD_TASK_NAME + description = "Assembles all jars in one task" + dependsOn(doc, sources, fat, tasks.jar) +} + +val rename = tasks.register("renamePomFile") { + dependsOn(tasks.publishToMavenLocal) + doLast { + val path = "${buildDir.absolutePath}/publications/maven/" + val old = File(path + "pom-default.xml") + val f = File("$path${project.name}-$version.pom") + old.renameTo(f) + } +} + +tasks.bintrayUpload.configure { + dependsOn(rename) +} + +bintray { + user = "berberman" + key = System.getenv("BintrayToken") + setConfigurations("archives") + val v = version.toString() + val url = "https://github.com/MechDancer/linearalgebra" + publish = true + pkg.apply { + name = project.name + desc = "linearalgebra kotlin utilities" + repo = "maven" + userOrg = "mechdancer" + githubRepo = "MechDancer/linearalgebra" + vcsUrl = "$url.git" + issueTrackerUrl = "$url/issues" + publicDownloadNumbers = true + setLicenses("WTFPL") + version.apply { + name = v + vcsTag = v + websiteUrl = "$url/releases/tag/$v" + } + } +} + +publishing { + repositories { + maven("$buildDir/repo") + } + + publications { + create("maven") { + from(components["java"]) + } + } +} + +artifacts { + add("archives", tasks.jar) + add("archives", fat) + add("archives", sources) + add("archives", doc) + add("archives", File("${buildDir.absolutePath}/publications/maven/${project.name}-$version.pom")) +} diff --git a/src/main/kotlin/org/mechdancer/geometry/rotation3d/Angle3D.kt b/src/main/kotlin/org/mechdancer/geometry/rotation3d/Angle3D.kt index 390c54e..972b44f 100644 --- a/src/main/kotlin/org/mechdancer/geometry/rotation3d/Angle3D.kt +++ b/src/main/kotlin/org/mechdancer/geometry/rotation3d/Angle3D.kt @@ -131,24 +131,24 @@ sealed class Angle3D(val first: Angle, val second: Angle, val third: Angle, val firstAngle = .0 /* arbitrary */ /* matrix.get(2, 1) == sin(firstAngle + thirdAngle) */ /* matrix.get(1, 1) == cos(firstAngle + thirdAngle) */ - thirdAngle = (atan2(matrix.get(2, 1), matrix.get(1, 1)) - firstAngle) + thirdAngle = (atan2(matrix[2, 1], matrix[1, 1]) - firstAngle) } doubleEquals(test, -1.0) -> { secondAngle = PI firstAngle = .0 /* arbitrary */ /* matrix.get(1, 2) == -sin(firstAngle - thirdAngle) */ /* matrix.get(1, 1) == cos(firstAngle - thirdAngle) */ - thirdAngle = (firstAngle - atan2(-matrix.get(1, 2), matrix.get(1, 1))) + thirdAngle = (firstAngle - atan2(-matrix[1, 2], matrix[1, 1])) } else -> { /* matrix.get(0, 0) == cos(secondAngle) */ - secondAngle = (if (neg) acos(matrix.get(0, 0)) else -acos(matrix.get(0, 0))) + secondAngle = (if (neg) acos(matrix[0, 0]) else -acos(matrix[0, 0])) /* matrix.get(0, 1) == sin(firstAngle) * sin(secondAngle) */ /* matrix.get(0, 2) == cos(firstAngle) * sin(secondAngle) */ - firstAngle = atan2(matrix.get(0, 1) / sin(secondAngle), matrix.get(0, 2) / sin(secondAngle)) + firstAngle = atan2(matrix[0, 1] / sin(secondAngle), matrix[0, 2] / sin(secondAngle)) /* matrix.get(1, 0) == sin(secondAngle) * sin(thirdAngle) */ /* matrix.get(2, 0) == -(cos(thirdAngle) * sin(secondAngle)) */ - thirdAngle = atan2(matrix.get(1, 0) / sin(secondAngle), -matrix.get(2, 0) / sin(secondAngle)) + thirdAngle = atan2(matrix[1, 0] / sin(secondAngle), -matrix[2, 0] / sin(secondAngle)) } } }