#include <Ray.h>
|
void | set (const Point3 &origin, const Vector3 &direction) |
|
const Point3 & | origin () const |
|
const Vector3 & | direction () const |
|
const Vector3 & | invDirection () const |
|
| Ray () |
|
| Ray (const Point3 &origin, const Vector3 &direction) |
|
| Ray (class BinaryInput &b) |
|
void | serialize (class BinaryOutput &b) const |
|
void | deserialize (class BinaryInput &b) |
|
Ray | bumpedRay (float distance) const |
|
Ray | bumpedRay (float distance, const Vector3 &bumpDirection) const |
|
Point3 | closestPoint (const Point3 &point) const |
| Returns the closest point on the Ray to point. More...
|
|
float | distance (const Point3 &point) const |
|
Point3 | intersection (const class Plane &plane) const |
|
float | intersectionTime (const class Sphere &sphere, bool solid=false) const |
|
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 |
|
float | intersectionTime (const Point3 &vert0, const Point3 &vert1, const Point3 &vert2, const Vector3 &edge01, const Vector3 &edge02) const |
|
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 |
|
Ray | refract (const Vector3 &newOrigin, const Vector3 &normal, float iInside, float iOutside) const |
|
Ray | reflect (const Vector3 &newOrigin, const Vector3 &normal) const |
|
|
enum | Classification {
MMM,
MMP,
MPM,
MPP,
PMM,
PMP,
PPM,
PPP,
POO,
MOO,
OPO,
OMO,
OOP,
OOM,
OMM,
OMP,
OPM,
OPP,
MOM,
MOP,
POM,
POP,
MMO,
MPO,
PMO,
PPO
} |
|
The following are for the "ray slope" optimization from "Fast Ray / Axis-Aligned Bounding Box Overlap Tests using Ray Slopes" by Martin Eisemann, Thorsten Grosch, Stefan M��ller and Marcus Magnor Computer Graphics Lab, TU Braunschweig, Germany and University of Koblenz-Landau, Germany
Enumerator |
---|
MMM |
|
MMP |
|
MPM |
|
MPP |
|
PMM |
|
PMP |
|
PPM |
|
PPP |
|
POO |
|
MOO |
|
OPO |
|
OMO |
|
OOP |
|
OOM |
|
OMM |
|
OMP |
|
OPM |
|
OPP |
|
MOM |
|
MOP |
|
POM |
|
POP |
|
MMO |
|
MPO |
|
PMO |
|
PPO |
|
42 {
MMM,
MMP,
MPM,
MPP,
PMM,
PMP,
PPM,
PPP,
POO,
MOO,
OPO,
OMO,
OOP,
OOM,
OMM,
OMP,
OPM,
OPP,
MOM,
MOP,
POM,
POP,
MMO,
MPO,
PMO,
PPO};
static const Vector3 & unitX()
Definition: Vector3.cpp:121
static const Vector3 & zero()
Definition: Vector3.cpp:119
void set(const Point3 &origin, const Vector3 &direction)
Definition: Ray.cpp:18
- Parameters
-
direction | Assumed to have unit length |
void set(const Point3 &origin, const Vector3 &direction)
Definition: Ray.cpp:18
const Point3 & origin() const
Definition: Ray.h:56
const Vector3 & direction() const
Definition: Ray.h:61
void deserialize(class BinaryInput &b)
Definition: Ray.cpp:137
Ray G3D::Ray::bumpedRay |
( |
float |
distance | ) |
const |
|
inline |
Returns a new ray which has the same direction but an origin advanced along direction by distance
Ray()
Definition: Ray.h:70
Point3 m_origin
Definition: Ray.h:28
float distance(const Point3 &point) const
Definition: Ray.h:118
Vector3 m_direction
Definition: Ray.h:31
Ray G3D::Ray::bumpedRay |
( |
float |
distance, |
|
|
const Vector3 & |
bumpDirection |
|
) |
| const |
|
inline |
Returns a new ray which has the same direction but an origin advanced by distance * bumpDirection
Ray()
Definition: Ray.h:70
Point3 m_origin
Definition: Ray.h:28
float distance(const Point3 &point) const
Definition: Ray.h:118
Vector3 m_direction
Definition: Ray.h:31
Returns the closest point on the Ray to point.
float __fastcall dot(const Vector3 &rkVector) const
Definition: Vector3.h:771
Point3 m_origin
Definition: Ray.h:28
Vector3 m_direction
Definition: Ray.h:31
void deserialize(class BinaryInput &b)
Definition: Vector3.cpp:190
void set(const Point3 &origin, const Vector3 &direction)
Definition: Ray.cpp:18
Point3 m_origin
Definition: Ray.h:28
Vector3 m_direction
Definition: Ray.h:31
Unit direction vector.
Vector3 m_direction
Definition: Ray.h:31
Returns the closest distance between point and the Ray
Point3 closestPoint(const Point3 &point) const
Returns the closest point on the Ray to point.
Definition: Ray.h:106
Creates a Ray from a origin and a (nonzero) unit direction.
Ray()
Definition: Ray.h:70
const Vector3 & direction() const
Definition: Ray.h:61
Returns the point where the Ray and plane intersect. If there is no intersection, returns a point at infinity.
Planes are considered one-sided, so the ray will not intersect a plane where the normal faces in the traveling direction.
166 Vector3 normal = plane.normal();
167 plane.getEquation(normal, d);
float __fastcall dot(const Vector3 &rkVector) const
Definition: Vector3.h:771
Point3 m_origin
Definition: Ray.h:28
static const Vector3 & inf()
Definition: Vector3.cpp:124
Vector3 m_direction
Definition: Ray.h:31
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). |
static float collisionTimeForMovingPointFixedSphere(const Vector3 &point, const Vector3 &velocity, const class Sphere &sphere, Vector3 &outLocation, Vector3 &outNormal=ignore, bool solid=false)
Definition: CollisionDetection.cpp:977
Point3 m_origin
Definition: Ray.h:28
Vector3 m_direction
Definition: Ray.h:31
float G3D::Ray::intersectionTime |
( |
const class Plane & |
plane | ) |
const |
Point3 m_origin
Definition: Ray.h:28
static float collisionTimeForMovingPointFixedPlane(const Vector3 &point, const Vector3 &velocity, const class Plane &plane, Vector3 &outLocation, Vector3 &outNormal=ignore)
Definition: CollisionDetection.cpp:847
Vector3 m_direction
Definition: Ray.h:31
float G3D::Ray::intersectionTime |
( |
const class Box & |
box | ) |
const |
float finf()
Definition: g3dmath.cpp:71
Point3 m_origin
Definition: Ray.h:28
static float collisionTimeForMovingPointFixedBox(const Vector3 &point, const Vector3 &velocity, const class Box &box, Vector3 &outLocation, Vector3 &outNormal=ignore)
Definition: CollisionDetection.cpp:1176
Vector3 m_direction
Definition: Ray.h:31
float G3D::Ray::intersectionTime |
( |
const class AABox & |
box | ) |
const |
212 if ((time ==
finf()) && inside) {
float finf()
Definition: g3dmath.cpp:71
static float collisionTimeForMovingPointFixedAABox(const Vector3 &point, const Vector3 &velocity, const class AABox &box, Vector3 &outLocation, bool &inside=ignoreBool, Vector3 &outNormal=ignore)
Definition: CollisionDetection.cpp:1210
Point3 m_origin
Definition: Ray.h:28
Vector3 m_direction
Definition: Ray.h:31
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.
322 float tvec[3], pvec[3], qvec[3];
328 const float det =
DOT(edge1, pvec);
339 if ((u < 0.0f) || (u > det)) {
345 CROSS(qvec, tvec, edge1);
349 if ((v < 0.0f) || (u + v > det)) {
354 float t =
DOT(edge2, qvec);
357 const float inv_det = 1.0f / det;
float finf()
Definition: g3dmath.cpp:71
#define SUB(dest, v1, v2)
Definition: Ray.h:242
#define DOT(v1, v2)
Definition: Ray.h:240
#define CROSS(dest, v1, v2)
Definition: Ray.h:235
Point3 m_origin
Definition: Ray.h:28
#define EPSILON
Definition: Ray.h:234
Vector3 m_direction
Definition: Ray.h:31
Ray-triangle intersection for a 1-sided triangle. Fastest version. [http://www.acm.org/jgt/papers/MollerTrumbore97/] http://www.graphics.cornell.edu/pubs/1997/MT97.html
260 float tvec[3], pvec[3], qvec[3];
266 const float det =
DOT(edge1, pvec);
277 if ((u < 0.0f) || (u > det)) {
283 CROSS(qvec, tvec, edge1);
287 if ((v < 0.0f) || (u + v > det)) {
294 const float t =
DOT(edge2, qvec);
float finf()
Definition: g3dmath.cpp:71
#define SUB(dest, v1, v2)
Definition: Ray.h:242
#define DOT(v1, v2)
Definition: Ray.h:240
#define CROSS(dest, v1, v2)
Definition: Ray.h:235
Point3 m_origin
Definition: Ray.h:28
#define EPSILON
Definition: Ray.h:234
Vector3 m_direction
Definition: Ray.h:31
float intersectionTime(const class Sphere &sphere, bool solid=false) const
Definition: Ray.cpp:179
193 return intersectionTime(vert0, vert1, vert2, vert1 - vert0, vert2 - vert0, w0, w1, w2);
float intersectionTime(const class Sphere &sphere, bool solid=false) const
Definition: Ray.cpp:179
float G3D::Ray::intersectionTime |
( |
const Triangle & |
triangle | ) |
const |
|
inline |
float intersectionTime(const class Sphere &sphere, bool solid=false) const
Definition: Ray.cpp:179
float G3D::Ray::intersectionTime |
( |
const Triangle & |
triangle, |
|
|
float & |
w0, |
|
|
float & |
w1, |
|
|
float & |
w2 |
|
) |
| const |
|
inline |
float intersectionTime(const class Sphere &sphere, bool solid=false) const
Definition: Ray.cpp:179
Component-wise inverse of direction vector. May have inf() components
Vector3 m_invDirection
Definition: Ray.h:34
Point3 m_origin
Definition: Ray.h:28
Reflects about the normal using G3D::Vector3::reflectionDirection and bumps the ray slightly from the newOrigin.
160 return Ray(newOrigin + (D + normal) * 0.001f, D);
Ray()
Definition: Ray.h:70
Vector3 reflectionDirection(const Vector3 &normal) const
Definition: Vector3.cpp:315
Vector3 m_direction
Definition: Ray.h:31
Refracts about the normal using G3D::Vector3::refractionDirection and bumps the ray slightly from the newOrigin.
float __fastcall dot(const Vector3 &rkVector) const
Definition: Vector3.h:771
Vector3 refractionDirection(const Vector3 &normal, float iInside, float iOutside) const
Definition: Vector3.cpp:321
Ray()
Definition: Ray.h:70
double sign(double fValue)
Definition: g3dmath.h:669
Vector3 m_direction
Definition: Ray.h:31
void serialize(class BinaryOutput &b) const
Definition: Vector3.cpp:219
Point3 m_origin
Definition: Ray.h:28
Vector3 m_direction
Definition: Ray.h:31
- Parameters
-
direction | Assumed to have unit length |
float c_zy
Definition: Ray.h:50
float c_xy
Definition: Ray.h:50
float x
Definition: Vector3.h:62
float c_xz
Definition: Ray.h:50
Classification classification
Definition: Ray.h:44
float ibyk
Definition: Ray.h:47
float y
Definition: Vector3.h:62
#define debugAssert(exp)
Definition: debugAssert.h:160
float jbyi
Definition: Ray.h:47
float c_yx
Definition: Ray.h:50
float c_yz
Definition: Ray.h:50
Vector3 m_invDirection
Definition: Ray.h:34
float c_zx
Definition: Ray.h:50
float z
Definition: Vector3.h:62
float kbyj
Definition: Ray.h:47
Point3 m_origin
Definition: Ray.h:28
const Point3 & origin() const
Definition: Ray.h:56
float jbyk
Definition: Ray.h:47
float ibyj
Definition: Ray.h:47
float kbyi
Definition: Ray.h:47
static const Vector3 & one()
Definition: Vector3.cpp:120
bool isUnit() const
Definition: Vector3.h:805
const Vector3 & direction() const
Definition: Ray.h:61
Vector3 m_direction
Definition: Ray.h:31
The documentation for this class was generated from the following files: