Class Jaxo3PointObject

    • Constructor Detail

      • Jaxo3PointObject

        public Jaxo3PointObject()
    • Method Detail

      • getPointCount

        public int getPointCount()
        Returns the number of points it takes to draw this object.
        Overrides:
        getPointCount in class JaxoExtendedObject
        Returns:
        3.
      • getX

        public int getX​(int index)
        X coordinate of Point 0 <= index < getPointCount().
        Overrides:
        getX in class JaxoExtendedObject
        Parameters:
        index - The index of the point to get.
        Returns:
        The x coordinate of the point at the given index.
      • getY

        public int getY​(int index)
        Y coordinate of Point 0 <= index < getPointCount().
        Overrides:
        getY in class JaxoExtendedObject
        Parameters:
        index - The index of the point to get.
        Returns:
        The y coordinate of the point at the given index.
      • setX

        public void setX​(int index,
                         int value)
        Set X coordinate of Point 0 <= index < getPointCount() to 'value'. Throws IllegalArgumentException if the index is not valid for the given object.
        Overrides:
        setX in class JaxoExtendedObject
        Parameters:
        index - The index of the point to set.
        value - The value to set.
      • setY

        public void setY​(int index,
                         int value)
        Set Y coordinate of Point 0 <= index < getPointCount() to 'value'. Throws IllegalArgumentException if the index is not valid for the given object.
        Overrides:
        setY in class JaxoExtendedObject
        Parameters:
        index - The index of the point to set.
        value - The value to set.
      • setX3

        public final void setX3​(int newx3)
        Sets the x coordinate of the first click point of this arc.
        Parameters:
        newx3 - The x coordinate of the first click point of this arc.
      • getX3

        public final int getX3()
        Returns the x coordinate of the first click point of this arc.
        Returns:
        The x coordinate of the first click point of this arc.
      • setY3

        public final void setY3​(int newy3)
        Sets the y coordinate of the first click point of this arc.
        Parameters:
        newy3 - The y coordinate of the first click point of this arc.
      • getY3

        public final int getY3()
        Returns the y coordinate of the first click point of this arc.
        Returns:
        The y coordinate of the first click point of this arc.
      • set3Pts

        public final void set3Pts​(int x1,
                                  int y1,
                                  int x2,
                                  int y2,
                                  int p3,
                                  int q3)
        Deprecated.
        Sets the points of this 3 point object.
        Parameters:
        x1 - The x coordinate of the first point.
        y1 - The y coordinate of the first point.
        x2 - The x coordinate of the second point.
        y2 - The y coordinate of the second point.
        p3 - The x coordinate of the third point.
        q3 - The y coordinate of the third point.
      • setLocation

        public final void setLocation​(int x1,
                                      int y1,
                                      int x2,
                                      int y2,
                                      int p3,
                                      int q3)
        Sets the points of this 3 point object.
        Parameters:
        x1 - The x coordinate of the first point.
        y1 - The y coordinate of the first point.
        x2 - The x coordinate of the second point.
        y2 - The y coordinate of the second point.
        p3 - The x coordinate of the third point.
        q3 - The y coordinate of the third point.
      • copyFrom

        public void copyFrom​(Jaxo3PointObject temp)
        Sets all parameters from the given objet to the current one.
        Parameters:
        temp - The object to copy from.
      • isCopy

        public boolean isCopy​(JaxoObject comp)
        Determines if this JaxoObject is a copy of the specified one.
        Overrides:
        isCopy in class JaxoParticleObject
        Parameters:
        comp - The JaxoObject to compare against.
        Returns:
        True if the JaxoObjects are identical.
      • paintHandles

        public void paintHandles​(JaxoGraphics2D g2,
                                 JaxoHandle h,
                                 int editMode)
        Paints the handles of this JaxoObject that allow to move/resize/edit it.
        Overrides:
        paintHandles in class JaxoExtendedObject
        Parameters:
        g2 - The corresponding graphics context.
        h - A handle object to be used for painting.
        editMode - The edit mode that the handles are being painted in.
      • smallestDistanceTo

        public float smallestDistanceTo​(int px,
                                        int py)
        Determines the smallest distance of any of the handles of this JaxoObject from the given point.
        Overrides:
        smallestDistanceTo in class JaxoExtendedObject
        Parameters:
        px - The x coordinate of the test point.
        py - The y coordinate of the test point.
        Returns:
        The smallest distance.
      • canBeSelected

        public boolean canBeSelected​(int handle,
                                     int mode)
        Determines if the object can be selected (moved, edited, etc) from the given point in a given edit mode.
        Overrides:
        canBeSelected in class JaxoExtendedObject
        Parameters:
        handle - One of the static variables SELECT_* defined for this JaxoObject.
        mode - The current edit mode.
        Returns:
        True if the object may be selected from the given point, false otherwise.
      • getGrabbedHandle

        public int getGrabbedHandle​(int clickX,
                                    int clickY,
                                    JaxoHandle h)
        Determines which handle the user has selected to move/resize/edit an object.
        Overrides:
        getGrabbedHandle in class JaxoExtendedObject
        Parameters:
        clickX - The x coordinate where the mouse click has ocurred.
        clickY - The y coordinate where the mouse click has ocurred.
        h - A handle object.
        Returns:
        One of the static variables SELECT_* defined for this JaxoObject that specifies the handle which the user has clicked.
      • moveBy

        public void moveBy​(int deltaX,
                           int deltaY)
        Reset the coordinates of the object when it is moved by deltaX and deltaY.
        Overrides:
        moveBy in class JaxoExtendedObject
        Parameters:
        deltaX - The x displacement.
        deltaY - The y displacement.
      • rescaleObject

        public void rescaleObject​(int orx,
                                  int ory,
                                  float scale)
        Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.
        Specified by:
        rescaleObject in class JaxoObject
        Parameters:
        orx - The x-coordinate of the fixed point.
        ory - The y-coordinate of the fixed point.
        scale - The scale parameter.
      • isOneLine

        protected boolean isOneLine()
        Determines if the three points lie exactly on one line. Note that the result of this method is independent of the point order.
        Returns:
        true if the three points are co-linear.