Class EnclosingBall<S extends Space,P extends Point<S>>

java.lang.Object
org.apache.commons.math3.geometry.enclosing.EnclosingBall<S,P>
Type Parameters:
S - Space type.
P - Point type.
All Implemented Interfaces:
Serializable

public class EnclosingBall<S extends Space,P extends Point<S>> extends Object implements Serializable
This class represents a ball enclosing some points.
Since:
3.3
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final P
    Center of the ball.
    private final double
    Radius of the ball.
    private static final long
    Serializable UID.
    private final P[]
    Support points used to define the ball.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EnclosingBall(P center, double radius, P... support)
    Simple constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(P point)
    Check if a point is within the ball or at boundary.
    boolean
    contains(P point, double margin)
    Check if a point is within an enlarged ball or at boundary.
    Get the center of the ball.
    double
    Get the radius of the ball.
    P[]
    Get the support points used to define the ball.
    int
    Get the number of support points used to define the ball.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serializable UID.
      See Also:
    • center

      private final P extends Point<S> center
      Center of the ball.
    • radius

      private final double radius
      Radius of the ball.
    • support

      private final P extends Point<S>[] support
      Support points used to define the ball.
  • Constructor Details

    • EnclosingBall

      public EnclosingBall(P center, double radius, P... support)
      Simple constructor.
      Parameters:
      center - center of the ball
      radius - radius of the ball
      support - support points used to define the ball
  • Method Details

    • getCenter

      public P getCenter()
      Get the center of the ball.
      Returns:
      center of the ball
    • getRadius

      public double getRadius()
      Get the radius of the ball.
      Returns:
      radius of the ball (can be negative if the ball is empty)
    • getSupport

      public P[] getSupport()
      Get the support points used to define the ball.
      Returns:
      support points used to define the ball
    • getSupportSize

      public int getSupportSize()
      Get the number of support points used to define the ball.
      Returns:
      number of support points used to define the ball
    • contains

      public boolean contains(P point)
      Check if a point is within the ball or at boundary.
      Parameters:
      point - point to test
      Returns:
      true if the point is within the ball or at boundary
    • contains

      public boolean contains(P point, double margin)
      Check if a point is within an enlarged ball or at boundary.
      Parameters:
      point - point to test
      margin - margin to consider
      Returns:
      true if the point is within the ball enlarged by the margin or at boundary