Ejemplo n.º 1
0
        public BoundsF ToBounds()
        {
            BoundsF result = new BoundsF(Point1);

            result.Add(Point2);
            result.Expand(Radius);
            return(result);
        }
Ejemplo n.º 2
0
        public bool Contains(Vector3F point)
        {
            if (Point1 != Point2)
            {
                float radiusSquared = Radius * Radius;

                if ((Point1 - point).LengthSquared() <= radiusSquared)
                {
                    return(true);
                }
                if ((Point2 - point).LengthSquared() <= radiusSquared)
                {
                    return(true);
                }

                Vector3F projectPoint;
                MathAlgorithms.ProjectPointToLine(ref Point1, ref Point2, ref point, out projectPoint);

                BoundsF pointsBounds = new BoundsF(Point1);
                pointsBounds.Add(Point2);

                if (pointsBounds.Contains(projectPoint))
                {
                    if ((projectPoint - point).LengthSquared() <= radiusSquared)
                    {
                        return(true);
                    }
                }

                return(false);
            }
            else
            {
                return(new SphereF(Point1, Radius).Contains(point));
            }
        }
Ejemplo n.º 3
0
 public void ToBounds(out BoundsF result)
 {
     result = new BoundsF(Point1);
     result.Add(Point2);
     result.Expand(Radius);
 }