Created
August 31, 2020 01:30
-
-
Save sakapon/588f5d94c7bee663746a91dc63e3b171 to your computer and use it in GitHub Desktop.
OperatorsSample/VectorInit struct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace OperatorsLib.Structs | |
{ | |
public struct VectorInit | |
{ | |
public double X { get; } | |
public double Y { get; } | |
public double Norm { get; } | |
public double Angle { get; } | |
// ctor() と ctor(0, 0) の結果が同等になる必要があります。 | |
public VectorInit(double x, double y) | |
{ | |
(X, Y) = (x, y); | |
Norm = Math.Sqrt(X * X + Y * Y); | |
Angle = Math.Atan2(Y, X); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment