Package toxi.geom
Class Ray3D
java.lang.Object
toxi.geom.Vec3D
toxi.geom.Ray3D
- All Implemented Interfaces:
Comparable<ReadonlyVec3D>
,ReadonlyVec3D
A simple 3D ray datatype
-
Nested Class Summary
Nested classes/interfaces inherited from class toxi.geom.Vec3D
Vec3D.Axis
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRay3D()
Ray3D
(float x, float y, float z, ReadonlyVec3D d) Ray3D
(ReadonlyVec3D o, ReadonlyVec3D 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) Returns the point at the given distance on the ray.Uses a normalized copy of the given vector as the ray direction.toLine3DWithPointAtDistance
(float dist) Converts the ray into a 3D 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.Vec3D
abs, add, add, add, addSelf, addSelf, addSelf, angleBetween, angleBetween, clear, compareTo, constrain, constrain, copy, cross, cross, crossInto, crossSelf, distanceTo, distanceToSquared, dot, dot, equals, equals, equalsWithTolerance, floor, frac, fromXYTheta, fromXZTheta, fromYZTheta, getAbs, getCartesian, getClosestAxis, getComponent, getComponent, getConstrained, getFloored, getFrac, getInverted, getLimited, getMapped, getNormalized, getNormalizedTo, getReciprocal, getReflected, getRotatedAroundAxis, getRotatedX, getRotatedY, getRotatedZ, getRoundedTo, getSignum, getSpherical, hashCode, headingXY, headingXZ, headingYZ, immutable, interpolateTo, interpolateTo, interpolateTo, interpolateTo, interpolateToSelf, interpolateToSelf, invert, isInAABB, isInAABB, isMajorAxis, isZeroVector, jitter, jitter, jitter, jitter, jitter, jitter, limit, magnitude, magSquared, max, maxSelf, min, minSelf, modSelf, modSelf, normalize, normalizeTo, randomVector, randomVector, reciprocal, reflect, rotateAroundAxis, rotateX, rotateY, rotateZ, roundTo, scale, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, scaleSelf, set, set, set, setComponent, setComponent, setX, setXY, setY, setZ, shuffle, signum, snapToAxis, sub, sub, sub, subSelf, subSelf, subSelf, to2DXY, to2DXZ, to2DYZ, to4D, to4D, toArray, toArray4, toCartesian, toSpherical, x, y, z
-
Constructor Details
-
Ray3D
public Ray3D() -
Ray3D
-
Ray3D
-
-
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
Returns the point at the given distance on the ray. The distance can be any real number.- Parameters:
dist
-- Returns:
- vector
-
setDirection
Uses a normalized copy of the given vector as the ray direction.- Parameters:
d
- new direction- Returns:
- itself
-
setNormalizedDirection
-
toLine3DWithPointAtDistance
Converts the ray into a 3D 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
-