Add examples for SpiceTranslation (#3376)

This commit is contained in:
Alexander Bock
2024-08-16 13:45:40 +02:00
committed by GitHub
parent 7ec6b6cfb5
commit 9decd9aad2
3 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
-- Fixed Date
-- This asset creates a rotation provided by a SPICE kernel and applies it to a
-- SceneGraphNode that only displays coordinate axes. The rotation of the coordinate axes
-- are determined by SPICE, in this case pretending that the coordinate axes are rotating
-- at the same rate as Earth. In this specific example, the orientation is independent of
-- the actual in-game time in OpenSpace and only uses a fixed date of 2000 JAN 01 instead.
-- Load the default SPICE kernels, which is the planetary constants and the DE430 kernel
asset.require("spice/core")
local Node = {
Identifier = "SpiceRotation_Example_FixedDate",
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "IAU_EARTH",
DestinationFrame = "GALACTIC",
FixedDate = "2000 JAN 01 00:00:00.000"
}
},
Renderable = {
Type = "RenderableCartesianAxes"
},
GUI = {
Name = "SpiceRotation - Fixed Date",
Path = "/Examples"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(Node)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(Node)
end)

View File

@@ -0,0 +1,34 @@
-- Basic
-- This asset creates a rotation provided by a SPICE kernel and applies it to a
-- SceneGraphNode that only displays coordinate axes. The rotation of the coordinate axes
-- are determined by SPICE, in this case pretending that the coordinate axes are rotating
-- at the same rate as Earth.
-- Load the default SPICE kernels, which is the planetary constants and the DE430 kernel
asset.require("spice/core")
local Node = {
Identifier = "SpiceRotation_Example",
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "IAU_EARTH",
DestinationFrame = "GALACTIC"
}
},
Renderable = {
Type = "RenderableCartesianAxes"
},
GUI = {
Name = "SpiceRotation - Basic",
Path = "/Examples"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(Node)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(Node)
end)

View File

@@ -0,0 +1,41 @@
-- TimeFrame
-- This asset creates a rotation provided by a SPICE kernel and applies it to a
-- SceneGraphNode that only displays coordinate axes. The rotation of the coordinate axes
-- are determined by SPICE, in this case pretending that the coordinate axes are rotating
-- at the same rate as Earth. In this example, the rotation is only calculated between
-- 2000 JAN 01 and 2002 JAN 01 to exemplify a use-case in which the data from the SPICE
-- kernel is not available for the whole duration.
-- Load the default SPICE kernels, which is the planetary constants and the DE430 kernel
asset.require("spice/core")
local Node = {
Identifier = "SpiceRotation_Example_TimeFrame",
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "IAU_EARTH",
DestinationFrame = "GALACTIC",
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2000 JAN 01",
End = "2002 JAN 01"
}
}
},
Renderable = {
Type = "RenderableCartesianAxes"
},
GUI = {
Name = "SpiceRotation - TimeFrame",
Path = "/Examples"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(Node)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(Node)
end)