Package snap.geom
Class Size
java.lang.Object
snap.geom.Size
- All Implemented Interfaces:
Cloneable
A class to represent a simple geometric size.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Standard clone implementation.boolean
equals
(double w, double h) Returns whether size is equal to given width and height.static boolean
equals
(double x0, double y0, double x1, double y1) Standard equals implementation.boolean
Standard equals implementation.static Size
Creates a size from a string (assumes comma separated).double
Returns the height.double
Returns the square root of the sum of the squares of the width and height.double
getWidth()
Returns the width.void
negate()
Simply sets the width and height to their negatives.void
Normalizes the receiver by scaling its width and height such that its magnitude will be 1.void
setHeight
(double aValue) Sets the height.void
setSize
(double aW, double aH) Sets the size.void
setWidth
(double aValue) Sets the width.toString()
Standard toString implementation.
-
Field Details
-
width
public double width -
height
public double height
-
-
Constructor Details
-
Size
public Size()Create a new Size. -
Size
public Size(double aW, double aH) Create a new Size. -
Size
Create a new Size.
-
-
Method Details
-
getWidth
public double getWidth()Returns the width. -
setWidth
public void setWidth(double aValue) Sets the width. -
getHeight
public double getHeight()Returns the height. -
setHeight
public void setHeight(double aValue) Sets the height. -
setSize
public void setSize(double aW, double aH) Sets the size. -
getMagnitude
public double getMagnitude()Returns the square root of the sum of the squares of the width and height. -
normalize
public void 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
public boolean equals(double w, double h) Returns whether size is equal to given width and height. -
clone
Standard clone implementation. -
equals
Standard equals implementation. -
toString
Standard toString implementation. -
equals
public static boolean equals(double x0, double y0, double x1, double y1) Standard equals implementation. -
get
Creates a size from a string (assumes comma separated).
-