Exemple #1
0
        public static bool Is2DPointOnBorder(Vector2 point, Vector2 quadCenter, float quadWidth, float quadHeight, Vector2 quadRight,
                                             Vector2 quadUp, QuadEpsilon epsilon = new QuadEpsilon())
        {
            var segmentEps = new SegmentEpsilon();

            segmentEps.PtOnSegmentEps = epsilon.WireEps;

            var 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));
 }