Class CoordinateSpaceExtensions
Extension methods for converting Unity vectors, quaternions, and ROS message types between coordinate spaces.
Inherited Members
Namespace: Unity.SimulationPro.Foundation
Assembly: Unity.SimulationPro.Foundation.dll
Syntax
public static class CoordinateSpaceExtensions
Methods
As<C>(Point32Msg)
Interprets a Point32Msg as a Vector3<C> without converting from Unity space.
Declaration
public static Vector3<C> As<C>(this Point32Msg self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Point32Msg | self | The point32 message. |
Returns
| Type | Description |
|---|---|
| Vector3<C> | The vector with the message's raw components in space |
Type Parameters
| Name | Description |
|---|---|
| C | The coordinate space of the message's values. |
As<C>(PointMsg)
Interprets a PointMsg as a Vector3<C> without converting from Unity space.
Declaration
public static Vector3<C> As<C>(this PointMsg self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| PointMsg | self | The point message. |
Returns
| Type | Description |
|---|---|
| Vector3<C> | The vector with the message's raw components in space |
Type Parameters
| Name | Description |
|---|---|
| C | The coordinate space of the message's values. |
As<C>(QuaternionMsg)
Interprets a QuaternionMsg as a Quaternion<C> without converting from Unity space.
Declaration
public static Quaternion<C> As<C>(this QuaternionMsg self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| QuaternionMsg | self | The quaternion message. |
Returns
| Type | Description |
|---|---|
| Quaternion<C> | The quaternion with the message's raw components in space |
Type Parameters
| Name | Description |
|---|---|
| C | The coordinate space of the message's values. |
As<C>(Vector3Msg)
Interprets a Vector3Msg as a Vector3<C> without converting from Unity space.
Declaration
public static Vector3<C> As<C>(this Vector3Msg self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3Msg | self | The vector3 message. |
Returns
| Type | Description |
|---|---|
| Vector3<C> | The vector with the message's raw components in space |
Type Parameters
| Name | Description |
|---|---|
| C | The coordinate space of the message's values. |
From(Point32Msg, CoordinateSpaceSelection)
Converts a Point32Msg to Unity (RUF) using a runtime CoordinateSpaceSelection.
Declaration
public static Vector3 From(this Point32Msg self, CoordinateSpaceSelection selection)
Parameters
| Type | Name | Description |
|---|---|---|
| Point32Msg | self | The point32 message. |
| CoordinateSpaceSelection | selection | The coordinate space of the message's values. |
Returns
| Type | Description |
|---|---|
| Vector3 | The equivalent Unity (RUF) vector. |
From(PointMsg, CoordinateSpaceSelection)
Converts a PointMsg to Unity (RUF) using a runtime CoordinateSpaceSelection.
Declaration
public static Vector3 From(this PointMsg self, CoordinateSpaceSelection selection)
Parameters
| Type | Name | Description |
|---|---|---|
| PointMsg | self | The point message. |
| CoordinateSpaceSelection | selection | The coordinate space of the message's values. |
Returns
| Type | Description |
|---|---|
| Vector3 | The equivalent Unity (RUF) vector. |
From(QuaternionMsg, CoordinateSpaceSelection)
Converts a QuaternionMsg to Unity (RUF) using a runtime CoordinateSpaceSelection.
Declaration
public static Quaternion From(this QuaternionMsg self, CoordinateSpaceSelection selection)
Parameters
| Type | Name | Description |
|---|---|---|
| QuaternionMsg | self | The quaternion message. |
| CoordinateSpaceSelection | selection | The coordinate space of the message's values. |
Returns
| Type | Description |
|---|---|
| Quaternion | The equivalent Unity (RUF) quaternion. |
From(Vector3Msg, CoordinateSpaceSelection)
Converts a Vector3Msg to Unity (RUF) using a runtime CoordinateSpaceSelection.
Declaration
public static Vector3 From(this Vector3Msg self, CoordinateSpaceSelection selection)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3Msg | self | The vector3 message. |
| CoordinateSpaceSelection | selection | The coordinate space of the message's values. |
Returns
| Type | Description |
|---|---|
| Vector3 | The equivalent Unity (RUF) vector. |
From<C>(Point32Msg)
Converts a Point32Msg from coordinate space C to Unity (RUF).
Declaration
public static Vector3 From<C>(this Point32Msg self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Point32Msg | self | The point32 message. |
Returns
| Type | Description |
|---|---|
| Vector3 | The equivalent Unity (RUF) vector. |
Type Parameters
| Name | Description |
|---|---|
| C | The coordinate space of the message's values. |
From<C>(PointMsg)
Converts a PointMsg from coordinate space C to Unity (RUF).
Declaration
public static Vector3 From<C>(this PointMsg self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| PointMsg | self | The point message. |
Returns
| Type | Description |
|---|---|
| Vector3 | The equivalent Unity (RUF) vector. |
Type Parameters
| Name | Description |
|---|---|
| C | The coordinate space of the message's values. |
From<C>(QuaternionMsg)
Converts a QuaternionMsg from coordinate space C to Unity (RUF).
Declaration
public static Quaternion From<C>(this QuaternionMsg self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| QuaternionMsg | self | The quaternion message. |
Returns
| Type | Description |
|---|---|
| Quaternion | The equivalent Unity (RUF) quaternion. |
Type Parameters
| Name | Description |
|---|---|
| C | The coordinate space of the message's values. |
From<C>(Vector3Msg)
Converts a Vector3Msg from coordinate space C to Unity (RUF).
Declaration
public static Vector3 From<C>(this Vector3Msg self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3Msg | self | The vector3 message. |
Returns
| Type | Description |
|---|---|
| Vector3 | The equivalent Unity (RUF) vector. |
Type Parameters
| Name | Description |
|---|---|
| C | The coordinate space of the message's values. |
ToLocal<C>(Transform)
Converts a Transform's local position and rotation to a TransformMsg in coordinate space C.
Declaration
public static TransformMsg ToLocal<C>(this Transform transform) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform to convert. |
Returns
| Type | Description |
|---|---|
| TransformMsg | A |
Type Parameters
| Name | Description |
|---|---|
| C | The target coordinate space. |
To<C>(Quaternion)
Wraps a Unity (RUF) Quaternion as a Quaternion<C>, converting to space C.
Declaration
public static Quaternion<C> To<C>(this Quaternion self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | self | The Unity quaternion to convert. |
Returns
| Type | Description |
|---|---|
| Quaternion<C> | The quaternion expressed in coordinate space |
Type Parameters
| Name | Description |
|---|---|
| C | The target coordinate space. |
To<C>(Transform)
Converts a Transform's world position and rotation to a TransformMsg in coordinate space C.
Declaration
public static TransformMsg To<C>(this Transform transform) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform to convert. |
Returns
| Type | Description |
|---|---|
| TransformMsg | A |
Type Parameters
| Name | Description |
|---|---|
| C | The target coordinate space. |
To<C>(Vector3)
Wraps a Unity (RUF) Vector3 as a Vector3<C>, converting to space C.
Declaration
public static Vector3<C> To<C>(this Vector3 self) where C : ICoordinateSpace, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | self | The Unity vector to convert. |
Returns
| Type | Description |
|---|---|
| Vector3<C> | The vector expressed in coordinate space |
Type Parameters
| Name | Description |
|---|---|
| C | The target coordinate space. |