Record Class ConversionWithOffset
java.lang.Object
java.lang.Record
com.j3d.engine.math.convert.ConversionWithOffset
- 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 betweenCartesianPointand knowing the maximum height and length of aScreenPointoffset- The offset X and Y components to offset all points by. Generally speaking no conversion requires using offsetting unless they want panning the 2d view.
A specialisation of the
Conversion record which stores the conversion required to turn a
CartesianPoint into a ScreenPoint and vice versa.
Unlike Conversion, this stores an extra field, an Offset field such as to offset
all coordinates by a given delta.
- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConversionWithOffset(double scale, Dim size, Offset offset) Creates an instance of aConversionWithOffsetrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static ConversionWithOffsetfrom(Conversion conversion) Converts the givenConversionobject into aConversionWithOffsetinstance by passing an offset value ofOffset.ZERO, which is identical to it's original class as no offset is applied.final inthashCode()Returns a hash code value for this object.offset()Returns the value of theoffsetrecord component.doublescale()Returns the value of thescalerecord component.size()Returns the value of thesizerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
scale
private final double scaleThe field for thescalerecord component. -
size
-
offset
-
-
Constructor Details
-
ConversionWithOffset
-
-
Method Details
-
from
@NotNull @Contract("_ -> new") public static ConversionWithOffset from(@NotNull Conversion conversion) Converts the givenConversionobject into aConversionWithOffsetinstance by passing an offset value ofOffset.ZERO, which is identical to it's original class as no offset is applied.- Parameters:
conversion- The Conversion properties to convert- Returns:
- A ConversioNWithOffset which is functionally identical to the original
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
scale
-
size
-
offset
-