Class IntersectionDescriptor

java.lang.Object
com.amalgamasimulation.geometry.IntersectionDescriptor

public class IntersectionDescriptor extends Object
Class representing all contextual information about one intersection point of two geometric primitives, each of them can be a Point, a Segment, or a Polyline.

This class stores the intersection Point itself, as well as absolute and relative offsets of this point on both intersection operands.

Author:
Andrey Malykhanov
  • Constructor Details

    • IntersectionDescriptor

      public IntersectionDescriptor(Point intersectionPoint, double firstOperandRelativeOffset, double firstOperandAbsoluteOffset, double secondOperandRelativeOffset, double secondOperandAbsoluteOffset)
      Creates a new instance of intersection descriptor.
      Parameters:
      intersectionPoint - point of intersection
      firstOperandRelativeOffset - relative offset of the intersection on the first operand
      firstOperandAbsoluteOffset - absolute offset of the intersection on the first operand
      secondOperandRelativeOffset - relative offset of the intersection point on the second operand
      secondOperandAbsoluteOffset - absolute offset of the intersection point on the second operand
  • Method Details

    • getIntersectionPoint

      public Point getIntersectionPoint()
      Returns the intersection point.
      Returns:
      intersection point
    • getFirstOperandRelativeOffset

      public double getFirstOperandRelativeOffset()
      Returns the relative offset of the intersection point on the first operand.
      Returns:
      relative offset of the intersection on the first operand
    • getFirstOperandAbsoluteOffset

      public double getFirstOperandAbsoluteOffset()
      Returns the absolute offset of the intersection point on the first operand.
      Returns:
      absolute offset of the intersection on the first operand
    • getSecondOperandRelativeOffset

      public double getSecondOperandRelativeOffset()
      Returns the relative offset of the intersection point on the second operand.
      Returns:
      relative offset of the intersection on the second operand
    • getSecondOperandAbsoluteOffset

      public double getSecondOperandAbsoluteOffset()
      Returns the absolute offset of the intersection point on the second operand.
      Returns:
      absolute offset of the intersection on the second operand
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object arg0)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(IntersectionDescriptor intersectionDescriptor)
      Checks whether this intersection descriptor equals specified other intersection descriptor.
      Parameters:
      intersectionDescriptor - specified other intersection descriptor
      Returns:
      true if this intersection descriptor equals specified other intersection descriptor, false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toCodeString

      public String toCodeString()
      Returns the string representing Java code that creates this intersection descriptor in its current state.
      Returns:
      Java code required to create this intersection descriptor in its current state