antenna example

This commit is contained in:
Alexander Nozik 2023-06-22 08:32:52 +03:00
parent 8611327cc4
commit 04b4a12946

View File

@ -1,16 +1,27 @@
package space.kscience.visionforge.examples
import space.kscience.kmath.complex.Quaternion
import space.kscience.kmath.geometry.RotationOrder
import space.kscience.kmath.complex.QuaternionField
import space.kscience.kmath.geometry.Angle
import space.kscience.kmath.geometry.Euclidean3DSpace
import space.kscience.kmath.geometry.degrees
import space.kscience.kmath.geometry.fromEuler
import space.kscience.kmath.geometry.fromRotation
import space.kscience.visionforge.html.ResourceLocation
import space.kscience.visionforge.solid.*
import kotlin.math.PI
fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
val direction = Quaternion.fromEuler( 45.degrees, 45.degrees, 0.degrees, RotationOrder.XYZ)
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 direction2 = Quaternion.fromEuler(Angle.zero, Angle.piDiv2 - inclination, -azimuth, RotationOrder.ZYX)
vision("canvas") {
requirePlugin(Solids)
@ -21,9 +32,6 @@ fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
ambientLight()
cylinder(50, 5, name = "base")
solidGroup("frame") {
rotationY = PI/2
rotationX = -PI/2
rotationZ = -PI/2
z = 60
axes(200)
solidGroup("antenna") {
@ -35,7 +43,7 @@ fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
cylinder(5, 30) {
z = 15
}
this.quaternion = direction
quaternion = direction
}
}
}