2021-02-24 13:42:55 +03:00
|
|
|
package hep.dataforge.vision.examples
|
|
|
|
|
|
|
|
import hep.dataforge.misc.DFExperimental
|
|
|
|
import hep.dataforge.vision.VisionForge
|
2021-02-24 18:26:15 +03:00
|
|
|
import hep.dataforge.vision.gdml.toVision
|
2021-02-24 13:42:55 +03:00
|
|
|
import hep.dataforge.vision.html.ResourceLocation
|
|
|
|
import hep.dataforge.vision.html.fragment
|
2021-02-26 13:03:40 +03:00
|
|
|
import hep.dataforge.vision.invoke
|
2021-02-27 21:40:58 +03:00
|
|
|
import hep.dataforge.vision.solid.Solids
|
2021-02-24 13:42:55 +03:00
|
|
|
import space.kscience.gdml.*
|
|
|
|
|
|
|
|
internal val cubes = Gdml {
|
|
|
|
val center = define.position("center")
|
|
|
|
structure {
|
2021-03-01 19:10:15 +03:00
|
|
|
val air = materials.composite("G4_AIR") {}
|
|
|
|
val tubeMaterial = materials.composite("tube") {}
|
|
|
|
val boxMaterial = materials.composite("box") {}
|
2021-02-24 13:42:55 +03:00
|
|
|
|
|
|
|
val segment = solids.tube("segment", 20, 5.0) {
|
|
|
|
rmin = 17
|
|
|
|
deltaphi = 60
|
|
|
|
aunit = AUnit.DEG.title
|
|
|
|
}
|
|
|
|
val worldBox = solids.box("largeBox", 200, 200, 200)
|
|
|
|
val smallBox = solids.box("smallBox", 30, 30, 30)
|
2021-03-01 19:10:15 +03:00
|
|
|
val segmentVolume = volume("segment", tubeMaterial, segment) {}
|
|
|
|
val circle = volume("composite", boxMaterial, smallBox) {
|
2021-02-24 13:42:55 +03:00
|
|
|
for (i in 0 until 6) {
|
|
|
|
physVolume(segmentVolume) {
|
2021-03-01 19:10:15 +03:00
|
|
|
positionref = center
|
2021-02-24 13:42:55 +03:00
|
|
|
rotation {
|
|
|
|
z = 60 * i
|
|
|
|
unit = AUnit.DEG.title
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-01 19:10:15 +03:00
|
|
|
world = volume("world", air, worldBox) {
|
2021-02-24 13:42:55 +03:00
|
|
|
for (i in 0 until 3) {
|
|
|
|
for (j in 0 until 3) {
|
|
|
|
for (k in 0 until 3) {
|
|
|
|
physVolume(circle) {
|
|
|
|
position {
|
|
|
|
x = (-50 + i * 50)
|
|
|
|
y = (-50 + j * 50)
|
|
|
|
z = (-50 + k * 50)
|
|
|
|
}
|
|
|
|
rotation {
|
|
|
|
x = i * 120
|
|
|
|
y = j * 120
|
|
|
|
z = 120 * k
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@DFExperimental
|
2021-02-27 21:40:58 +03:00
|
|
|
fun main() = VisionForge(Solids) {
|
2021-02-26 13:03:40 +03:00
|
|
|
val content = VisionForge.fragment {
|
2021-02-24 13:42:55 +03:00
|
|
|
vision("canvas") {
|
2021-02-24 18:26:15 +03:00
|
|
|
cubes.toVision()
|
2021-02-24 13:42:55 +03:00
|
|
|
}
|
|
|
|
}
|
2021-02-26 13:03:40 +03:00
|
|
|
makeVisionFile(content, resourceLocation = ResourceLocation.SYSTEM)
|
2021-02-24 13:42:55 +03:00
|
|
|
}
|