xeltica-studio / DotFeather

A closs-platform generic gameengine built on C#/.NET 6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vector.Dot

EbiseLutica opened this issue · comments

ドット積を実装する

public struct Vector
{
    public static float Dot(Vector v1, Vector v2) => v1.X * v1.Y + v2.X * v2.Y;
    public float Dot(Vector v) => Vector.Dot(this, v);
}

public struct VectorInt
{
    public static int Dot(VectorInt v1, VectorInt v2) => v1.X * v1.Y + v2.X * v2.Y;
    public int Dot(VectorInt v) => VectorInt.Dot(this, v);
}