Compare commits
No commits in common. "ba70af3a2445b5473abd87dff7a883a5facd9961" and "6a801f9999df5d29640802f74f6bff5c93ceff51" have entirely different histories.
ba70af3a24
...
6a801f9999
@ -1,4 +1,5 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
|
||||
import space.kscience.gradle.isInDevelopment
|
||||
import space.kscience.gradle.useApache2Licence
|
||||
import space.kscience.gradle.useSPCTeam
|
||||
|
||||
@ -44,7 +45,14 @@ ksciencePublish {
|
||||
useApache2Licence()
|
||||
useSPCTeam()
|
||||
}
|
||||
repository("spc","https://maven.sciprog.center/kscience")
|
||||
github(githubProject = "visionforge", githubOrg = "SciProgCentre")
|
||||
space(
|
||||
if (isInDevelopment) {
|
||||
"https://maven.pkg.jetbrains.space/spc/p/sci/dev"
|
||||
} else {
|
||||
"https://maven.pkg.jetbrains.space/spc/p/sci/maven"
|
||||
}
|
||||
)
|
||||
sonatype()
|
||||
}
|
||||
|
||||
|
@ -5,17 +5,12 @@ import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.parseAsName
|
||||
import space.kscience.dataforge.names.plus
|
||||
import space.kscience.dataforge.names.withIndex
|
||||
import space.kscience.kmath.complex.Quaternion
|
||||
import space.kscience.kmath.geometry.fromRotationMatrix
|
||||
import space.kscience.kmath.linear.VirtualMatrix
|
||||
import space.kscience.visionforge.MutableVisionContainer
|
||||
import space.kscience.visionforge.isEmpty
|
||||
import space.kscience.visionforge.set
|
||||
import space.kscience.visionforge.solid.*
|
||||
import space.kscience.visionforge.solid.SolidMaterial.Companion.MATERIAL_COLOR_KEY
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
import kotlin.math.*
|
||||
|
||||
private val volumesName = Name.EMPTY //"volumes".asName()
|
||||
|
||||
@ -33,10 +28,12 @@ private data class RootToSolidContext(
|
||||
val colorCache: MutableMap<Meta, String> = mutableMapOf(),
|
||||
)
|
||||
|
||||
// apply rotation from a matrix
|
||||
// converting to XYZ to Tait–Bryan angles according to https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix
|
||||
private fun Solid.rotate(rot: DoubleArray) {
|
||||
val matrix = VirtualMatrix(3, 3) { i, j -> rot[i * 3 + j] }
|
||||
quaternion = Quaternion.fromRotationMatrix(matrix)
|
||||
val xAngle = atan2(-rot[5], rot[8])
|
||||
val yAngle = atan2(rot[2], sqrt(1.0 - rot[2].pow(2)))
|
||||
val zAngle = atan2(-rot[1], rot[0])
|
||||
rotation = Float32Vector3D(xAngle, yAngle, zAngle)
|
||||
}
|
||||
|
||||
private fun Solid.translate(trans: DoubleArray) {
|
||||
|
@ -2,8 +2,6 @@ plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
}
|
||||
|
||||
group = "demo"
|
||||
|
||||
kscience {
|
||||
jvm()
|
||||
js {
|
||||
|
@ -1,19 +1,19 @@
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
id("space.kscience.gradle.js")
|
||||
}
|
||||
|
||||
kscience {
|
||||
kscience{
|
||||
useCoroutines()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
kotlin{
|
||||
explicitApi = null
|
||||
js {
|
||||
js{
|
||||
useCommonJs()
|
||||
browser {
|
||||
binaries.executable()
|
||||
commonWebpackConfig {
|
||||
cssSupport {
|
||||
cssSupport{
|
||||
enabled.set(false)
|
||||
}
|
||||
}
|
||||
@ -21,15 +21,11 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
kscience {
|
||||
|
||||
dependencies {
|
||||
implementation(projects.visionforge.visionforgeGdml)
|
||||
implementation(projects.visionforge.visionforgePlotly)
|
||||
implementation(projects.visionforge.visionforgeMarkdown)
|
||||
implementation(projects.visionforge.visionforgeThreejs)
|
||||
}
|
||||
jsMain {
|
||||
implementation(projects.ui.ring)
|
||||
}
|
||||
dependencies{
|
||||
implementation(projects.visionforge.visionforgeGdml)
|
||||
implementation(projects.visionforge.visionforgePlotly)
|
||||
implementation(projects.visionforge.visionforgeMarkdown)
|
||||
implementation(projects.visionforge.visionforgeThreejs)
|
||||
implementation(projects.ui.ring)
|
||||
}
|
@ -34,8 +34,8 @@ kscience {
|
||||
implementation("ch.qos.logback:logback-classic:1.2.11")
|
||||
}
|
||||
jsMain {
|
||||
implementation(projects.ui.ring)
|
||||
implementation(projects.visionforgeThreejs)
|
||||
implementation(project(":ui:ring"))
|
||||
implementation(project(":visionforge-threejs"))
|
||||
//implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,13 @@ import kotlin.math.sin
|
||||
|
||||
fun main() = serve {
|
||||
|
||||
// val azimuth = 60.degrees
|
||||
// val inclination = 15.degrees
|
||||
val azimuth = 60.degrees
|
||||
val inclination = 15.degrees
|
||||
|
||||
// val direction = with(QuaternionField) {
|
||||
// Quaternion.fromRotation(-azimuth, Euclidean3DSpace.zAxis) *
|
||||
// Quaternion.fromRotation(Angle.piDiv2 - inclination, Euclidean3DSpace.yAxis)
|
||||
// }
|
||||
val direction = with(QuaternionField) {
|
||||
Quaternion.fromRotation(-azimuth, Euclidean3DSpace.zAxis) *
|
||||
Quaternion.fromRotation(Angle.piDiv2 - inclination, Euclidean3DSpace.yAxis)
|
||||
}
|
||||
|
||||
//val direction2 = Quaternion.fromEuler(Angle.zero, Angle.piDiv2 - inclination, -azimuth, RotationOrder.ZYX)
|
||||
|
||||
@ -43,7 +43,7 @@ fun main() = serve {
|
||||
solidGroup("frame") {
|
||||
z = 60
|
||||
|
||||
solidGroup("antenna") {
|
||||
val antenna = solidGroup("antenna") {
|
||||
axes(200)
|
||||
tube(40, 10, 30)
|
||||
sphereLayer(100, 95, theta = PI / 6) {
|
||||
|
@ -6,8 +6,5 @@ kotlin.incremental.js.ir=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
|
||||
org.jetbrains.compose.experimental.jscanvas.enabled=true
|
||||
|
||||
toolsVersion=0.15.0-kotlin-1.9.20-Beta
|
||||
#kotlin.experimental.tryK2=true
|
||||
#kscience.wasm.disabled=true
|
||||
toolsVersion=0.14.9-kotlin-1.8.20
|
||||
org.jetbrains.compose.experimental.jscanvas.enabled=true
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -1,19 +1,15 @@
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
kotlin("js")
|
||||
id("space.kscience.gradle.js")
|
||||
}
|
||||
|
||||
val dataforgeVersion: String by rootProject.extra
|
||||
|
||||
kscience{
|
||||
js()
|
||||
jsMain{
|
||||
dependencies {
|
||||
api(project(":visionforge-solid"))
|
||||
api(project(":ui:react"))
|
||||
implementation(npm("file-saver", "2.0.2"))
|
||||
implementation(npm("bootstrap","4.6.0"))
|
||||
implementation(npm("jquery","3.5.1"))
|
||||
implementation(npm("popper.js","1.16.1"))
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
api(project(":visionforge-solid"))
|
||||
api(project(":ui:react"))
|
||||
implementation(npm("file-saver", "2.0.2"))
|
||||
implementation(npm("bootstrap","4.6.0"))
|
||||
implementation(npm("jquery","3.5.1"))
|
||||
implementation(npm("popper.js","1.16.1"))
|
||||
}
|
@ -8,7 +8,7 @@ import kotlinx.css.padding
|
||||
import kotlinx.css.properties.border
|
||||
import kotlinx.css.px
|
||||
import kotlinx.html.js.onClickFunction
|
||||
import org.w3c.dom.events.Event
|
||||
import kotlinx.html.org.w3c.dom.events.Event
|
||||
import org.w3c.files.Blob
|
||||
import org.w3c.files.BlobPropertyBag
|
||||
import react.FC
|
@ -1,16 +1,11 @@
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
id("space.kscience.gradle.js")
|
||||
}
|
||||
|
||||
kscience {
|
||||
js()
|
||||
jsMain {
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-styled")
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
|
||||
dependencies{
|
||||
api(project(":visionforge-solid"))
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-styled")
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
|
||||
// implementation(npm("react-select","4.3.0"))
|
||||
api(projects.visionforgeThreejs)
|
||||
}
|
||||
}
|
||||
implementation(project(":visionforge-threejs"))
|
||||
}
|
@ -3,7 +3,7 @@ package space.kscience.visionforge.react
|
||||
import kotlinx.css.Align
|
||||
import kotlinx.css.alignItems
|
||||
import kotlinx.html.js.onClickFunction
|
||||
import org.w3c.dom.events.Event
|
||||
import kotlinx.html.org.w3c.dom.events.Event
|
||||
import react.*
|
||||
import react.dom.a
|
||||
import react.dom.attrs
|
@ -1,10 +1,10 @@
|
||||
package space.kscience.visionforge.react
|
||||
|
||||
import kotlinx.html.js.onChangeFunction
|
||||
import kotlinx.html.org.w3c.dom.events.Event
|
||||
import org.w3c.dom.HTMLOptionElement
|
||||
import org.w3c.dom.HTMLSelectElement
|
||||
import org.w3c.dom.asList
|
||||
import org.w3c.dom.events.Event
|
||||
import react.FC
|
||||
import react.dom.attrs
|
||||
import react.dom.option
|
@ -10,16 +10,13 @@ import kotlinx.coroutines.launch
|
||||
import kotlinx.css.*
|
||||
import kotlinx.css.properties.TextDecoration
|
||||
import kotlinx.html.js.onClickFunction
|
||||
import org.w3c.dom.events.Event
|
||||
import kotlinx.html.org.w3c.dom.events.Event
|
||||
import react.*
|
||||
import react.dom.attrs
|
||||
import space.kscience.dataforge.meta.MutableMeta
|
||||
import space.kscience.dataforge.meta.ObservableMutableMeta
|
||||
import space.kscience.dataforge.meta.*
|
||||
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
|
||||
import space.kscience.dataforge.meta.descriptors.ValueRequirement
|
||||
import space.kscience.dataforge.meta.descriptors.get
|
||||
import space.kscience.dataforge.meta.get
|
||||
import space.kscience.dataforge.meta.remove
|
||||
import space.kscience.dataforge.names.*
|
||||
import space.kscience.visionforge.hidden
|
||||
import styled.css
|
||||
@ -151,7 +148,7 @@ private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) {
|
||||
css {
|
||||
//+TreeStyles.resizeableInput
|
||||
width = 160.px
|
||||
margin = Margin(1.px, 5.px)
|
||||
margin(1.px, 5.px)
|
||||
}
|
||||
ValueChooser {
|
||||
attrs {
|
||||
@ -170,7 +167,7 @@ private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) {
|
||||
css {
|
||||
width = 24.px
|
||||
alignSelf = Align.stretch
|
||||
margin = Margin(1.px, 5.px)
|
||||
margin(1.px, 5.px)
|
||||
backgroundColor = Color.white
|
||||
borderStyle = BorderStyle.solid
|
||||
borderRadius = 2.px
|
@ -4,9 +4,8 @@ import kotlinx.css.pct
|
||||
import kotlinx.css.width
|
||||
import kotlinx.html.InputType
|
||||
import kotlinx.html.js.onChangeFunction
|
||||
import kotlinx.html.js.onInputFunction
|
||||
import kotlinx.html.org.w3c.dom.events.Event
|
||||
import org.w3c.dom.HTMLInputElement
|
||||
import org.w3c.dom.events.Event
|
||||
import react.FC
|
||||
import react.dom.attrs
|
||||
import react.fc
|
||||
@ -59,8 +58,8 @@ public val RangeValueChooser: FC<ValueChooserProps> = fc("RangeValueChooser") {
|
||||
attrs {
|
||||
disabled = rangeDisabled
|
||||
value = innerValue?.toString() ?: ""
|
||||
// onChangeFunction = handleChange
|
||||
onInputFunction = handleChange
|
||||
onChangeFunction = handleChange
|
||||
consumer.onTagEvent(this, "input", handleChange)
|
||||
val minValue = props.descriptor?.attributes?.get("min").string
|
||||
minValue?.let {
|
||||
min = it
|
@ -52,10 +52,10 @@ public object TreeStyles : StyleSheet("treeStyles", true) {
|
||||
}
|
||||
|
||||
public val treeLabel:RuleSet by css {
|
||||
border = Border.none
|
||||
padding = Padding(left = 4.pt, right = 4.pt, top = 0.pt, bottom = 0.pt)
|
||||
border = "none"
|
||||
padding(left = 4.pt, right = 4.pt, top = 0.pt, bottom = 0.pt)
|
||||
textAlign = TextAlign.left
|
||||
flex = Flex(1.0)
|
||||
flex(1.0)
|
||||
}
|
||||
|
||||
public val treeLabelInactive: RuleSet by css {
|
@ -1,10 +1,13 @@
|
||||
package space.kscience.visionforge.react
|
||||
|
||||
import kotlinx.css.*
|
||||
import kotlinx.css.properties.TextDecoration
|
||||
import kotlinx.css.Color
|
||||
import kotlinx.css.Cursor
|
||||
import kotlinx.css.color
|
||||
import kotlinx.css.cursor
|
||||
import kotlinx.css.properties.TextDecorationLine
|
||||
import kotlinx.css.properties.textDecoration
|
||||
import kotlinx.html.js.onClickFunction
|
||||
import org.w3c.dom.events.Event
|
||||
import kotlinx.html.org.w3c.dom.events.Event
|
||||
import react.*
|
||||
import react.dom.attrs
|
||||
import space.kscience.dataforge.names.Name
|
||||
@ -34,7 +37,7 @@ private val TreeLabel = fc<ObjectTreeProps> { props ->
|
||||
color = Color("#069")
|
||||
cursor = Cursor.pointer
|
||||
hover {
|
||||
textDecoration = TextDecoration(setOf(TextDecorationLine.underline))
|
||||
textDecoration(TextDecorationLine.underline)
|
||||
}
|
||||
if (props.name == props.selected) {
|
||||
+TreeStyles.treeLabelSelected
|
@ -1,12 +1,15 @@
|
||||
package space.kscience.visionforge.react
|
||||
|
||||
import kotlinx.css.*
|
||||
import kotlinx.css.margin
|
||||
import kotlinx.css.pct
|
||||
import kotlinx.css.px
|
||||
import kotlinx.css.width
|
||||
import kotlinx.html.InputType
|
||||
import kotlinx.html.js.onChangeFunction
|
||||
import kotlinx.html.js.onKeyDownFunction
|
||||
import kotlinx.html.org.w3c.dom.events.Event
|
||||
import org.w3c.dom.HTMLInputElement
|
||||
import org.w3c.dom.HTMLSelectElement
|
||||
import org.w3c.dom.events.Event
|
||||
import react.FC
|
||||
import react.Props
|
||||
import react.dom.attrs
|
||||
@ -142,7 +145,7 @@ public val ColorValueChooser: FC<ValueChooserProps> = fc("ColorValueChooser") {
|
||||
styledInput(type = InputType.color) {
|
||||
css {
|
||||
width = 100.pct
|
||||
margin = Margin(0.px)
|
||||
margin(0.px)
|
||||
}
|
||||
attrs {
|
||||
this.value = props.value?.let { value ->
|
@ -1,11 +1,11 @@
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
id("space.kscience.gradle.js")
|
||||
}
|
||||
|
||||
val dataforgeVersion: String by rootProject.extra
|
||||
|
||||
kscience{
|
||||
js{
|
||||
kotlin{
|
||||
js(IR){
|
||||
useCommonJs()
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
@ -15,11 +15,12 @@ kscience{
|
||||
}
|
||||
}
|
||||
}
|
||||
jsMain{
|
||||
api(projects.ui.react)
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-ring-ui")
|
||||
}
|
||||
|
||||
implementation(npm("core-js","3.12.1"))
|
||||
implementation(npm("file-saver", "2.0.2"))
|
||||
}
|
||||
dependencies{
|
||||
api(project(":ui:react"))
|
||||
api("org.jetbrains.kotlin-wrappers:kotlin-ring-ui")
|
||||
|
||||
implementation(npm("core-js","3.12.1"))
|
||||
implementation(npm("file-saver", "2.0.2"))
|
||||
}
|
@ -8,7 +8,7 @@ import kotlinx.css.padding
|
||||
import kotlinx.css.properties.border
|
||||
import kotlinx.css.px
|
||||
import kotlinx.html.js.onClickFunction
|
||||
import org.w3c.dom.events.Event
|
||||
import kotlinx.html.org.w3c.dom.events.Event
|
||||
import org.w3c.files.Blob
|
||||
import org.w3c.files.BlobPropertyBag
|
||||
import react.FC
|
@ -9,7 +9,7 @@ kscience {
|
||||
}
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
api("space.kscience:gdml:0.5.0")
|
||||
api("space.kscience:gdml:0.4.0")
|
||||
}
|
||||
dependencies(jvmTest) {
|
||||
implementation(spclibs.logback.classic)
|
||||
|
@ -206,7 +206,7 @@ public var Solid.rotationZ: Number by float(Z_ROTATION_KEY, 0f)
|
||||
/**
|
||||
* Raw quaternion value defined in properties
|
||||
*/
|
||||
public var Solid.quaternionOrNull: Quaternion?
|
||||
public var Solid.quaternionValue: Quaternion?
|
||||
get() = properties.getValue(ROTATION_KEY)?.list?.let {
|
||||
require(it.size == 4) { "Quaternion must be a number array of 4 elements" }
|
||||
Quaternion(it[0].float, it[1].float, it[2].float, it[3].float)
|
||||
@ -229,14 +229,14 @@ public var Solid.quaternionOrNull: Quaternion?
|
||||
* Quaternion value including information from euler angles
|
||||
*/
|
||||
public var Solid.quaternion: Quaternion
|
||||
get() = quaternionOrNull ?: Quaternion.fromEuler(
|
||||
get() = quaternionValue ?: Quaternion.fromEuler(
|
||||
rotationX.radians,
|
||||
rotationY.radians,
|
||||
rotationZ.radians,
|
||||
rotationOrder
|
||||
)
|
||||
set(value) {
|
||||
quaternionOrNull = value
|
||||
quaternionValue = value
|
||||
}
|
||||
|
||||
public var Solid.scaleX: Number by float(X_SCALE_KEY, 1f)
|
||||
|
@ -25,8 +25,8 @@ public class TableVisionJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||
|
||||
override fun attach(context: Context) {
|
||||
super.attach(context)
|
||||
kotlinext.js.require<Any>("tabulator-tables/dist/css/tabulator.min.css")
|
||||
kotlinext.js.require<Any>("tabulator-tables/src/js/modules/ResizeColumns/ResizeColumns.js")
|
||||
kotlinext.js.require("tabulator-tables/dist/css/tabulator.min.css")
|
||||
kotlinext.js.require("tabulator-tables/src/js/modules/ResizeColumns/ResizeColumns.js")
|
||||
}
|
||||
|
||||
override fun rateVision(vision: Vision): Int = when (vision) {
|
||||
|
@ -1,23 +1,17 @@
|
||||
plugins {
|
||||
id("space.kscience.gradle.mpp")
|
||||
id("space.kscience.gradle.js")
|
||||
}
|
||||
|
||||
kotlin{
|
||||
explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Disabled
|
||||
}
|
||||
|
||||
kscience{
|
||||
js{
|
||||
binaries.library()
|
||||
}
|
||||
jsMain{
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
implementation(npm("three", "0.143.0"))
|
||||
implementation(npm("three-csg-ts", "3.1.10"))
|
||||
implementation(npm("three.meshline","1.4.0"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
api(projects.visionforgeSolid)
|
||||
implementation(npm("three", "0.143.0"))
|
||||
implementation(npm("three-csg-ts", "3.1.10"))
|
||||
implementation(npm("three.meshline","1.4.0"))
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public fun Object3D.updatePosition(vision: Vision) {
|
||||
if (vision is Solid) {
|
||||
position.set(vision.x, vision.y, vision.z)
|
||||
|
||||
val quaternion = vision.quaternionOrNull
|
||||
val quaternion = vision.quaternionValue
|
||||
|
||||
if (quaternion != null) {
|
||||
setRotationFromQuaternion(
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user