Class LineSegment


  • public class LineSegment
    extends Primitive
    A LineSegment object has four integers that represent the endpoints of the line segment and the color at each endpoint. Two of the integers are indices into the Vertex list of a Model object and the other two integers are indices into the Color list of that Model object.
    • Constructor Detail

      • LineSegment

        public LineSegment​(int i0,
                           int i1)
        Construct a LineSegment object using two integer indices. Use the given indices for both the vertex and the color lists.
        Parameters:
        i0 - index of 1st endpoint Vertex and color of the new LineSegment
        i1 - index of 2nd endpoint Vertex and color of the new LineSegment
      • LineSegment

        public LineSegment​(int i0,
                           int i1,
                           int c)
        Construct a LineSegment object using two integer indices for the vertices and one integer index for the colors.
        Parameters:
        i0 - index of 1st endpoint Vertex of the new LineSegment
        i1 - index of 2nd endpoint Vertex of the new LineSegment
        c - index of the color of the new LineSegment
      • LineSegment

        public LineSegment​(int i0,
                           int i1,
                           int c0,
                           int c1)
        Construct a LineSegment object using two integer indices for the vertices and two integer indices for the colors.

        NOTE: This constructor does not put any Vertex or Color objects into this Primitive's Model object. This constructor assumes that the given indices are valid (or will be valid by the time this Primitive gets rendered).

        Parameters:
        i0 - index of 1st endpoint Vertex of the new LineSegment
        i1 - index of 2nd endpoint Vertex of the new LineSegment
        c0 - index of 1st endpoint Color of the new LineSegment
        c1 - index of 2nd endpoint Color of the new LineSegment