java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance

public class LineAppearance extends Object
Factory for creating Line objects with consistent appearance settings.

This class encapsulates common line styling parameters (width and color) to avoid redundant configuration. It provides multiple constructors for flexibility and ensures default values are used when not specified.

Example usage:


 // Create a line appearance with default color and width 2.0
 LineAppearance appearance = new LineAppearance(2.0, Color.RED);

 // Create multiple lines with the same appearance
 Line line1 = appearance.getLine(new Point3D(0, 0, 100), new Point3D(10, 0, 100));
 Line line2 = appearance.getLine(new Point3D(0, 10, 100), new Point3D(10, 10, 100));

 // Override color for a specific line
 Line blueLine = appearance.getLine(p1, p2, Color.BLUE);
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a line appearance with default width (1.0) and default color (light blue).
    LineAppearance(double lineWidth)
    Creates a line appearance with the specified width and default color (light blue).
    LineAppearance(double lineWidth, Color color)
    Creates a line appearance with the specified width and color.
  • Method Summary

    Modifier and Type
    Method
    Description
    getLine(Point3D point1, Point3D point2)
    Creates a line between two points using this appearance's width and color.
    getLine(Point3D point1, Point3D point2, Color color)
    Creates a line between two points using this appearance's width and a custom color.
    double
    Returns the line width configured for this appearance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LineAppearance

      public LineAppearance()
      Creates a line appearance with default width (1.0) and default color (light blue).
    • LineAppearance

      public LineAppearance(double lineWidth)
      Creates a line appearance with the specified width and default color (light blue).
      Parameters:
      lineWidth - the line width in world units
    • LineAppearance

      public LineAppearance(double lineWidth, Color color)
      Creates a line appearance with the specified width and color.
      Parameters:
      lineWidth - the line width in world units
      color - the line color
  • Method Details

    • getLine

      public Line getLine(Point3D point1, Point3D point2)
      Creates a line between two points using this appearance's width and color.
      Parameters:
      point1 - the starting point of the line
      point2 - the ending point of the line
      Returns:
      a new Line instance
    • getLine

      public Line getLine(Point3D point1, Point3D point2, Color color)
      Creates a line between two points using this appearance's width and a custom color.
      Parameters:
      point1 - the starting point of the line
      point2 - the ending point of the line
      color - the color for this specific line (overrides the default)
      Returns:
      a new Line instance
    • getLineWidth

      public double getLineWidth()
      Returns the line width configured for this appearance.
      Returns:
      the line width in world units