-
Notifications
You must be signed in to change notification settings - Fork 2
OTPModuleRotation
OTP Module Rotation
public struct OTPModuleRotation: OTPModule, Equatable
Implements an OTP Standard Module of the Rotation type and handles creation and parsing.
This data structure contains the current rotation of the Point using intrinsic Euler rotation calculated in the x-convention (the Tait-Bryan ZYX convention). Rotation is provided in millionths of a decimal degree i.e. 45,000,000 = 45° and shall be in the range 0-359999999 (0°-359.999999°).
Example usage:
// initialize a module at x = 45°, y = 0°, z = 45°
let module = OTPModuleRotation(x: 45000000, y: 0, z: 45000000)
Equatable
, OTPModule
Initializes this OTPModule
with default values.
public init()
Initializes an OTP Module Rotation.
public init(x: UInt32, y: UInt32, z: UInt32)
If values outside of the permitted range are used (0-359,999,999), the remainder will be initialized, for example when initialized as 450,000,000 (450°), the resulting initialized value will be 90,000,000 (90°).
- x: The X rotation in millionths of a decimal degree i.e. 45,000,000 = 45°.
- y: The Y rotation in millionths of a decimal degree i.e. 45,000,000 = 45°.
- z: The Z rotation in millionths of a decimal degree i.e. 45,000,000 = 45°.
Uniquely identifies the module using an OTPModuleIdentifier
.
public static let identifier: OTPModuleIdentifier
The size of the module's data in bytes.
public static let dataLength: OTPPDULength = 12
The total size of the module in bytes, including identifiers and length.
public static let moduleLength: OTPPDULength = dataLength + OTPPDULength(ModuleLayer.Offset.data.rawValue)
The minimum permitted value for all variables in this module.
public static let minPermitted: UInt32 = 0
The maximum permitted value for all variables in this module.
public static let maxPermitted: UInt32 = 359999999
The X rotation in millionths of a decimal degree i.e. 45,000,000 = 45°.
public var x: UInt32 = 0
The Y rotation in millionths of a decimal degree i.e. 45,000,000 = 45°.
public var y: UInt32 = 0
The Z rotation in millionths of a decimal degree i.e. 45,000,000 = 45°.
public var z: UInt32 = 0
A human-readable log description of this module.
public var logDescription: String
Creates a Module as Data.
public func createAsData() -> Data
The OTPModule
as a Data
object.
Attempts to create an OTPModuleRotation
from the data.
public static func parse(fromData data: Data) throws -> (module: Self, length: OTPPDULength)
- data: The data to be parsed.
An error of type ModuleLayerValidationError
.
A valid OTPModuleRotation
and the length of the PDU.
Merges an arrray of modules.
public static func merge(modules: [OTPModule]) -> (module: Self?, excludePoint: Bool)
- modules: The
OTPModule
s to be merged.
An optional OTPModule
of this type, and whether to exclude the OTPPoint
due to a mismatch.
Calculates whether this module is considered equal to another one.
public func isEqualToModule(_ module: OTPModule) -> Bool
- module: The
OTPModule
to be compared against.
Whether these OTPModule
s are considered equal.
Calculates a valid value for this fields in this module from the string provided.
public static func validValue(from string: String) -> UInt32
- string: The string to be evaluated.
A valid value for storing in this module.
Generated at 2021-09-01T18:46:51+0000 using swift-doc 1.0.0-rc.1.
Types
- ComponentSocketError
- OTPAddress
- OTPComponentState
- OTPConsumer
- OTPConsumerStatus
- OTPIPMode
- OTPModuleIdentifier
- OTPModulePosition
- OTPModulePosition.Scaling
- OTPModulePositionVelAccel
- OTPModuleReferenceFrame
- OTPModuleRotation
- OTPModuleRotationVelAccel
- OTPModuleScale
- OTPPoint
- OTPPointValidationError
- OTPProducer
- OTPProducerStatus