antenna example
This commit is contained in:
parent
8611327cc4
commit
04b4a12946
@ -1,16 +1,27 @@
|
|||||||
package space.kscience.visionforge.examples
|
package space.kscience.visionforge.examples
|
||||||
|
|
||||||
import space.kscience.kmath.complex.Quaternion
|
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.degrees
|
||||||
import space.kscience.kmath.geometry.fromEuler
|
import space.kscience.kmath.geometry.fromRotation
|
||||||
import space.kscience.visionforge.html.ResourceLocation
|
import space.kscience.visionforge.html.ResourceLocation
|
||||||
import space.kscience.visionforge.solid.*
|
import space.kscience.visionforge.solid.*
|
||||||
import kotlin.math.PI
|
import kotlin.math.PI
|
||||||
|
|
||||||
fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
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") {
|
vision("canvas") {
|
||||||
requirePlugin(Solids)
|
requirePlugin(Solids)
|
||||||
@ -21,9 +32,6 @@ fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
|||||||
ambientLight()
|
ambientLight()
|
||||||
cylinder(50, 5, name = "base")
|
cylinder(50, 5, name = "base")
|
||||||
solidGroup("frame") {
|
solidGroup("frame") {
|
||||||
rotationY = PI/2
|
|
||||||
rotationX = -PI/2
|
|
||||||
rotationZ = -PI/2
|
|
||||||
z = 60
|
z = 60
|
||||||
axes(200)
|
axes(200)
|
||||||
solidGroup("antenna") {
|
solidGroup("antenna") {
|
||||||
@ -35,7 +43,7 @@ fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
|
|||||||
cylinder(5, 30) {
|
cylinder(5, 30) {
|
||||||
z = 15
|
z = 15
|
||||||
}
|
}
|
||||||
this.quaternion = direction
|
quaternion = direction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user