public static bool Is2DPointOnBorder(Vector2 point, Vector2 quadCenter, float quadWidth, float quadHeight, Vector2 quadRight, Vector2 quadUp, QuadEpsilon epsilon = new QuadEpsilon()) { SegmentEpsilon segmentEps = new SegmentEpsilon(); segmentEps.PtOnSegmentEps = epsilon.WireEps; List <Vector2> corners = Calc2DQuadCornerPoints(quadCenter, new Vector2(quadWidth, quadHeight), quadRight, quadUp); for (int ptIndex = 0; ptIndex < corners.Count; ++ptIndex) { Vector2 startPt = corners[ptIndex]; Vector2 endPt = corners[(ptIndex + 1) % corners.Count]; if (SegmentMath.Is2DPointOnSegment(point, startPt, endPt, segmentEps)) { return(true); } } return(false); }
public override bool ContainsPoint(Vector2 point) { return(SegmentMath.Is2DPointOnSegment(point, _startPoint, _endPoint, _epsilon)); }
public override bool Raycast(Ray ray, out float t) { return(SegmentMath.Raycast(ray, out t, _startPoint, _endPoint, _epsilon)); }