Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sakapon
Created August 31, 2020 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakapon/588f5d94c7bee663746a91dc63e3b171 to your computer and use it in GitHub Desktop.
Save sakapon/588f5d94c7bee663746a91dc63e3b171 to your computer and use it in GitHub Desktop.
OperatorsSample/VectorInit struct
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