Interface Sphere3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>

  • Type Parameters:
    ST - is the type of the general implementation.
    IT - is the type of the implementation of this shape.
    IE - is the type of the path elements.
    P - is the type of the points.
    V - is the type of the vectors.
    B - is the type of the bounding boxes.
    All Superinterfaces:
    Cloneable, JsonableObject, Serializable, Shape3ai<ST,​IT,​IE,​P,​V,​B>, Shape3D<ST,​IT,​PathIterator3ai<IE>,​P,​V,​B>
    All Known Implementing Classes:
    Sphere3i, Sphere3ifx

    public interface Sphere3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
    extends Shape3ai<ST,​IT,​IE,​P,​V,​B>
    Fonctional interface that represented a 3D sphere.
    Since:
    13.0
    Version:
    17.0 2020-01-04 14:41:43
    Author:
    Stéphane GALLAND, Hamza JAFFALI
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    mathgeom
    • Method Detail

      • contains

        @Pure
        static boolean contains​(int cx,
                                int cy,
                                int cz,
                                int cr,
                                int x,
                                int y,
                                int z)
        Replies if the given point is inside the sphere.
        Parameters:
        cx - is the x-coordinate of the sphere center
        cy - is the y-coordinate of the sphere center
        cz - is the z-coordinate of the sphere center
        cr - is the radius of the sphere center
        x - is the x-coordinate of the point
        y - is the y-coordinate of the point
        z - is the z-coordinate of the point
        Returns:
        true if the point is inside the sphere.
      • contains

        @Pure
        static boolean contains​(int cx,
                                int cy,
                                int cz,
                                int cr,
                                int quadrant,
                                int x,
                                int y,
                                int z)
        Replies if the given point is inside the quadrant of the given sphere.
        Parameters:
        cx - is the x-coordinate of the sphere center
        cy - is the y-coordinate of the sphere center
        cz - is the z-coordinate of the sphere center
        cr - is the radius of the sphere center
        quadrant - is the quadrant:
        quadrantxy
        0≥cx≥cy
        1≥cx<cy
        2<cx≥cy
        3<cx<cy
        x - is the x-coordinate of the point
        y - is the y-coordinate of the point
        z - is the z-coordinate of the point
        Returns:
        true if the point is inside the sphere.
      • contains

        @Pure
        default boolean contains​(int x,
                                 int y,
                                 int z)
        Description copied from interface: Shape3ai
        Replies if the given point is inside this shape.
        Specified by:
        contains in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        x - x coordinate of the point to test.
        y - y coordinate of the point to test.
        z - z coordinate of the point to test.
        Returns:
        true if the given point is inside this shape, otherwise false.
      • computeClosestPointTo

        @Pure
        static void computeClosestPointTo​(int cx,
                                          int cy,
                                          int cz,
                                          int cr,
                                          int x,
                                          int y,
                                          int z,
                                          Point3D<?,​?> result)
        Replies the closest point in a sphere to a point.

        The closest point is the point on the perimeter or inside the sphere's disk that has the lowest Manhatan distance to the given origin point.

        Parameters:
        cx - is the center of the sphere
        cy - is the center of the sphere
        cz - is the center of the sphere
        cr - is the radius of the sphere
        x - is the point
        y - is the point
        z - is the point
        result - the closest point in the sphere to the point.
      • computeFarthestPointTo

        @Pure
        static void computeFarthestPointTo​(int cx,
                                           int cy,
                                           int cz,
                                           int cr,
                                           int x,
                                           int y,
                                           int z,
                                           Point3D<?,​?> result)
        Replies the farthest point in a sphere to a point.

        The farthest point is the point on the perimeter of the sphere that has the highest Manhatan distance to the given origin point.

        Parameters:
        cx - is the center of the sphere
        cy - is the center of the sphere
        cz - is the center of the sphere
        cr - is the radius of the sphere
        x - is the point
        y - is the point
        z - is the point
        result - the farthest point in the sphere to the point.
      • intersectsSphereSphere

        @Pure
        static boolean intersectsSphereSphere​(int x1,
                                              int y1,
                                              int z1,
                                              int radius1,
                                              int x2,
                                              int y2,
                                              int z2,
                                              int radius2)
        Replies if two spheres are intersecting.
        Parameters:
        x1 - is the center of the first sphere
        y1 - is the center of the first sphere
        z1 - is the center of the first sphere
        radius1 - is the radius of the first sphere
        x2 - is the center of the second sphere
        y2 - is the center of the second sphere
        z2 - is the center of the second sphere
        radius2 - is the radius of the second sphere
        Returns:
        true if the two shapes are intersecting; otherwise false
      • intersectsSphereRectangularPrism

        @Pure
        static boolean intersectsSphereRectangularPrism​(int x1,
                                                        int y1,
                                                        int z1,
                                                        int radius,
                                                        int x2,
                                                        int y2,
                                                        int z2,
                                                        int x3,
                                                        int y3,
                                                        int z3)
        Replies if a sphere and a rectangle are intersecting.
        Parameters:
        x1 - is the center of the sphere
        y1 - is the center of the sphere
        z1 - is the center of the sphere
        radius - is the radius of the sphere
        x2 - is the first corner of the rectangle.
        y2 - is the first corner of the rectangle.
        z2 - is the first corner of the rectangle.
        x3 - is the second corner of the rectangle.
        y3 - is the second corner of the rectangle.
        z3 - is the second corner of the rectangle.
        Returns:
        true if the two shapes are intersecting; otherwise false
      • intersectsSphereSegment

        static boolean intersectsSphereSegment​(int x1,
                                               int y1,
                                               int z1,
                                               int radius,
                                               int x2,
                                               int y2,
                                               int z2,
                                               int x3,
                                               int y3,
                                               int z3)
        Replies if a sphere and a segment are intersecting.
        Parameters:
        x1 - is the center of the sphere
        y1 - is the center of the sphere
        z1 - is the center of the sphere
        radius - is the radius of the sphere
        x2 - is the first point of the segment.
        y2 - is the first point of the segment.
        z2 - is the first point of the segment.
        x3 - is the second point of the segment.
        y3 - is the second point of the segment.
        z3 - is the second point of the segment.
        Returns:
        true if the two shapes are intersecting; otherwise false
      • getPointIterator

        @Pure
        static <P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>> Iterator<P> getPointIterator​(int cx,
                                                                                                                                               int cy,
                                                                                                                                               int cz,
                                                                                                                                               int radius,
                                                                                                                                               int firstOctantIndex,
                                                                                                                                               int nbOctants,
                                                                                                                                               GeomFactory3ai<?,​P,​V,​?> factory)
        Replies the points of the sphere perimeters starting by the first octant.
        Type Parameters:
        P - the type of the points.
        V - the type of the vectors.
        Parameters:
        cx - is the center of the radius.
        cy - is the center of the radius.
        cz - is the center of the radius.
        radius - is the radius of the radius.
        firstOctantIndex - is the index of the first octant to treat (value in [0;7].
        nbOctants - is the number of octants to traverse (value in [0; 7 - firstOctantIndex].
        factory - the factory to use for creating the points.
        Returns:
        the points on the perimeters.
      • getPointIterator

        @Pure
        default Iterator<P> getPointIterator​(int firstOctantIndex,
                                             int nbOctants)
        Replies the points of the sphere perimeters starting by the first octant.
        Parameters:
        firstOctantIndex - is the index of the first octant (see figure) to treat.
        nbOctants - is the number of octants to traverse (greater than zero).
        Returns:
        the points on the perimeters.
      • isEmpty

        @Pure
        default boolean isEmpty()
        Description copied from interface: Shape3D
        Replies if this shape is empty. The semantic associated to the state "empty" depends on the implemented shape. See the subclasses for details.
        Specified by:
        isEmpty in interface Shape3D<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Returns:
        true if the shape is empty; false otherwise.
      • set

        default void set​(Point3D<?,​?> center,
                         int radius)
        Change the sphere.
        Parameters:
        center - the center of the sphere.
        radius - the radius of the sphere.
      • set

        void set​(int x,
                 int y,
                 int z,
                 int radius)
        Change the sphere.
        Parameters:
        x - the x coordinate of the center.
        y - the y coordinate of the center.
        z - the z coordinate of the center.
        radius - the radius of the center.
      • setCenter

        default void setCenter​(Point3D<?,​?> center)
        Change the sphere's center.
        Parameters:
        center - the center of the sphere.
      • setCenter

        default void setCenter​(int x,
                               int y,
                               int z)
        Change the sphere's center.
        Parameters:
        x - x coordinate of the center of the sphere.
        y - y coordinate of the center of the sphere.
        z - z coordinate of the center of the sphere.
      • getX

        @Pure
        int getX()
        Replies the center X.
        Returns:
        the center x.
      • setX

        @Pure
        void setX​(int x)
        Change the center X.
        Parameters:
        x - the center x.
      • getY

        @Pure
        int getY()
        Replies the center y.
        Returns:
        the center y.
      • setY

        @Pure
        void setY​(int y)
        Change the center Y.
        Parameters:
        y - the center y.
      • getZ

        @Pure
        int getZ()
        Replies the center z.
        Returns:
        the center z.
      • setZ

        @Pure
        void setZ​(int z)
        Change the center Z.
        Parameters:
        z - the center z.
      • getCenter

        @Pure
        default P getCenter()
        Replies the center.
        Returns:
        a copy of the center.
      • getRadius

        @Pure
        int getRadius()
        Replies the radius.
        Returns:
        the radius.
      • setRadius

        @Pure
        void setRadius​(int radius)
        Change the radius.
        Parameters:
        radius - the radius.
      • getDistanceSquared

        @Pure
        default double getDistanceSquared​(Point3D<?,​?> pt)
        Description copied from interface: Shape3D
        Replies the squared value of the minimal distance from this shape to the given point.
        Specified by:
        getDistanceSquared in interface Shape3D<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        pt - the point.
        Returns:
        squared value of the minimal distance between this shape and the point.
      • getDistanceLinf

        @Pure
        default double getDistanceLinf​(Point3D<?,​?> pt)
        Description copied from interface: Shape3D
        Computes the L-infinite distance between this shape and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2)].
        Specified by:
        getDistanceLinf in interface Shape3D<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        pt - the point.
        Returns:
        the distance.
      • getClosestPointTo

        default P getClosestPointTo​(Sphere3ai<?,​?,​?,​?,​?,​?> circle)
        Description copied from interface: Shape3ai
        Replies the closest point on this shape to the given rectangle.
        Specified by:
        getClosestPointTo in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        circle - the circle.
        Returns:
        the closest point on this shape to the given shape; or the point if the point is in this shape.
      • getClosestPointTo

        default P getClosestPointTo​(Segment3ai<?,​?,​?,​?,​?,​?> segment)
        Description copied from interface: Shape3ai
        Replies the closest point on this shape to the given rectangle.
        Specified by:
        getClosestPointTo in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        segment - the segment.
        Returns:
        the closest point on this shape to the given shape; or the point if the point is in this shape.
      • getClosestPointTo

        default P getClosestPointTo​(MultiShape3ai<?,​?,​?,​?,​?,​?,​?> multishape)
        Description copied from interface: Shape3ai
        Replies the closest point on this shape to the given rectangle.
        Specified by:
        getClosestPointTo in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        multishape - the multishape.
        Returns:
        the closest point on this shape to the given shape; or the point if the point is in this shape.
      • getClosestPointTo

        default P getClosestPointTo​(Path3ai<?,​?,​?,​?,​?,​?> path)
        Description copied from interface: Shape3ai
        Replies the closest point on this shape to the given rectangle.
        Specified by:
        getClosestPointTo in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        path - the path.
        Returns:
        the closest point on this shape to the given shape; or the point if the point is in this shape.
      • intersects

        @Pure
        default boolean intersects​(RectangularPrism3ai<?,​?,​?,​?,​?,​?> rectangularPrism)
        Description copied from interface: Shape3ai
        Replies if this shape is intersecting the given rectangular prism.
        Specified by:
        intersects in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        rectangularPrism - the rectangular prism.
        Returns:
        true if this shape is intersecting the given shape; false if there is no intersection.
      • intersects

        @Pure
        default boolean intersects​(Sphere3ai<?,​?,​?,​?,​?,​?> sphere)
        Description copied from interface: Shape3ai
        Replies if this shape is intersecting the given sphere.
        Specified by:
        intersects in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        sphere - the sphere
        Returns:
        true if this shape is intersecting the given shape; false if there is no intersection.
      • intersects

        @Pure
        default boolean intersects​(Segment3ai<?,​?,​?,​?,​?,​?> segment)
        Description copied from interface: Shape3ai
        Replies if this shape is intersecting the given segment.
        Specified by:
        intersects in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        segment - the segment
        Returns:
        true if this shape is intersecting the given shape; false if there is no intersection.
      • intersects

        @Pure
        default boolean intersects​(PathIterator3ai<?> iterator)
        Description copied from interface: Shape3ai
        Replies if this shape is intersecting the path described by the given iterator.
        Specified by:
        intersects in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        iterator - the path Iterator
        Returns:
        true if this shape is intersecting the given shape; false if there is no intersection.
      • intersects

        @Pure
        default boolean intersects​(MultiShape3ai<?,​?,​?,​?,​?,​?,​?> multishape)
        Description copied from interface: Shape3ai
        Replies if this shape is intersecting the given multishape.
        Specified by:
        intersects in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        multishape - the ùmultishape
        Returns:
        true if this shape is intersecting the given shape; false if there is no intersection.