Package squidpony.squidmath
Class CoordDouble
java.lang.Object
squidpony.squidmath.CoordDouble
- All Implemented Interfaces:
- Serializable
public class CoordDouble extends Object implements Serializable
Coord using double values for x and y instead of int. Not pooled.
 When possible and you are using libGDX, use the 
Created by Tommy Ettinger on 8/12/2015.
com.badlogic.gdx.math.Vector2 class in preference to this
 one if you are OK with using floats instead of doubles.
 Created by Tommy Ettinger on 8/12/2015.
- See Also:
- Serialized Form
- 
Field Summary
- 
Constructor SummaryConstructors Constructor Description CoordDouble()CoordDouble(double x, double y)CoordDouble(Coord other)CoordDouble(CoordDouble other)
- 
Method SummaryModifier and Type Method Description CoordDoubleadd(double x, double y)CoordDoubleadd(CoordDouble other)CoordDoublecopy()Constructs an identical copy to this CoordDouble, making a new object that may be mutated independently.doublecross(CoordDouble other)Gets the cross product of this CoordDouble andother.doubledistance(double x2, double y2)doubledistance(CoordDouble co)doubledistanceSq(double x2, double y2)doubledistanceSq(CoordDouble co)CoordDoubledivide(double x, double y)Divides the x component of this CoordDouble byxand the y component byy.CoordDoubledivide(CoordDouble other)Divides the x component of this CoordDouble byother.xand the y component byother.y.doubledot(CoordDouble other)Gets the dot product of this CoordDouble andother.booleanequals(Object o)static CoordDoubleget(double x, double y)doublegetX()doublegetY()inthashCode()doublelength()Distance from the origin to this CoordDouble.doublelengthSq()Distance from the origin to this CoordDouble, squared.CoordDoublemultiply(double x, double y)CoordDoublemultiply(CoordDouble other)CoordDoubleset(double x, double y)CoordDoubleset(CoordDouble co)voidsetX(double x)voidsetY(double y)CoordDoublesubtract(double x, double y)CoordDoublesubtract(CoordDouble other)StringtoString()
- 
Field Details
- 
Constructor Details
- 
Method Details- 
get
- 
copyConstructs an identical copy to this CoordDouble, making a new object that may be mutated independently.- Returns:
- a copy of this CoordDouble
 
- 
add
- 
add
- 
subtract
- 
subtract
- 
multiply
- 
multiply
- 
divideDivides the x component of this CoordDouble byxand the y component byy. Be careful about when either of the parameters can be 0.0, since that can put NaN or infinite components in this.- Parameters:
- x- divisor for x
- y- divisor for y
 
- 
divideDivides the x component of this CoordDouble byother.xand the y component byother.y. Be careful about when either of other's components can be 0.0, since that can put NaN or infinite components in this.- Parameters:
- other- a non-null CoordDouble to get divisors from
 
- 
dotGets the dot product of this CoordDouble andother.- Parameters:
- other- another CoordDouble; must not be null.
- Returns:
- the dot product of this and other.
 
- 
crossGets the cross product of this CoordDouble andother.- Parameters:
- other- another CoordDouble; must not be null.
- Returns:
- the cross product of this and other.
 
- 
set
- 
set
- 
lengthDistance from the origin to this CoordDouble.- Returns:
- the distance from the origin to this CoordDouble.
 
- 
lengthSqDistance from the origin to this CoordDouble, squared.- Returns:
- the distance from the origin to this CoordDouble, squared.
 
- 
distance
- 
distance
- 
distanceSq
- 
distanceSq
- 
getX
- 
setX
- 
getY
- 
setY
- 
toString
- 
hashCode
- 
equals
 
-