Record Class Conversion

java.lang.Object
java.lang.Record
com.j3d.engine.math.convert.Conversion
Record Components:
scale - The scale factor such that a unit length is not a pixel. e.g. a value of 10.0 means a CartesianPoint unit length of 1, is about 10 pixels long.
size - The dimension of the screen which the points belong to. This is used to determine the centre for converting to and between CartesianPoint and knowing the maximum height and length of a ScreenPoint

public record Conversion(double scale, Dim size) extends Record
Generic conversion record which stores the conversion required to turn a CartesianPoint into a ScreenPoint and vice versa.

This is the simplified record which does not have an offset. See ConversionWithOffset

Author:
Lehlogonolo Poole
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final double
    The field for the scale record component.
    private final Dim
    The field for the size record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Conversion(double scale, Dim size)
    Creates an instance of a Conversion record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    static Conversion
    The global conversion properties specifically for the main draw panel EngineFrame.getDrawPanel()
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the scale record component.
    Returns the value of the size record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • scale

      private final double scale
      The field for the scale record component.
    • size

      private final Dim size
      The field for the size record component.
  • Constructor Details

    • Conversion

      public Conversion(double scale, Dim size)
      Creates an instance of a Conversion record class.
      Parameters:
      scale - the value for the scale record component
      size - the value for the size record component
  • Method Details

    • global

      public static Conversion global()
      The global conversion properties specifically for the main draw panel EngineFrame.getDrawPanel()

      These are defined as:

      • The setting the user defines as the scale within
        invalid @link
        {@link Settings#sceneProperties#scale
        }
      • The actual size of EngineFrame.getDrawPanel()

      Returns:
      The Converison properties of the main draw panel.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • scale

      public double scale()
      Returns the value of the scale record component.
      Returns:
      the value of the scale record component
    • size

      public Dim size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component