Package toxi.geom
Class Ray2D
java.lang.Object
toxi.geom.Vec2D
toxi.geom.Ray2D
- All Implemented Interfaces:
Comparable<ReadonlyVec2D>
,ReadonlyVec2D
A simple 2D ray datatype
-
Nested Class Summary
Nested classes/interfaces inherited from class toxi.geom.Vec2D
Vec2D.Axis
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRay2D()
Ray2D
(float x, float y, ReadonlyVec2D d) Ray2D
(ReadonlyVec2D o, ReadonlyVec2D d) -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of the ray's direction vector.float
Calculates the distance between the given point and the infinite line coinciding with this ray.getPointAtDistance
(float dist) Uses a normalized copy of the given vector as the ray direction.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.toString()
Methods inherited from class toxi.geom.Vec2D
abs, add, add, add, addSelf, addSelf, angleBetween, angleBetween, bisect, clear, compareTo, constrain, constrain, constrain, copy, cross, distanceTo, distanceToSquared, dot, equals, equals, equalsWithTolerance, floor, frac, fromTheta, getAbs, getCartesian, getComponent, getComponent, getConstrained, getConstrained, getFloored, getFrac, getInverted, getLimited, getMapped, getNormalized, getNormalizedTo, getPerpendicular, getPolar, getReciprocal, getReflected, getRotated, getRoundedTo, 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, positiveHeading, randomVector, randomVector, reciprocal, reflect, rotate, roundTo, scale, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, set, set, set, setComponent, setComponent, setX, setY, signum, snapToAxis, sub, sub, sub, subSelf, subSelf, tangentNormalOfEllipse, to3DXY, to3DXZ, to3DYZ, toArray, toCartesian, toPolar, x, y
-
Constructor Details
-
Ray2D
public Ray2D() -
Ray2D
-
Ray2D
-
-
Method Details
-
getDirection
Returns a copy of the ray's direction vector.- Returns:
- vector
-
getDistanceToPoint
Calculates the distance between the given point and the infinite line coinciding with this ray.- Parameters:
p
-- Returns:
- distance
-
getPointAtDistance
-
setDirection
Uses a normalized copy of the given vector as the ray direction.- Parameters:
d
- new direction- Returns:
- itself
-
setNormalizedDirection
-
toLine2DWithPointAtDistance
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
-