Arc-Tangent#
Math / Trigonometry / Arc-Tangent X, Y
Can Read
Cannot Write
Description#
Returns the angle in radians whose tangent is y / x
Note
The angle in radians whose tangent is the specified number
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Arc-Tangent")]
[Category("Math/Trigonometry/Arc-Tangent", "X, Y")]
[Description("Returns the angle in radians whose tangent is y / x")]
[Image(typeof(IconTan), ColorTheme.Type.Yellow, typeof(BadgeDot))]
[Note("The angle in radians whose tangent is the specified number")]
[Keywords("Atan", "Arc", "Tan", "Tangent")]
[Serializable]
public class TypeNumberMathAtan2 : TypeNumber
{
[SerializeField] private GetNumber m_X = new GetNumber();
[SerializeField] private GetNumber m_Y = new GetNumber();
public override double GetPreview(GameObject source) => Math.Atan2(this.m_X.GetPreview(source), this.m_Y.GetPreview(source));
public override double Get(Args args)
{
double x = this.m_X.Get(args);
double y = this.m_Y.Get(args);
return Math.Atan2(x, y);
}
public override string ToString()
{
return $"Atan({this.m_X}, {this.m_Y})";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}