Package com.inductiveautomation.rm.base
Class RMSize
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.rm.base.RMSize
- All Implemented Interfaces:
RMPropertyChanger
,Cloneable
This class represents a simple geometric size (width, height).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabs()
Normalizes the receiver to positive values.boolean
equals
(double w, double h) Returns whether size is equal to given width and height.boolean
Standard equals implementation.double
Returns the square root of the sum of the squares of the width and height.void
negate()
Simply sets the width and height to their negatives.Normalizes the receiver by scaling its width and height such that its magnitude will be 1.toString()
Returns a string representation of size.Methods inherited from class com.inductiveautomation.rm.base.RMObject
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
Methods inherited from class com.inductiveautomation.rm.base.RMListenerList
addListener, clone, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
-
Field Details
-
width
public double width -
height
public double height
-
-
Constructor Details
-
RMSize
public RMSize()Creates a size initialized to 0,0. -
RMSize
public RMSize(double w, double h) Creates a size initialized to the given width and height. -
RMSize
Creates a size initialized to the given size. -
RMSize
Creates a size from a java2D dimension -
RMSize
Creates a size from a string (assumes comma separated).
-
-
Method Details
-
abs
Normalizes the receiver to positive values. -
magnitude
public double magnitude()Returns the square root of the sum of the squares of the width and height. -
normalize
Normalizes the receiver by scaling its width and height such that its magnitude will be 1. -
negate
public void negate()Simply sets the width and height to their negatives. -
equals
Standard equals implementation. -
equals
public boolean equals(double w, double h) Returns whether size is equal to given width and height. -
toString
Returns a string representation of size.
-