Package com.j3d.engine.math.convert
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
-
Constructor Details
-
Method Details
-
from
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
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. -
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. -
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 '=='. -
scale
public double scale()Returns the value of thescalerecord component.- Returns:
- the value of the
scalerecord component
-
size
Returns the value of thesizerecord component.- Returns:
- the value of the
sizerecord component
-
offset
Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-