oliverbooth / X10D

Extension methods on crack.
https://oliverbooth.github.io/X10D/
MIT License
28 stars 2 forks source link

[Request]: IsPointOnLine #64

Closed oliverbooth closed 2 years ago

oliverbooth commented 2 years ago

Type to extend

System.Drawing.Point, System.Numerics.Vector2, UnityEngine.Vector2

Signature

bool IsPointOnLine(LineF line);
bool IsPointOnLine(Vector2 start, Vector2 end);
bool IsPointOnLine(Point start, Point end);
bool IsPointOnLine(PointF start, PointF end);

Summary

Determines if the current point lies on a specified line.

Parameters

Parameter Type Description
line LineF The line on which the point should exist.

Benefits

No built-in methods support this.

Drawbacks

No response

Implementation Example

return (y2 - y1) * (x3 - x2)  == (y3 - y2) * (x2 - x1);

Code of Conduct

oliverbooth commented 2 years ago

Added with 02cc897426b803d5af1441d96a8b12e1bef838c9