## devisor2.foundation.boundary
Class SegmentLine

    java.lang.Object
      devisor2.foundation.GridItem
          devisor2.foundation.boundary.Segment
              devisor2.foundation.boundary.SegmentLine

All Implemented Interfaces:
  java.io.Serializable

public class SegmentLine
extends Segment
implements java.io.Serializable

This class represents the segment type LINE, a straight line between two given points. As it can be messed with on the grid, it indirectly extends the GridItem class

See Also:
  Serialized Form

Field Summary
`static boolean` `GRADIENT` constant to indicate that a SegmentLine is initialised via startpoint and gradient vector
`static boolean` `TWOPOINT` constant to indicate that a SegmentLine is initialised via startpoint and end point coordinates

Fields inherited from class devisor2.foundation.boundary.Segment
`boundary, orientation_marker_1, orientation_marker_2, orientation_marker_3, tmax`

Fields inherited from class devisor2.foundation.GridItem
`cc, marked, transformed, xmax, xmin, ymax, ymin`

Constructor Summary
`SegmentLine()` creates an empty SegmentLine
`SegmentLine(int tx, int ty, int tsx, int tsy, boolean mode)` creates the segment type Line

Method Summary
`void` `adjustPerimeter(Node n, int index)` change coordinates therefor, that at indes 0 that the beginning of this segment is at node 'n', else that the ending of this segment is at node 'n'.
`java.lang.Object` `clone()` creates a full clone of the SegmentLine object, including boundary information
`void` `draw(java.awt.Graphics g)` draw the segment.
`Node` `getCartesianCoords(double t)` returns the cartesian coordinates according to the parameter value t
`int[]` `getEndPoint()` returns the endpoint coordinates
`int[]` `getIntersection(int[] xx)`
`double[]` `getParameters()` gets the parameters of the line
`double` `getParameterValue(Node n)` calculate parameter value of node 'n' from its x/y coordinates (note: only the relative parameter value is calculated, the boundary-wide value is not considered)
`int[]` `getParams()` gets the parameters of the line
`java.awt.Rectangle` `getPerimeter()` returns the perimeter of the Line element, that is the smallest bounding box completely containing the Line
`int[]` `getStartPoint()` returns the startpoint coordinates
`boolean` `isHit(int cx, int cy)` Determines if the item has been hit by a click on the grid ALL IN WORLD COORDINATES to avoid the snap mechanism
`boolean` `isInside(int[] topleft, int[] bottomright)` Is the item inside a given rectangular area? All in WORLD COORDINATES!!!
`boolean` `isOnBoundary(int x, int y)` returns whether or not a point lies on a boundary segment
`void` `performMirror(double nx, double ny, double px, double py)` This method mirrors the line at the given line by mirroring the two endpoints
`void` `performTransformation(GridTransformation trf)` transforms the line segment by transforming the two endpoints
`void` `setEndPoint(int x2, int y2)` sets the endpoint of the line
`void` `setParameters(double[] ux)` sets the parameters of the line
`void` `setParams(int[] ux)` sets the parameters of the line
`void` `setStartPoint(int x1, int y1)` sets the startpoint of the line
`void` `swapPerimeter()` inverts orientation of this segment without changing parameter values of related boundarynodes.
`java.lang.String` `toString()`
`void` `updateInnerData()` updates the inner variables xmin, xmax, ymin, ymax and the polygonal representation of the line object including the orientation marker

Methods inherited from class devisor2.foundation.boundary.Segment
`drawOrientationMarker, getBoundary, getBoundaryNumber, getSegmentNumber, getTMax, setBoundary, setTMax`

Methods inherited from class devisor2.foundation.GridItem
`clearTransformedFlag, isMarked, setMarker, setMarker, unsetMarker`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### GRADIENT

    public static final boolean GRADIENT

  constant to indicate that a SegmentLine is initialised via startpoint and gradient vector

  See Also:
    Constant Field Values

### TWOPOINT

    public static final boolean TWOPOINT

  constant to indicate that a SegmentLine is initialised via startpoint and end point coordinates

  See Also:
    Constant Field Values

Constructor Detail

### SegmentLine

    public SegmentLine(int tx,
                       int ty,
                       int tsx,
                       int tsy,
                       boolean mode)

  creates the segment type Line

Parameters:
  `mode` - GRADIENT or TWOPOINT

### SegmentLine

    public SegmentLine()

  creates an empty SegmentLine

Method Detail

### setParameters

    public void setParameters(double[] ux)

  sets the parameters of the line

  Specified by:
    `setParameters` in class `Segment`

### getParameters

    public double[] getParameters()

  gets the parameters of the line

  Specified by:
    `getParameters` in class `Segment`

### setParams

    public void setParams(int[] ux)

  sets the parameters of the line

  Specified by:
    `setParams` in class `Segment`

### getParams

    public int[] getParams()

  gets the parameters of the line

  Specified by:
    `getParams` in class `Segment`

### setStartPoint

    public void setStartPoint(int x1,
                              int y1)

  sets the startpoint of the line

### setEndPoint

    public void setEndPoint(int x2,
                            int y2)

  sets the endpoint of the line

### getStartPoint

    public int[] getStartPoint()

  returns the startpoint coordinates

### getEndPoint

    public int[] getEndPoint()

  returns the endpoint coordinates

### isOnBoundary

    public boolean isOnBoundary(int x,
                                int y)

  Description copied from class: `Segment`
  returns whether or not a point lies on a boundary segment

  Specified by:
    `isOnBoundary` in class `Segment`
  Returns:
    true if the Point is on the segment, false otherwise
  See Also:
    `Segment.isOnBoundary`

### getIntersection

    public int[] getIntersection(int[] xx)

  See Also:
    `DomainBoundary.getIntersection`

### getParameterValue

    public double getParameterValue(Node n)

  Description copied from class: `Segment`
  calculate parameter value of node 'n' from its x/y coordinates (note: only the relative parameter value is calculated, the boundary-wide value is not considered)

  Specified by:
    `getParameterValue` in class `Segment`
  See Also:
    `Segment.getParameterValue`

### getCartesianCoords

    public Node getCartesianCoords(double t)

  returns the cartesian coordinates according to the parameter value t

  Specified by:
    `getCartesianCoords` in class `Segment`
  Parameters:
    `t` - parameter value
  Returns:
    Node representation of the coordinates

### swapPerimeter

    public void swapPerimeter()

  Description copied from class: `Segment`
  inverts orientation of this segment without changing parameter values of related boundarynodes.

  Specified by:
    `swapPerimeter` in class `Segment`
  See Also:
    `Segment.swapPerimeter`

### adjustPerimeter

    public void adjustPerimeter(Node n,
                                int index)

  Description copied from class: `Segment`
  change coordinates therefor, that at indes 0 that the beginning of this segment is at node 'n', else that the ending of this segment is at node 'n'.

  Specified by:
    `adjustPerimeter` in class `Segment`
  See Also:
    `Segment.adjustPerimeter`

### isInside

    public boolean isInside(int[] topleft,
                            int[] bottomright)

  Is the item inside a given rectangular area? All in WORLD COORDINATES!!!

  Specified by:
    `isInside` in class `Segment`
  Parameters:
    `topleft` - - the topleft corner of the rectangle
    `bottomright` - - the bottom right corner of the rectangle
  Returns:
    true if the item is completely inside the rectangle

### isHit

    public boolean isHit(int cx,
                         int cy)

  Determines if the item has been hit by a click on the grid ALL IN WORLD COORDINATES to avoid the snap mechanism

  Specified by:
    `isHit` in class `Segment`
  Returns:
    true if the item has been hit

### updateInnerData

    public void updateInnerData()

  updates the inner variables xmin, xmax, ymin, ymax and the polygonal representation of the line object including the orientation marker

  Specified by:
    `updateInnerData` in class `Segment`

### draw

    public void draw(java.awt.Graphics g)

  draw the segment. @see Segment.draw

  Specified by:
    `draw` in class `Segment`
  Parameters:
    `g` - - the graphics context to paint to

### getPerimeter

    public java.awt.Rectangle getPerimeter()

  returns the perimeter of the Line element, that is the smallest bounding box completely containing the Line

  Specified by:
    `getPerimeter` in class `Segment`

### performTransformation

    public void performTransformation(GridTransformation trf)

  transforms the line segment by transforming the two endpoints

  Specified by:
    `performTransformation` in class `Segment`

### performMirror

    public void performMirror(double nx,
                              double ny,
                              double px,
                              double py)

  This method mirrors the line at the given line by mirroring the two endpoints

  Specified by:
    `performMirror` in class `Segment`

### clone

    public java.lang.Object clone()

  creates a full clone of the SegmentLine object, including boundary information

  Specified by:
    `clone` in class `Segment`

### toString

    public java.lang.String toString()

  Returns:
    a String representation of the line object