Documentation of 'math.geom2d.line.LineSegment2D' Java class
LineSegment2D
math.geom2d.line

Class LineSegment2D

    • Constructor Detail

      • LineSegment2D

        public LineSegment2D(Point2D point1,
                             Point2D point2)
        Defines a new Edge with two extremities.
      • LineSegment2D

        public LineSegment2D(double x1,
                             double y1,
                             double x2,
                             double y2)
        Defines a new Edge with two extremities.
    • Method Detail

      • create

        @Deprecated
        public static LineSegment2D create(Point2D p1,
                                                       Point2D p2)
        Deprecated. since 0.11.1
        Static factory for creating a new line segment between two points.
      • getMedian

        public static StraightLine2D getMedian(LineSegment2D edge)
        Returns the straight line that is the median of the edge extremities.
      • getEdgeAngle

        public static double getEdgeAngle(LineSegment2D edge1,
                                          LineSegment2D edge2)
        Returns angle between two edges sharing one vertex.
      • intersects

        public static boolean intersects(LineSegment2D edge1,
                                         LineSegment2D edge2)
        Checks if two line segment intersect. Uses the Point2D.ccw() method, which is based on Sedgewick algorithm.
        Parameters:
        edge1 - a line segment
        edge2 - a line segment
        Returns:
        true if the 2 line segments intersect
      • opposite

        public Point2D opposite(Point2D point)
        Returns the opposite vertex of the edge.
        Parameters:
        point - one of the vertices of the edge
        Returns:
        the other vertex, or null if point is nor a vertex of the edge
      • getMedian

        public StraightLine2D getMedian()
        Returns the median of the edge, that is the locus of points located at equal distance of each vertex.
      • parallel

        public LineSegment2D parallel(double d)
        Description copied from interface: CirculinearCurve2D
        Creates a new curve, formed by the points with parameterization: p(t) = c(t) + d*n(t)/|n(t)|, with p(t) being a point of the original curve, n(t) the normal of the curve, and |n| being the norm of n.
        In the case of a continuous curve formed by several smooth circulinear elements, the parallels of contiguous elements are joined by a circle arc.
        Specified by:
        parallel in interface CirculinearContinuousCurve2D
        Specified by:
        parallel in interface CirculinearCurve2D
        Specified by:
        parallel in interface CirculinearElement2D
        Parameters:
        d - the distance between the original curve and he parallel curve.
        Returns:
        the parallel curve
      • signedDistance

        public double signedDistance(double x,
                                     double y)
        Description copied from class: AbstractLine2D
        Returns the signed distance of the StraightObject2d to the given point. The signed distance is positive if point lies 'to the right' of the line, when moving in the direction given by direction vector. This method is not designed to be used directly, because AbstractLine2D is an abstract class, but it can be used by subclasses to help computations.
        Specified by:
        signedDistance in interface OrientedCurve2D
        Overrides:
        signedDistance in class AbstractLine2D
        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
      • t0

        public double t0()
        Returns the parameter of the first point of the edge, equals 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 edge, equals to 1.
        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)
        Description copied from interface: Curve2D
        Returns the point located at the given position on the curve. If the parameter lies outside the definition range, the parameter corresponding to the closest bound is used instead. This method can be used to draw an approximated outline of a curve, by selecting multiple values for t and drawing lines between them.
        Specified by:
        point in interface Curve2D
      • isBounded

        public boolean isBounded()
        Returns true
        Specified by:
        isBounded in interface Shape2D
      • contains

        public boolean contains(double xp,
                                double yp)
        Description copied from interface: Shape2D
        Checks if the shape contains the planar point defined by (x,y).
        Specified by:
        contains in interface Shape2D
      • distance

        public double distance(double x,
                               double y)
        Get the distance of the point (x, y) to this edge.
        Specified by:
        distance in interface Shape2D
        Overrides:
        distance in class AbstractLine2D
        Parameters:
        x - the x-coordinate of the point
        y - the y-coordinate of the point
        Returns:
        distance between this object and the point (x,y)
      • boundingBox

        public Box2D boundingBox()
        Returns the bounding box of this line segment.
        Specified by:
        boundingBox in interface Shape2D
        Returns:
        the bounding box of the shape.
      • appendPath

        public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
        Appends a line to the current path.
        Specified by:
        appendPath in interface ContinuousCurve2D
        Parameters:
        path - the path to modify
        Returns:
        the modified path
      • getGeneralPath

        public java.awt.geom.GeneralPath getGeneralPath()
        deprecated
      • 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
      • 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.