Class ArcsSet

  • All Implemented Interfaces:
    Iterable<double[]>, Region<Sphere1D>

    public class ArcsSet
    extends AbstractRegion<Sphere1D,​Sphere1D>
    implements Iterable<double[]>
    This class represents a region of a circle: a set of arcs.

    Note that due to the wrapping around \(2 \pi\), barycenter is ill-defined here. It was defined only in order to fulfill the requirements of the Region interface, but its use is discouraged.

    • Constructor Detail

      • ArcsSet

        public ArcsSet​(double lower,
                       double upper,
                       double tolerance)
                throws MathIllegalArgumentException
        Build an arcs set corresponding to a single arc.

        If either lower is equals to upper or the interval exceeds \( 2 \pi \), the arc is considered to be the full circle and its initial defining boundaries will be forgotten. lower is not allowed to be greater than upper (an exception is thrown in this case).

        lower - lower bound of the arc
        upper - upper bound of the arc
        tolerance - tolerance below which close sub-arcs are merged together
        MathIllegalArgumentException - if lower is greater than upper or tolerance is smaller than Sphere1D.SMALLEST_TOLERANCE
      • ArcsSet

        public ArcsSet​(Collection<SubHyperplane<Sphere1D>> boundary,
                       double tolerance)
                throws ArcsSet.InconsistentStateAt2PiWrapping,
        Build an arcs set from a Boundary REPresentation (B-rep).

        The boundary is provided as a collection of sub-hyperplanes. Each sub-hyperplane has the interior part of the region on its minus side and the exterior on its plus side.

        The boundary elements can be in any order, and can form several non-connected sets (like for example polygons with holes or a set of disjoints polyhedrons considered as a whole). In fact, the elements do not even need to be connected together (their topological connections are not used here). However, if the boundary does not really separate an inside open from an outside open (open having here its topological meaning), then subsequent calls to the checkPoint method will not be meaningful anymore.

        If the boundary is empty, the region will represent the whole space.

        boundary - collection of boundary elements
        tolerance - tolerance below which close sub-arcs are merged together
        ArcsSet.InconsistentStateAt2PiWrapping - if the tree leaf nodes are not consistent across the \( 0, 2 \pi \) crossing
        MathIllegalArgumentException - if tolerance is smaller than Sphere1D.SMALLEST_TOLERANCE
    • Method Detail

      • buildNew

        public ArcsSet buildNew​(BSPTree<Sphere1D> tree)
        Build a region using the instance as a prototype.

        This method allow to create new instances without knowing exactly the type of the region. It is an application of the prototype design pattern.

        The leaf nodes of the BSP tree must have a Boolean attribute representing the inside status of the corresponding cell (true for inside cells, false for outside cells). In order to avoid building too many small objects, it is recommended to use the predefined constants Boolean.TRUE and Boolean.FALSE. The tree also must have either null internal nodes or internal nodes representing the boundary as specified in the getTree method).

        Specified by:
        buildNew in interface Region<Sphere1D>
        Specified by:
        buildNew in class AbstractRegion<Sphere1D,​Sphere1D>
        tree - inside/outside BSP tree representing the new region
        the built region
      • asList

        public List<Arc> asList()
        Build an ordered list of arcs representing the instance.

        This method builds this arcs set as an ordered list of Arc elements. An empty tree will build an empty list while a tree representing the whole circle will build a one element list with bounds set to \( 0 and 2 \pi \).

        a new ordered list containing Arc elements
      • iterator

        public Iterator<double[]> iterator()

        The iterator returns the limit angles pairs of sub-arcs in trigonometric order.

        The iterator does not support the optional remove operation.

        Specified by:
        iterator in interface Iterable<double[]>
      • split

        public ArcsSet.Split split​(Arc arc)
        Split the instance in two parts by an arc.
        arc - splitting arc
        an object containing both the part of the instance on the plus side of the arc and the part of the instance on the minus side of the arc