manganese_serialization_kit v0.2.4 Manganese.SerializationKit.Structs.UnityQuaternion
A Unity quaternion value with :x
, :y
, :z
, and w
components.
Note that Unity structs are available in order to process the data in the API server, but most vector calculations occur in the environment simulation service.
This module can be used as an Ecto type for de/serialization when interacting with the database.
Link to this section Summary
Functions
Casts the given input to the custom type.
Dumps the given term into an Ecto native type.
Deserialize a quaternion from a map.
Deserialize a quaternion from a tuple.
A quaternion representing no rotation.
Loads the given term into a custom type.
Serialize a quaternion to a map.
Serialize a quaternion to a tuple.
The PostgreSQL composite type used to represent a quaternion.
Link to this section Types
A Unity quaternion.
t_external()
t_external() :: map()
t_external() :: map()
t_internal()
Link to this section Functions
cast(unity_quaternion)
Casts the given input to the custom type.
This callback is called on external input and can return any type,
as long as the dump/1
function is able to convert the returned
value into an Ecto native type. There are two situations where
this callback is called:
- When casting values by
Ecto.Changeset
- When passing arguments to
Ecto.Query
Callback implementation for Ecto.Type.cast/1
.
dump(unity_quaternion)
Dumps the given term into an Ecto native type.
This callback is called with any term that was stored in the struct and it needs to validate them and convert it to an Ecto native type.
Callback implementation for Ecto.Type.dump/1
.
from_map(map)
from_map(t_external()) :: t()
from_map(t_external()) :: t()
Deserialize a quaternion from a map.
from_tuple(arg)
from_tuple(t_internal()) :: t()
from_tuple(t_internal()) :: t()
Deserialize a quaternion from a tuple.
identity()
identity() :: t()
identity() :: t()
A quaternion representing no rotation.
load(tuple)
Loads the given term into a custom type.
This callback is called when loading data from the database and
receive an Ecto native type. It can return any type, as long as
the dump/1
function is able to convert the returned value back
into an Ecto native type.
Callback implementation for Ecto.Type.load/1
.
to_map(unity_quaternion)
to_map(t()) :: t_external()
to_map(t()) :: t_external()
Serialize a quaternion to a map.
to_tuple(unity_quaternion)
to_tuple(t()) :: t_internal()
to_tuple(t()) :: t_internal()
Serialize a quaternion to a tuple.
type()
type() :: :unity_quaternion
type() :: :unity_quaternion
The PostgreSQL composite type used to represent a quaternion.