Class BoundingBox2d

java.lang.Object
org.jzy3d.maths.BoundingBox2d

public class BoundingBox2d extends Object
A BoundingBox2d stores a couple of maximal and minimal limit on each dimension (x, y). It provides functions for enlarging the box by adding coordinates or an other BoundingBox2d (that is equivalent to computing the union of the current BoundingBox and another one).
Author:
Martin Pernollet
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected float
     
    protected float
     
    protected float
     
    protected float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialize a BoundingBox by calling its reset method.
    BoundingBox2d(double xmin, double xmax, double ymin, double ymax)
     
    BoundingBox2d(float xmin, float xmax, float ymin, float ymax)
    Initialize a BoundingBox with raw values.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(float x, float y)
    Adds an x,y point to the bounding box, and enlarge the bounding box if this points lies outside of it.
    void
    Add a BoundingBox2d volume to the current one.
    void
    Add a Point3d to the BoundingBox3d.
    boolean
    Return true if b2 is contained by this box.
    boolean
    Return true if coordinates is contained by this box.
    Compute and return the center point of the BoundingBox3d
    double
    Return the radius of the Sphere containing the Bounding Box, i.e., the distance between the center and the point (xmin, ymin, zmin).
     
     
    boolean
    Return true if intersect b2.
    void
    Initialize the bounding box with Float.MAX_VALUE as minimum value, and -Float.MAX_VALUE as maximum value for each dimension.
    scale(Coord2d scale)
    Return a copy of the current bounding box after scaling.
    shift(Coord2d offset)
     
     
    toString(int depth)
     
    float
    Return the maximum x value.
    float
    Return the minimum x value.
    float
     
    float
    Return the maximum y value.
    float
    Return the minimum y value.
    float
     

    Methods inherited from class java.lang.Object

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

    • xmin

      protected float xmin
    • xmax

      protected float xmax
    • ymin

      protected float ymin
    • ymax

      protected float ymax
  • Constructor Details

    • BoundingBox2d

      public BoundingBox2d()
      Initialize a BoundingBox by calling its reset method.
    • BoundingBox2d

      public BoundingBox2d(List<Coord2d> list)
    • BoundingBox2d

      public BoundingBox2d(float xmin, float xmax, float ymin, float ymax)
      Initialize a BoundingBox with raw values.
    • BoundingBox2d

      public BoundingBox2d(double xmin, double xmax, double ymin, double ymax)
  • Method Details

    • reset

      public void reset()
      Initialize the bounding box with Float.MAX_VALUE as minimum value, and -Float.MAX_VALUE as maximum value for each dimension.
    • add

      public void add(float x, float y)
      Adds an x,y point to the bounding box, and enlarge the bounding box if this points lies outside of it.
      Parameters:
      x -
      y -
    • add

      public void add(Coord2d p)
      Add a Point3d to the BoundingBox3d. A shortcut for: add(p.x, p.y);
      Parameters:
      p -
    • add

      public void add(BoundingBox2d b)
      Add a BoundingBox2d volume to the current one. A convenient shortcut for: add(b.xmin, b.ymin); add(b.xmax, b.ymax);
      Parameters:
      p -
    • getCenter

      public Coord2d getCenter()
      Compute and return the center point of the BoundingBox3d
      Returns:
      the center.
    • getRadius

      public double getRadius()
      Return the radius of the Sphere containing the Bounding Box, i.e., the distance between the center and the point (xmin, ymin, zmin).
      Returns:
      the box radius.
    • scale

      public BoundingBox2d scale(Coord2d scale)
      Return a copy of the current bounding box after scaling. Scaling does not modify the current bounding box.
      Returns:
      the scaled bounding box
    • shift

      public BoundingBox2d shift(Coord2d offset)
    • contains

      public boolean contains(BoundingBox2d b2)
      Return true if b2 is contained by this box. Note: if b1.contains(b2), then b1.intersect(b2) as well.
    • contains

      public boolean contains(Coord2d c)
      Return true if coordinates is contained by this box.
    • intersect

      public boolean intersect(BoundingBox2d b2)
      Return true if intersect b2.
    • xmin

      public float xmin()
      Return the minimum x value.
      Returns:
    • xmax

      public float xmax()
      Return the maximum x value.
      Returns:
    • xrange

      public float xrange()
    • yrange

      public float yrange()
    • ymin

      public float ymin()
      Return the minimum y value.
      Returns:
    • ymax

      public float ymax()
      Return the maximum y value.
      Returns:
    • getXRange

      public Range getXRange()
    • getYRange

      public Range getYRange()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(int depth)