Interface Sphere3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​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, Prism3afp<ST,​IT,​IE,​P,​V,​B>, Serializable, Shape3afp<ST,​IT,​IE,​P,​V,​B>, Shape3D<ST,​IT,​PathIterator3afp<IE>,​P,​V,​B>
    All Known Implementing Classes:
    Sphere3d, Sphere3dfx

    public interface Sphere3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
    extends Prism3afp<ST,​IT,​IE,​P,​V,​B>
    Fonctional interface that represented a 2D sphere on a plane.
    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

      • containsSpherePoint

        @Pure
        static boolean containsSpherePoint​(double cx,
                                           double cy,
                                           double cz,
                                           double radius,
                                           double px,
                                           double py,
                                           double pz)
        Replies if the given point is inside the given ellipse.
        Parameters:
        px - is the point to test.
        py - is the point to test.
        pz - is the point to test.
        cx - is the center of the sphere.
        cy - is the center of the sphere.
        cz - is the center of the sphere.
        radius - is the radius of the sphere.
        Returns:
        true if the point is inside the sphere; false if not.
      • containsSphereRectangularPrism

        @Pure
        static boolean containsSphereRectangularPrism​(double cx,
                                                      double cy,
                                                      double cz,
                                                      double radius,
                                                      double rxmin,
                                                      double rymin,
                                                      double rzmin,
                                                      double rxmax,
                                                      double rymax,
                                                      double rzmax)
        Replies if a rectangular prism is inside in the sphere.
        Parameters:
        cx - is the center of the sphere.
        cy - is the center of the sphere.
        cz - is the center of the sphere.
        radius - is the radius of the sphere.
        rxmin - is the lowest corner of the rectangle.
        rymin - is the lowest corner of the rectangle.
        rzmin - is the lowest corner of the rectangle.
        rxmax - is the uppest corner of the rectangle.
        rymax - is the uppest corner of the rectangle.
        rzmax - is the uppest corner of the rectangle.
        Returns:
        true if the given rectangle is inside the sphere; otherwise false.
      • intersectsSphereSphere

        @Pure
        static boolean intersectsSphereSphere​(double x1,
                                              double y1,
                                              double z1,
                                              double radius1,
                                              double x2,
                                              double y2,
                                              double z2,
                                              double 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
      • intersectsSpherePrism

        @Pure
        static boolean intersectsSpherePrism​(double x1,
                                             double y1,
                                             double z1,
                                             double radius,
                                             double x2,
                                             double y2,
                                             double z2,
                                             double x3,
                                             double y3,
                                             double 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
      • intersectsSphereLine

        @Pure
        static boolean intersectsSphereLine​(double x1,
                                            double y1,
                                            double z1,
                                            double radius,
                                            double x2,
                                            double y2,
                                            double z2,
                                            double x3,
                                            double y3,
                                            double z3)
        Replies if a sphere and a line 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 line.
        y2 - is the first point of the line.
        z2 - is the first point of the line.
        x3 - is the second point of the line.
        y3 - is the second point of the line.
        z3 - is the second point of the line.
        Returns:
        true if the two shapes are intersecting; otherwise false
      • intersectsSphereSegment

        @Pure
        static boolean intersectsSphereSegment​(double x1,
                                               double y1,
                                               double z1,
                                               double radius,
                                               double x2,
                                               double y2,
                                               double z2,
                                               double x3,
                                               double y3,
                                               double 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
      • getX

        @Pure
        double getX()
        Replies the center X.
        Returns:
        the center x.
      • getY

        @Pure
        double getY()
        Replies the center y.
        Returns:
        the center y.
      • getZ

        @Pure
        double getZ()
        Replies the center z.
        Returns:
        the center z.
      • setX

        void setX​(double x)
        Change the x coordinate of the center.
        Parameters:
        x - x coordinate of the center point.
      • setY

        void setY​(double y)
        Change the y coordinate of the center.
        Parameters:
        y - y coordinate of the center point.
      • setZ

        void setZ​(double z)
        Change the z coordinate of the center.
        Parameters:
        z - z coordinate of the center point.
      • getRadius

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

        void setRadius​(double radius)
        Set the radius.
        Parameters:
        radius - is the radius.
      • set

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

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

        @Pure
        default boolean contains​(double x,
                                 double y,
                                 double z)
        Description copied from interface: Shape3afp
        Replies if the given point is inside this shape.
        Specified by:
        contains in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​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.
      • getClosestPointTo

        @Pure
        default P getClosestPointTo​(Sphere3afp<?,​?,​?,​?,​?,​?> sphere)
        Description copied from interface: Shape3afp
        Replies the closest point on this shape to the given sphere.

        If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.

        Specified by:
        getClosestPointTo in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        sphere - the sphere.
        Returns:
        the closest point on the shape; or the point itself if it is inside the shape.
      • getClosestPointTo

        @Pure
        default P getClosestPointTo​(RectangularPrism3afp<?,​?,​?,​?,​?,​?> rectangularPrism)
        Description copied from interface: Shape3afp
        Replies the closest point on this shape to the given rectangular prism.

        If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.

        Specified by:
        getClosestPointTo in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        rectangularPrism - the rectangular prism.
        Returns:
        the closest point on the shape; or the point itself if it is inside the shape.
      • getClosestPointTo

        @Pure
        default P getClosestPointTo​(Segment3afp<?,​?,​?,​?,​?,​?> segment)
        Description copied from interface: Shape3afp
        Replies the closest point on this shape to the given segment.

        If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.

        Specified by:
        getClosestPointTo in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        segment - the segment.
        Returns:
        the closest point on the shape; or the point itself if it is inside the shape.
      • getClosestPointTo

        @Pure
        default P getClosestPointTo​(Path3afp<?,​?,​?,​?,​?,​?> path)
        Description copied from interface: Shape3afp
        Replies the closest point on this shape to the given path.

        If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.

        Specified by:
        getClosestPointTo in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        path - the path.
        Returns:
        the closest point on the shape; or the point itself if it is inside the shape.
      • getClosestPointTo

        @Pure
        default P getClosestPointTo​(MultiShape3afp<?,​?,​?,​?,​?,​?,​?> multishape)
        Description copied from interface: Shape3afp
        Replies the closest point on this shape to the given multishape.

        If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.

        Specified by:
        getClosestPointTo in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        multishape - the multishape.
        Returns:
        the closest point on the shape; or the point itself if it is inside the shape.
      • setFromCenter

        default void setFromCenter​(double centerX,
                                   double centerY,
                                   double centerZ,
                                   double cornerX,
                                   double cornerY,
                                   double cornerZ)
        Sets the framing rectangular prism of this Shape based on the specified center point coordinates and corner point coordinates. The framing rectangular prism is used by the subclasses of RectangularShape to define their geometry.

        The sphere is set in order to be enclosed inside the given box. It means that the center of the sphere is the center of the box, and the radius of the sphere is the minimum of the demi-width, demi-height and demi-depth.

        Specified by:
        setFromCenter in interface Prism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        centerX - the X coordinate of the specified center point
        centerY - the Y coordinate of the specified center point
        centerZ - the Z coordinate of the specified center point
        cornerX - the X coordinate of the specified corner point
        cornerY - the Y coordinate of the specified corner point
        cornerZ - the Z coordinate of the specified corner point
      • setFromCorners

        default void setFromCorners​(double x1,
                                    double y1,
                                    double z1,
                                    double x2,
                                    double y2,
                                    double z2)
        Change the frame of the rectangular prism conserving previous min and max if needed.

        The sphere is set in order to be enclosed inside the given box. It means that the center of the sphere is the center of the box, and the radius of the sphere is the minimum of the demi-width and demi-height.

        Specified by:
        setFromCorners in interface Prism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        x1 - is the coordinate of the first corner.
        y1 - is the coordinate of the first corner.
        z1 - is the coordinate of the first corner.
        x2 - is the coordinate of the second corner.
        y2 - is the coordinate of the second corner.
        z2 - is the coordinate of the second corner.
      • setMinX

        default void setMinX​(double x)
        Set the min X conserving previous min if needed.

        Assuming that the maximum X coordinate should not change, the center of the sphere is the point between the new minimum and the current maximum coordinates, and the radius of the sphere is set to the difference between the new minimum and center coordinates.

        If the new minimum is greater than the current maximum, the coordinates are automatically swapped.

        Specified by:
        setMinX in interface Prism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        x - the min x.
      • setMaxX

        default void setMaxX​(double x)
        Set the max X conserving previous max if needed.

        Assuming that the minimum X coordinate should not change, the center of the sphere is the point between the new maximum and the current minimum coordinates, and the radius of the sphere is set to the difference between the new maximum and center coordinates.

        If the new maximum is lower than the current minimum, the coordinates are automatically swapped.

        Specified by:
        setMaxX in interface Prism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        x - the max x.
      • setMinY

        default void setMinY​(double y)
        Set the min Y conserving previous min if needed.

        Assuming that the maximum Y coordinate should not change, the center of the sphere is the point between the new minimum and the current maximum coordinates, and the radius of the sphere is set to the difference between the new minimum and center coordinates.

        If the new minimum is greater than the current maximum, the coordinates are automatically swapped.

        Specified by:
        setMinY in interface Prism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        y - the min y.
      • setMaxY

        default void setMaxY​(double y)
        Set the max Y conserving previous max if needed.

        Assuming that the minimum Y coordinate should not change, the center of the sphere is the point between the new maximum and the current minimum coordinates, and the radius of the sphere is set to the difference between the new maximum and center coordinates.

        If the new maximum is lower than the current minimum, the coordinates are automatically swapped.

        Specified by:
        setMaxY in interface Prism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        y - the max y.
      • setMinZ

        default void setMinZ​(double z)
        Set the min Z conserving previous min if needed.

        Assuming that the maximum Z coordinate should not change, the center of the sphere is the point between the new minimum and the current maximum coordinates, and the radius of the sphere is set to the difference between the new minimum and center coordinates.

        If the new minimum is greater than the current maximum, the coordinates are automatically swapped.

        Specified by:
        setMinZ in interface Prism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        z - the min z.
      • setMaxZ

        default void setMaxZ​(double z)
        Set the max Z conserving previous max if needed.

        Assuming that the minimum Z coordinate should not change, the center of the sphere is the point between the new maximum and the current minimum coordinates, and the radius of the sphere is set to the difference between the new maximum and center coordinates.

        If the new maximum is lower than the current minimum, the coordinates are automatically swapped.

        Specified by:
        setMaxZ in interface Prism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends Sphere3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        z - the max z.