Skip to content

Commit 321373a

Browse files
committed
add angle3D
1 parent 5e6b456 commit 321373a

3 files changed

Lines changed: 95 additions & 95 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repositories {
1919
jcenter()
2020
}
2121
dependencies {
22-
compile 'org.mechdancer:linearalgebra:0.2.5-dev-3'
22+
implementation 'org.mechdancer:linearalgebra:${latest_version}'
2323
}
2424
```
2525

@@ -37,7 +37,7 @@ dependencies {
3737
<dependency>
3838
<groupId>org.mechdancer</groupId>
3939
<artifactId>linearalgebra</artifactId>
40-
<version>0.2.5-dev-3</version>
40+
<version>latest_version</version>
4141
<type>pom</type>
4242
</dependency>
4343
```

build.gradle.kts

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
44
kotlin("jvm") version "1.3.50" apply (true)
5-
// id("org.jetbrains.dokka") version "0.9.18"
6-
// id("com.jfrog.bintray") version "1.8.4"
7-
// `maven-publish`
5+
id("org.jetbrains.dokka") version "0.9.18"
6+
id("com.jfrog.bintray") version "1.8.4"
7+
`maven-publish`
88
`build-scan`
99
}
1010

@@ -33,96 +33,96 @@ tasks.withType<KotlinCompile> {
3333
}
3434
}
3535

36-
//tasks.dokka {
37-
// outputFormat = "javadoc"
38-
// outputDirectory = "$buildDir/javadoc"
39-
//}
36+
tasks.dokka {
37+
outputFormat = "javadoc"
38+
outputDirectory = "$buildDir/javadoc"
39+
}
4040

41-
//val doc = tasks.register<Jar>("javadocJar") {
42-
// group = JavaBasePlugin.DOCUMENTATION_GROUP
43-
// description = "Assembles Kotlin docs with Dokka"
44-
// archiveClassifier.set("javadoc")
45-
// from(tasks.dokka)
46-
//}
41+
val doc = tasks.register<Jar>("javadocJar") {
42+
group = JavaBasePlugin.DOCUMENTATION_GROUP
43+
description = "Assembles Kotlin docs with Dokka"
44+
archiveClassifier.set("javadoc")
45+
from(tasks.dokka)
46+
}
4747

4848
val sources = tasks.register<Jar>("sourcesJar") {
4949
group = JavaBasePlugin.BUILD_TASK_NAME
5050
description = "Creates sources jar"
5151
archiveClassifier.set("sources")
5252
from(sourceSets.main.get().allSource)
5353
}
54-
//
55-
//val fat = tasks.register<Jar>("fatJar") {
56-
// group = JavaBasePlugin.BUILD_TASK_NAME
57-
// description = "Packs binary output with dependencies"
58-
// archiveClassifier.set("all")
59-
// from(sourceSets.main.get().output)
60-
// from({
61-
// configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
62-
// })
63-
//}
64-
//
65-
//tasks.register("allJars") {
66-
// group = JavaBasePlugin.BUILD_TASK_NAME
67-
// description = "Assembles all jars in one task"
68-
// dependsOn(doc, sources, fat, tasks.jar)
69-
//}
70-
//
71-
//val rename = tasks.register("renamePomFile") {
72-
// dependsOn(tasks.publishToMavenLocal)
73-
// doLast {
74-
// val path = "${buildDir.absolutePath}/publications/maven/"
75-
// val old = File(path + "pom-default.xml")
76-
// val f = File("$path${project.name}-$version.pom")
77-
// old.renameTo(f)
78-
// }
79-
//}
80-
//
81-
//tasks.bintrayUpload.configure {
82-
// dependsOn(rename)
83-
//}
84-
//
85-
//bintray {
86-
// user = "berberman"
87-
// key = System.getenv("BintrayToken")
88-
// setConfigurations("archives")
89-
// val v = version.toString()
90-
// val url = "https://github.com/MechDancer/linearalgebra"
91-
// publish = true
92-
// pkg.apply {
93-
// name = project.name
94-
// desc = "linearalgebra kotlin utilities"
95-
// repo = "maven"
96-
// userOrg = "mechdancer"
97-
// githubRepo = "MechDancer/linearalgebra"
98-
// vcsUrl = "$url.git"
99-
// issueTrackerUrl = "$url/issues"
100-
// publicDownloadNumbers = true
101-
// setLicenses("WTFPL")
102-
// version.apply {
103-
// name = v
104-
// vcsTag = v
105-
// websiteUrl = "$url/releases/tag/$v"
106-
// }
107-
// }
108-
//}
109-
//
110-
//publishing {
111-
// repositories {
112-
// maven("$buildDir/repo")
113-
// }
114-
//
115-
// publications {
116-
// create<MavenPublication>("maven") {
117-
// from(components["java"])
118-
// }
119-
// }
120-
//}
121-
//
122-
//artifacts {
123-
// add("archives", tasks.jar)
124-
// add("archives", fat)
125-
// add("archives", sources)
126-
// add("archives", doc)
127-
// add("archives", File("${buildDir.absolutePath}/publications/maven/${project.name}-$version.pom"))
128-
//}
54+
55+
val fat = tasks.register<Jar>("fatJar") {
56+
group = JavaBasePlugin.BUILD_TASK_NAME
57+
description = "Packs binary output with dependencies"
58+
archiveClassifier.set("all")
59+
from(sourceSets.main.get().output)
60+
from({
61+
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
62+
})
63+
}
64+
65+
tasks.register("allJars") {
66+
group = JavaBasePlugin.BUILD_TASK_NAME
67+
description = "Assembles all jars in one task"
68+
dependsOn(doc, sources, fat, tasks.jar)
69+
}
70+
71+
val rename = tasks.register("renamePomFile") {
72+
dependsOn(tasks.publishToMavenLocal)
73+
doLast {
74+
val path = "${buildDir.absolutePath}/publications/maven/"
75+
val old = File(path + "pom-default.xml")
76+
val f = File("$path${project.name}-$version.pom")
77+
old.renameTo(f)
78+
}
79+
}
80+
81+
tasks.bintrayUpload.configure {
82+
dependsOn(rename)
83+
}
84+
85+
bintray {
86+
user = "berberman"
87+
key = System.getenv("BintrayToken")
88+
setConfigurations("archives")
89+
val v = version.toString()
90+
val url = "https://github.com/MechDancer/linearalgebra"
91+
publish = true
92+
pkg.apply {
93+
name = project.name
94+
desc = "linearalgebra kotlin utilities"
95+
repo = "maven"
96+
userOrg = "mechdancer"
97+
githubRepo = "MechDancer/linearalgebra"
98+
vcsUrl = "$url.git"
99+
issueTrackerUrl = "$url/issues"
100+
publicDownloadNumbers = true
101+
setLicenses("WTFPL")
102+
version.apply {
103+
name = v
104+
vcsTag = v
105+
websiteUrl = "$url/releases/tag/$v"
106+
}
107+
}
108+
}
109+
110+
publishing {
111+
repositories {
112+
maven("$buildDir/repo")
113+
}
114+
115+
publications {
116+
create<MavenPublication>("maven") {
117+
from(components["java"])
118+
}
119+
}
120+
}
121+
122+
artifacts {
123+
add("archives", tasks.jar)
124+
add("archives", fat)
125+
add("archives", sources)
126+
add("archives", doc)
127+
add("archives", File("${buildDir.absolutePath}/publications/maven/${project.name}-$version.pom"))
128+
}

src/main/kotlin/org/mechdancer/geometry/rotation3d/Angle3D.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,24 @@ sealed class Angle3D(val first: Angle, val second: Angle, val third: Angle, val
131131
firstAngle = .0 /* arbitrary */
132132
/* matrix.get(2, 1) == sin(firstAngle + thirdAngle) */
133133
/* matrix.get(1, 1) == cos(firstAngle + thirdAngle) */
134-
thirdAngle = (atan2(matrix.get(2, 1), matrix.get(1, 1)) - firstAngle)
134+
thirdAngle = (atan2(matrix[2, 1], matrix[1, 1]) - firstAngle)
135135
}
136136
doubleEquals(test, -1.0) -> {
137137
secondAngle = PI
138138
firstAngle = .0 /* arbitrary */
139139
/* matrix.get(1, 2) == -sin(firstAngle - thirdAngle) */
140140
/* matrix.get(1, 1) == cos(firstAngle - thirdAngle) */
141-
thirdAngle = (firstAngle - atan2(-matrix.get(1, 2), matrix.get(1, 1)))
141+
thirdAngle = (firstAngle - atan2(-matrix[1, 2], matrix[1, 1]))
142142
}
143143
else -> {
144144
/* matrix.get(0, 0) == cos(secondAngle) */
145-
secondAngle = (if (neg) acos(matrix.get(0, 0)) else -acos(matrix.get(0, 0)))
145+
secondAngle = (if (neg) acos(matrix[0, 0]) else -acos(matrix[0, 0]))
146146
/* matrix.get(0, 1) == sin(firstAngle) * sin(secondAngle) */
147147
/* matrix.get(0, 2) == cos(firstAngle) * sin(secondAngle) */
148-
firstAngle = atan2(matrix.get(0, 1) / sin(secondAngle), matrix.get(0, 2) / sin(secondAngle))
148+
firstAngle = atan2(matrix[0, 1] / sin(secondAngle), matrix[0, 2] / sin(secondAngle))
149149
/* matrix.get(1, 0) == sin(secondAngle) * sin(thirdAngle) */
150150
/* matrix.get(2, 0) == -(cos(thirdAngle) * sin(secondAngle)) */
151-
thirdAngle = atan2(matrix.get(1, 0) / sin(secondAngle), -matrix.get(2, 0) / sin(secondAngle))
151+
thirdAngle = atan2(matrix[1, 0] / sin(secondAngle), -matrix[2, 0] / sin(secondAngle))
152152
}
153153
}
154154
}

0 commit comments

Comments
 (0)