Dot Product#
Math / Geometry / Dot Product Quaternion
Can Read
Cannot Write
Description#
Returns the dot product between two rotations
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Dot Product")]
[Category("Math/Geometry/Dot Product", "Quaternion")]
[Description("Returns the dot product between two rotations")]
[Image(typeof(IconMultiplyCircle), ColorTheme.Type.Yellow)]
[Keywords("Rotation")]
[Serializable]
public class TypeNumberMathQuaternionDot : TypeNumber
{
[SerializeField] private GetQuaternion m_Rotation1 = new GetQuaternion();
[SerializeField] private GetQuaternion m_Rotation2 = new GetQuaternion();
public override double GetPreview(GameObject source) =>
Quaternion.Dot(
this.m_Rotation1.GetPreview(source),
this.m_Rotation2.GetPreview(source)
);
public override double Get(Args args)
{
return Quaternion.Dot(
this.m_Rotation1.Get(args),
this.m_Rotation2.Get(args)
);
}
public override string ToString()
{
return $"Dot({this.m_Rotation1}, {this.m_Rotation2})";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}