|
| Ray () |
|
| Ray (const Point3 &origin, const Vector3 &direction, float minDistance=0.0f, float maxDistance=finf()) |
|
| Ray (class BinaryInput &b) |
|
Ray | bumpedRay (float distance) const |
| Returns a new ray which has the same direction but an origin advanced along direction by distance. More...
|
|
Ray | bumpedRay (float distance, const Vector3 &bumpDirection) const |
| Returns a new ray which has the same direction but an origin advanced by distance * bumpDirection. More...
|
|
Point3 | closestPoint (const Point3 &point) const |
| Returns the closest point on the Ray to point. More...
|
|
void | deserialize (class BinaryInput &b) |
|
const Vector3 & | direction () const |
| Unit direction vector. More...
|
|
float | distance (const Point3 &point) const |
|
Returns the closest distance between point and the Ray More...
|
|
Point3 | intersection (const class Plane &plane) const |
|
Returns the point where the Ray and plane intersect. More...
|
|
float | intersectionTime (const class Sphere &sphere, bool solid=false) const |
|
Returns the distance until intersection with the sphere or the (solid) ball bounded by the sphere. More...
|
|
float | intersectionTime (const class Plane &plane) const |
|
float | intersectionTime (const class Box &box) const |
|
float | intersectionTime (const class AABox &box) const |
|
float | intersectionTime (const Vector3 &v0, const Vector3 &v1, const Vector3 &v2, const Vector3 &edge01, const Vector3 &edge02, float &w0, float &w1, float &w2) const |
|
The three extra arguments are the weights of vertices 0, 1, and 2 at the intersection point; they are useful for texture mapping and interpolated normals. More...
|
|
float | intersectionTime (const Point3 &vert0, const Point3 &vert1, const Point3 &vert2, const Vector3 &edge01, const Vector3 &edge02) const |
|
Ray-triangle intersection for a 1-sided triangle. More...
|
|
float | intersectionTime (const Point3 &vert0, const Point3 &vert1, const Point3 &vert2) const |
|
float | intersectionTime (const Point3 &vert0, const Point3 &vert1, const Point3 &vert2, float &w0, float &w1, float &w2) const |
|
float | intersectionTime (const Triangle &triangle) const |
|
float | intersectionTime (const Triangle &triangle, float &w0, float &w1, float &w2) const |
|
Vector3 | invDirection () const |
| Component-wise inverse of direction vector. More...
|
|
float | maxDistance () const |
|
float | minDistance () const |
|
const Point3 & | origin () const |
|
Ray | reflect (const Vector3 &newOrigin, const Vector3 &normal) const |
| Reflects about the normal using G3D::Vector3::reflectionDirection and bumps the ray slightly from the newOrigin. More...
|
|
Ray | refract (const Vector3 &newOrigin, const Vector3 &normal, float iInside, float iOutside) const |
| Refracts about the normal using G3D::Vector3::refractionDirection and bumps the ray slightly from the newOrigin. More...
|
|
void | serialize (class BinaryOutput &b) const |
|
void | set (const Point3 &origin, const Vector3 &direction, float minDistance=0.0f, float maxDistance=finf()) |
|
A 3D Ray, optionally limited to a positive subsegment of the ray.
- See also
- G3D::NativeTriTree::PrecomputedRay, G3D::LineSegment, G3D::Line
float G3D::Ray::intersectionTime |
( |
const class Sphere & |
sphere, |
|
|
bool |
solid = false |
|
) |
| const |
Returns the distance until intersection with the sphere or the (solid) ball bounded by the sphere.
Will be 0 if inside the sphere, inf if there is no intersection.
The ray direction is not normalized. If the ray direction has unit length, the distance from the origin to intersection is equal to the time. If the direction does not have unit length, the distance = time * direction.length().
See also the G3D::CollisionDetection "movingPoint" methods, which give more information about the intersection.
- Parameters
-
solid | If true, rays inside the sphere immediately intersect (good for collision detection). If false, they hit the opposite side of the sphere (good for ray tracing). |
Referenced by G3D::CollisionDetection::collisionTimeForMovingPointFixedTriangle(), and intersectionTime().