DashboardItemAngle

Inherits DashboardItem

This DashboardItem shows the angle between the lines Source->Reference and Source->Destination. Each of Source, Reference, and Destination can be either the identifier of a node, the current focus node, or the position of the camera. The angle cannot be calculated if two of these three items are located in the same position, in which case an error message is printed. The SourceNodeName, ReferenceNodeName, and DestinationNodeName parameters are only used if the SourceType, ReferenceType, or DestinationType respectively is set to Node.

Members

Name

Documentation

Type

Description

Optional

DestinationType

The type of position that is used as the destination to calculate the angle. The computed angle is the incident angle to Source in the triangle (Source, Reference, Destination).

String

In list { Node, Focus, Camera }

No

ReferenceType

The type of position that is used as the destination of the reference line used to calculate the angle. The computed angle is the incident angle to Source in the triangle (Source, Reference, Destination).

String

In list { Node, Focus, Camera }

No

SourceType

The type of position that is used as the triangle apex used to calculate the angle.

String

In list { Node, Focus, Camera }

No

DestinationNodeIdentifier

If a scene graph node is selected as type, this value specifies the identifier of the node that is to be used as the destination for computing the angle.

String

Value of type ‘String’

Yes

FontName

This value is the name of the font that is used. It can either refer to an internal name registered previously, or it can refer to a path that is used.

String

Value of type ‘String’

Yes

FontSize

This value determines the size of the font that is used to render the distance.

Double

Value of type ‘Double’

Yes

ReferenceNodeIdentifier

If a scene graph node is selected as type, this value specifies the identifier of the node that is to be used as the reference direction to compute the angle.

String

Value of type ‘String’

Yes

SourceNodeIdentifier

If a scene graph node is selected as type, this value specifies the identifier of the node that is to be used as the apex of the triangle used to calculate the angle. The computed angle is the incident angle to Source in the triangle (Source, Reference, Destination).

String

Value of type ‘String’

Yes

Inherited members from DashboardItem

Name

Documentation

Type

Description

Optional

Identifier

The unique identifier for this DashboardItem.

Identifier

An identifier string. May not contain ‘.’, spaces, newlines, or tabs

No

Type

Determines the type of the DashbordItem that should be created.

String

Value of type ‘String’

No

Enabled

If this value is set to ‘true’ this dashboard item is shown in the dashboard. Otherwise it will be hidden.

Boolean

Value of type ‘Boolean’

Yes

GuiName

The name for the DashboardItem that is used when showing it in the user interface.

String

Value of type ‘String’

Yes

Asset Examples

Three nodes

This example adds three invisible scene graph nodes and then shows the angle between those three nodes.

 1local Node1 = {
 2  Identifier = "DashboardItemAngle_Example_ThreeNodes_Node1",
 3  GUI = {
 4    Name = "DashboardItemAngle - Three Nodes (Node 1)"
 5  }
 6}
 7
 8local Node2 = {
 9  Identifier = "DashboardItemAngle_Example_ThreeNodes_Node2",
10  Transform = {
11    Translation = {
12      Type = "StaticTranslation",
13      Position = { 2.0, 1.0, 0.0 }
14    }
15  },
16  GUI = {
17    Name = "DashboardItemAngle - Three Nodes (Node 2)"
18  }
19}
20
21local Node3 = {
22  Identifier = "DashboardItemAngle_Example_ThreeNodes_Node3",
23  Transform = {
24    Translation = {
25      Type = "StaticTranslation",
26      Position = { -2.0, 1.0, 0.0 }
27    }
28  },
29  GUI = {
30    Name = "DashboardItemAngle - Three Nodes (Node 3)"
31  }
32}
33
34local Item = {
35  Identifier = "DashboardItemAngle_Example_ThreeNodes",
36  Type = "DashboardItemAngle",
37  SourceType = "Node",
38  SourceNodeIdentifier = Node1.Identifier,
39  ReferenceType = "Node",
40  ReferenceNodeIdentifier = Node2.Identifier,
41  DestinationType = "Node",
42  DestinationNodeIdentifier = Node3.Identifier
43}
44
45asset.onInitialize(function()
46  openspace.addSceneGraphNode(Node1)
47  openspace.addSceneGraphNode(Node2)
48  openspace.addSceneGraphNode(Node3)
49  openspace.dashboard.addDashboardItem(Item)
50end)
51
52asset.onDeinitialize(function()
53  openspace.dashboard.removeDashboardItem(Item)
54  openspace.removeSceneGraphNode(Node3)
55  openspace.removeSceneGraphNode(Node2)
56  openspace.removeSceneGraphNode(Node1)
57end)
Two nodes and focus

This example adds two invisible scene graph nodes and then shows the angle between the current focus node and those two nodes.

 1local Node1 = {
 2  Identifier = "DashboardItemAngle_Example_TwoNodesFocus_Node1",
 3  GUI = {
 4    Name = "DashboardItemAngle - Two Nodes & Focus (Node 1)"
 5  }
 6}
 7
 8local Node2 = {
 9  Identifier = "DashboardItemAngle_Example_TwoNodesFocus_Node2",
10  Transform = {
11    Translation = {
12      Type = "StaticTranslation",
13      Position = { 20.0, 1.0, 0.0 }
14    }
15  },
16  GUI = {
17    Name = "DashboardItemAngle - Two Nodes & Focus (Node 2)"
18  }
19}
20
21local Item = {
22  Identifier = "DashboardItemAngle_Example_TwoNodesFocus",
23  Type = "DashboardItemAngle",
24  SourceType = "Focus",
25  ReferenceType = "Node",
26  ReferenceNodeIdentifier = Node1.Identifier,
27  DestinationType = "Node",
28  DestinationNodeIdentifier = Node2.Identifier
29}
30
31asset.onInitialize(function()
32  openspace.addSceneGraphNode(Node1)
33  openspace.addSceneGraphNode(Node2)
34  openspace.dashboard.addDashboardItem(Item)
35end)
36
37asset.onDeinitialize(function()
38  openspace.dashboard.removeDashboardItem(Item)
39  openspace.removeSceneGraphNode(Node2)
40  openspace.removeSceneGraphNode(Node1)
41end)
Two nodes and camera

This example adds two invisible scene graph nodes and then shows the angle between the camera and those two nodes.

 1local Node1 = {
 2  Identifier = "DashboardItemAngle_Example_TwoNodesCamera_Node1",
 3  GUI = {
 4    Name = "DashboardItemAngle - Two Nodes & Camera (Node 1)"
 5  }
 6}
 7
 8local Node2 = {
 9  Identifier = "DashboardItemAngle_Example_TwoNodesCamera_Node2",
10  Transform = {
11    Translation = {
12      Type = "StaticTranslation",
13      Position = { 20.0, 1.0, 0.0 }
14    }
15  },
16  GUI = {
17    Name = "DashboardItemAngle - Two Nodes & Camera (Node 2)"
18  }
19}
20
21local Item = {
22  Identifier = "DashboardItemAngle_Example_TwoNodesCamera",
23  Type = "DashboardItemAngle",
24  SourceType = "Camera",
25  ReferenceType = "Node",
26  ReferenceNodeIdentifier = Node1.Identifier,
27  DestinationType = "Node",
28  DestinationNodeIdentifier = Node2.Identifier
29}
30
31asset.onInitialize(function()
32  openspace.addSceneGraphNode(Node1)
33  openspace.addSceneGraphNode(Node2)
34  openspace.dashboard.addDashboardItem(Item)
35end)
36
37asset.onDeinitialize(function()
38  openspace.dashboard.removeDashboardItem(Item)
39  openspace.removeSceneGraphNode(Node2)
40  openspace.removeSceneGraphNode(Node1)
41end)