Documentation of 'math.geom2d.conic.Circle2D' Java class
Circle2D
math.geom2d.conic

Class Circle2D

    • Nested Class Summary

    • Constructor Summary

      Constructors 
      Constructor and Description
      Circle2D()
      Empty constructor: center 0,0 and radius 0.
      Circle2D(double xcenter, double ycenter, double radius)
      Create a new circle with specified center and radius
      Circle2D(double xcenter, double ycenter, double radius, boolean direct)
      Create a new circle with specified center, radius and orientation.
      Circle2D(Point2D center, double radius)
      Create a new circle with specified point center and radius
      Circle2D(Point2D center, double radius, boolean direct)
      Create a new circle with specified center, radius and orientation
    • Constructor Detail

      • Circle2D

        public Circle2D()
        Empty constructor: center 0,0 and radius 0.
      • Circle2D

        public Circle2D(Point2D center,
                        double radius)
        Create a new circle with specified point center and radius
      • Circle2D

        public Circle2D(Point2D center,
                        double radius,
                        boolean direct)
        Create a new circle with specified center, radius and orientation
      • Circle2D

        public Circle2D(double xcenter,
                        double ycenter,
                        double radius)
        Create a new circle with specified center and radius
      • Circle2D

        public Circle2D(double xcenter,
                        double ycenter,
                        double radius,
                        boolean direct)
        Create a new circle with specified center, radius and orientation.
    • Method Detail

      • create

        @Deprecated
        public static Circle2D create(Point2D center,
                                                  double radius)
        Deprecated. since 0.11.1
        Creates a circle from a center and a radius.
      • create

        @Deprecated
        public static Circle2D create(Point2D center,
                                                  double radius,
                                                  boolean direct)
        Deprecated. since 0.11.1
        Creates a circle from a center, a radius, and a flag indicating orientation.
      • create

        @Deprecated
        public static Circle2D create(Point2D p1,
                                                  Point2D p2,
                                                  Point2D p3)
        Deprecated. replaced by createCircle(Point2D, Point2D, Point2D) (0.11.1)
        Creates a circle containing 3 points.
      • getIntersections

        @Deprecated
        public static java.util.Collection<Point2D> getIntersections(Circle2D circle1,
                                                                                 Circle2D circle2)
        Deprecated. replaced by circlesIntersections(Circle2D, Circle2D) (0.11.1)
      • getIntersections

        @Deprecated
        public static java.util.Collection<Point2D> getIntersections(CircularShape2D circle,
                                                                                 LinearShape2D line)
        Deprecated. replaced by lineCircleIntersections(LinearShape2D, CircularShape2D) (0.11.1)
        Computes intersections of a circle with a line. Returns an array of Point2D, of size 0, 1 or 2 depending on the distance between circle and line. If there are 2 intersections points, the first one in the array is the first one on the line.
      • circumCircle

        public static Circle2D circumCircle(Point2D p1,
                                            Point2D p2,
                                            Point2D p3)
        Computes the circumscribed circle of the 3 input points.
        Returns:
        the circle that contains the three input points
        Throws:
        ColinearPoints2DException - if the 3 points are colinear
      • circlesIntersections

        public static java.util.Collection<Point2D> circlesIntersections(Circle2D circle1,
                                                                         Circle2D circle2)
        Computes the intersections points between two circles or circular shapes.
        Parameters:
        circle1 - an instance of circle or circle arc
        circle2 - an instance of circle or circle arc
        Returns:
        a collection of 0, 1 or 2 intersection points
      • lineCircleIntersections

        public static java.util.Collection<Point2D> lineCircleIntersections(LinearShape2D line,
                                                                            CircularShape2D circle)
        Computes intersections of a circle with a line. Returns an array of Point2D, of size 0, 1 or 2 depending on the distance between circle and line. If there are 2 intersections points, the first one in the array is the first one on the line.
        Returns:
        a collection of intersection points
        Since:
        0.11.1
      • radicalAxis

        public static StraightLine2D radicalAxis(Circle2D circle1,
                                                 Circle2D circle2)
        Computes the radical axis of the two circles.
        Returns:
        the radical axis of the two circles.
        Throws:
        java.lang.IllegalArgumentException - if the two circles have same center
        Since:
        0.11.1
      • radius

        public double radius()
        Returns the radius of the circle.
      • intersections

        public java.util.Collection<Point2D> intersections(Circle2D circle)
        Returns the intersection points with another circle. The result is a collection with 0, 1 or 2 points.
      • isDirect

        public boolean isDirect()
        Returns true if circle has a direct orientation.
        Specified by:
        isDirect in interface EllipseShape2D
      • vector1

        public Vector2D vector1()
        Returns the first direction vector of the circle, in the direction of the major axis.
      • vector2

        public Vector2D vector2()
        Returns the second direction vector of the circle, in the direction of the minor axis.
      • angle

        public double angle()
        Returns the angle of the circle main axis with the Ox axis.
      • focus1

        public Point2D focus1()
        Returns the first focus, which for a circle is the same point as the center.
      • focus2

        public Point2D focus2()
        Returns the second focus, which for a circle is the same point as the center.
      • isCircle

        public boolean isCircle()
        Description copied from interface: EllipseShape2D
        Returns true if this ellipse shape is similar to a circle, i.e. has same length for both semi-axes.
        Specified by:
        isCircle in interface EllipseShape2D
      • asEllipse

        public Ellipse2D asEllipse()
        Converts this circle to an instance of Ellipse2D.
        Returns:
        a new instance of Ellipse2D that corresponds to this circle
      • conicCoefficients

        public double[] conicCoefficients()
        Returns Cartesian equation of the circle:

        (x-xc)^2 + (y-yc)^2 = r^2, giving:

        x^2 + 0*x*y + y^2 -2*xc*x -2*yc*y + xc*xc+yc*yc-r*r = 0.

        Specified by:
        conicCoefficients in interface Conic2D
      • eccentricity

        public double eccentricity()
        Returns 0, which is the eccentricity of a circle by definition.
        Specified by:
        eccentricity in interface Conic2D
      • buffer

        public CirculinearDomain2D buffer(double dist)
        Description copied from interface: CirculinearShape2D
        Computes the buffer of the shape, formed by the set of points located at a distance from the shape that is lower or equal to d.
        Specified by:
        buffer in interface CirculinearShape2D
        Parameters:
        dist - the maximal distance between a point of the buffer and the shape
        Returns:
        the buffer of the shape
      • length

        public double length()
        Returns perimeter of the circle (equal to 2*PI*radius).
        Specified by:
        length in interface CirculinearCurve2D
        Returns:
        the length of the curve
      • position

        public double position(double length)
        Specified by:
        position in interface CirculinearCurve2D
        Returns:
        the position located at a given geodesic distance from the origin
      • fill

        public void fill(java.awt.Graphics2D g2)
        Description copied from interface: Boundary2D
        Fills the interior of the boundary, using the Graphics current Paint.
        Specified by:
        fill in interface Boundary2D
        Parameters:
        g2 - the Graphics to fill on
      • windingAngle

        public double windingAngle(Point2D point)
        Return either 0, 2*PI or -2*PI, depending whether the point is located inside the interior of the ellipse or not.
        Specified by:
        windingAngle in interface OrientedCurve2D
        Parameters:
        point - a point of the plane
        Returns:
        a signed angle
      • curvature

        public double curvature(double t)
        Returns the inverse of the circle radius. If the circle is indirect, the curvature is negative.
        Specified by:
        curvature in interface ContinuousCurve2D
        Parameters:
        t - the position on the curve
        Returns:
        the curvature of the curve for position t
      • isClosed

        public boolean isClosed()
        Returns true, as an ellipse is always closed.
        Specified by:
        isClosed in interface ContinuousCurve2D
      • isInside

        public boolean isInside(Point2D point)
        Test whether the point is inside the circle. The test is performed by translating the point, and re-scaling it such that its coordinates are expressed in unit circle basis.
        Specified by:
        isInside in interface Boundary2D
        Specified by:
        isInside in interface OrientedCurve2D
        Parameters:
        point - a point in the plane
        Returns:
        true if the point is on the left side of the curve.
      • signedDistance

        public double signedDistance(Point2D point)
        Description copied from interface: OrientedCurve2D
        Returns the signed distance of the curve to the given point. The distance is positive if the point lies outside the shape, and negative if the point lies inside the shape. In both cases, absolute value of distance is equals to the distance to the border of the shape.
        Specified by:
        signedDistance in interface OrientedCurve2D
        Parameters:
        point - a point of the plane
        Returns:
        the signed distance to the curve
      • signedDistance

        public double signedDistance(double x,
                                     double y)
        Description copied from interface: OrientedCurve2D
        The same as distanceSigned(Point2D), but by passing 2 double as arguments.
        Specified by:
        signedDistance in interface OrientedCurve2D
        Parameters:
        x - x-coord of a point
        y - y-coord of a point
        Returns:
        the signed distance of the point (x,y) to the curve
      • isBounded

        public boolean isBounded()
        Always returns true.
        Specified by:
        isBounded in interface Shape2D
      • isEmpty

        public boolean isEmpty()
        Always returns false.
        Specified by:
        isEmpty in interface Shape2D
        Returns:
        true if the shape does not contain any point.
      • t0

        public double t0()
        Returns the parameter of the first point of the ellipse, set to 0.
        Specified by:
        t0 in interface Curve2D
      • getT0

        @Deprecated
        public double getT0()
        Deprecated. replaced by t0() (since 0.11.1).
        Specified by:
        getT0 in interface Curve2D
      • t1

        public double t1()
        Returns the parameter of the last point of the ellipse, set to 2*PI.
        Specified by:
        t1 in interface Curve2D
      • getT1

        @Deprecated
        public double getT1()
        Deprecated. replaced by t1() (since 0.11.1).
        Specified by:
        getT1 in interface Curve2D
      • point

        public Point2D point(double t)
        Get the position of the curve from internal parametric representation, depending on the parameter t. This parameter is between the two limits 0 and 2*Math.PI.
        Specified by:
        point in interface Curve2D
      • position

        public double position(Point2D point)
        Description copied from interface: Curve2D
        Computes the position of the point on the curve. If the point does not belong to the curve, return Double.NaN. It is complementary to the point(double) method.
        Specified by:
        position in interface Curve2D
        Parameters:
        point - a point belonging to the curve
        Returns:
        the position of the point on the curve
        See Also:
        Curve2D.point(double)
      • project

        public double project(Point2D point)
        Computes the projection position of the point on the circle, by computing angle with horizonrtal
        Specified by:
        project in interface Curve2D
        Parameters:
        point - a point to project
        Returns:
        the position of the closest orthogonal projection
      • distance

        public double distance(Point2D point)
        Description copied from interface: Shape2D
        Returns the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape.
        Specified by:
        distance in interface Shape2D
      • distance

        public double distance(double x,
                               double y)
        Description copied from interface: Shape2D
        Returns the distance of the shape to the given point, specified by x and y, or the distance of point to the frontier of the shape in the case of a plain (i.e. fillable) shape.
        Specified by:
        distance in interface Shape2D
      • intersections

        public java.util.Collection<Point2D> intersections(LinearShape2D line)
        Computes intersections of the circle with a line. Return an array of Point2D, of size 0, 1 or 2 depending on the distance between circle and line. If there are 2 intersections points, the first one in the array is the first one on the line.
        Specified by:
        intersections in interface Curve2D
      • contains

        public boolean contains(Point2D p)
        Returns true if the point p lies on the ellipse, with precision given by Shape2D.ACCURACY.
        Specified by:
        contains in interface Shape2D
      • contains

        public boolean contains(double x,
                                double y)
        Returns true if the point (x, y) lies exactly on the circle.
        Specified by:
        contains in interface Shape2D
      • appendPath

        public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
        Description copied from interface: ContinuousCurve2D
        Append the path of the curve to the given path.
        Specified by:
        appendPath in interface ContinuousCurve2D
        Parameters:
        path - a path to modify
        Returns:
        the modified path
      • draw

        public void draw(java.awt.Graphics2D g2)
        Description copied from interface: Curve2D
        Draws the curve on the given Graphics2D object.
        Specified by:
        draw in interface Curve2D
        Specified by:
        draw in interface Shape2D
        Overrides:
        draw in class AbstractContinuousCurve2D
        Parameters:
        g2 - the graphics to draw the curve in
      • almostEquals

        public boolean almostEquals(GeometricObject2D obj,
                                    double eps)
        Description copied from interface: GeometricObject2D
        Checks if the two objects are similar up to a given threshold value. This method can be used to compare the results of geometric computations, that introduce errors due to numerical computations.
        Specified by:
        almostEquals in interface GeometricObject2D
        Parameters:
        obj - the object to compare
        eps - a threshold value, for example the minimal coordinate difference
        Returns:
        true if both object have the same value up to the threshold
      • boundingBox

        public Box2D boundingBox()
        Returns bounding box of the circle.
        Specified by:
        boundingBox in interface Shape2D
        Returns:
        the bounding box of the shape.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.