Package com.io7m.jspatial.api
Class Ray2D
- java.lang.Object
-
- com.io7m.jspatial.api.Ray2D
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRay2D.BuilderBuilds instances of typeRay2D.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Ray2D.Builderbuilder()Creates a builder forRay2D.static Ray2DcopyOf(Ray2DType instance)Creates an immutable copy of aRay2DTypevalue.com.io7m.jtensors.core.unparameterized.vectors.Vector2Ddirection()com.io7m.jtensors.core.unparameterized.vectors.Vector2DdirectionInverse()booleanequals(java.lang.Object another)This instance is equal to all instances ofRay2Dthat have equal attribute values.inthashCode()Computes a hash code from attributes:origin,direction.static Ray2Dof(com.io7m.jtensors.core.unparameterized.vectors.Vector2D origin, com.io7m.jtensors.core.unparameterized.vectors.Vector2D direction)Construct a new immutableRay2Dinstance.com.io7m.jtensors.core.unparameterized.vectors.Vector2Dorigin()java.lang.StringtoString()Prints the immutable valueRay2Dwith attribute values.Ray2DwithDirection(com.io7m.jtensors.core.unparameterized.vectors.Vector2D value)Copy the current immutable object by setting a value for thedirectionattribute.Ray2DwithOrigin(com.io7m.jtensors.core.unparameterized.vectors.Vector2D value)Copy the current immutable object by setting a value for theoriginattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.jspatial.api.Ray2DType
intersectsArea
-
-
-
-
Method Detail
-
origin
public com.io7m.jtensors.core.unparameterized.vectors.Vector2D origin()
-
direction
public com.io7m.jtensors.core.unparameterized.vectors.Vector2D direction()
-
directionInverse
public com.io7m.jtensors.core.unparameterized.vectors.Vector2D directionInverse()
- Specified by:
directionInversein interfaceRay2DType- Returns:
- The inverted direction of this ray
-
withOrigin
public final Ray2D withOrigin(com.io7m.jtensors.core.unparameterized.vectors.Vector2D value)
Copy the current immutable object by setting a value for theoriginattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for origin- Returns:
- A modified copy of the
thisobject
-
withDirection
public final Ray2D withDirection(com.io7m.jtensors.core.unparameterized.vectors.Vector2D value)
Copy the current immutable object by setting a value for thedirectionattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for direction- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofRay2Dthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:origin,direction.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueRay2Dwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static Ray2D of(com.io7m.jtensors.core.unparameterized.vectors.Vector2D origin, com.io7m.jtensors.core.unparameterized.vectors.Vector2D direction)
Construct a new immutableRay2Dinstance.- Parameters:
origin- The value for theoriginattributedirection- The value for thedirectionattribute- Returns:
- An immutable Ray2D instance
-
copyOf
public static Ray2D copyOf(Ray2DType instance)
Creates an immutable copy of aRay2DTypevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Ray2D instance
-
builder
public static Ray2D.Builder builder()
Creates a builder forRay2D.- Returns:
- A new Ray2D builder
-
-