Files
better-genshin-impact/BetterGenshinImpact/Helpers/Extensions/PointExtension.cs
2024-08-14 18:01:02 +08:00

15 lines
457 B
C#

using OpenCvSharp;
using System;
namespace BetterGenshinImpact.Helpers.Extensions;
public static class PointExtension
{
// Point2f is empty
public static bool IsEmpty(this Point2f point) => point is { X: 0, Y: 0 };
// build Rect from Point2f
public static Rect CenterToRect(this Point2f point, int width, int height) =>
new((int)Math.Round(point.X - width / 2f, 0), (int)Math.Round(point.Y - height / 2f, 0), width, height);
}