## toxi.geom Class Ray2D

```java.lang.Object
toxi.geom.Vec2D
toxi.geom.Ray2D
```
All Implemented Interfaces:

`public class Ray2Dextends Vec2D`

A simple 2D ray datatype

Nested Class Summary

Nested classes/interfaces inherited from class toxi.geom.Vec2D
`Vec2D.Axis`

Field Summary

Fields inherited from class toxi.geom.Vec2D
`MAX_VALUE, MIN_VALUE, x, X_AXIS, y, Y_AXIS, ZERO`

Constructor Summary
`Ray2D()`

```Ray2D(float x, float y, ReadonlyVec2D d)```

```Ray2D(ReadonlyVec2D o, ReadonlyVec2D d)```

Method Summary
` Vec2D` `getDirection()`
Returns a copy of the ray's direction vector.
` float` `getDistanceToPoint(Vec2D p)`
Calculates the distance between the given point and the infinite line coinciding with this ray.
` Vec2D` `getPointAtDistance(float dist)`

` Ray2D` `setDirection(ReadonlyVec2D d)`
Uses a normalized copy of the given vector as the ray direction.
` Line2D` `toLine2DWithPointAtDistance(float dist)`
Converts the ray into a 2D Line segment with its start point coinciding with the ray origin and its other end point at the given distance along the ray.
` java.lang.String` `toString()`

Methods inherited from class toxi.geom.Vec2D
`abs, add, add, add, addSelf, addSelf, angleBetween, angleBetween, bisect, clear, compareTo, constrain, constrain, copy, cross, distanceTo, distanceToSquared, dot, equals, equalsWithTolerance, floor, frac, fromTheta, getAbs, getComponent, getComponent, getConstrained, getFloored, getFrac, getInverted, getLimited, getNormalized, getNormalizedTo, getPerpendicular, getReciprocal, getReflected, getRotated, getSignum, hashCode, heading, interpolateTo, interpolateTo, interpolateTo, interpolateTo, interpolateToSelf, interpolateToSelf, invert, isInCircle, isInRectangle, isInTriangle, isMajorAxis, isZeroVector, jitter, jitter, jitter, jitter, jitter, jitter, limit, magnitude, magSquared, max, max, maxSelf, min, min, minSelf, normalize, normalizeTo, perpendicular, randomVector, randomVector, reciprocal, reflect, rotate, roundToAxis, scale, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, set, set, set, setComponent, setComponent, signum, sub, sub, sub, subSelf, subSelf, tangentNormalOfEllipse, to3DXY, to3DXZ, to3DYZ, toArray, toCartesian, toPolar, x, y`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Ray2D

`public Ray2D()`

### Ray2D

```public Ray2D(float x,
float y,

### Ray2D

```public Ray2D(ReadonlyVec2D o,
Method Detail

### getDirection

`public Vec2D getDirection()`
Returns a copy of the ray's direction vector.

Returns:
vector

### getDistanceToPoint

`public float getDistanceToPoint(Vec2D p)`
Calculates the distance between the given point and the infinite line coinciding with this ray.

Parameters:
`p` -
Returns:
distance

### getPointAtDistance

`public Vec2D getPointAtDistance(float dist)`

### setDirection

`public Ray2D setDirection(ReadonlyVec2D d)`
Uses a normalized copy of the given vector as the ray direction.

Parameters:
`d` - new direction
Returns:
itself

### toLine2DWithPointAtDistance

`public Line2D toLine2DWithPointAtDistance(float dist)`
Converts the ray into a 2D Line segment with its start point coinciding with the ray origin and its other end point at the given distance along the ray.

Parameters:
`dist` - end point distance
Returns:
line segment

### toString

`public java.lang.String toString()`
Overrides:
`toString` in class `Vec2D`