diff options
Diffstat (limited to 'dev/MinGfx/docs/html/classmingfx_1_1_ray.html')
-rw-r--r-- | dev/MinGfx/docs/html/classmingfx_1_1_ray.html | 1378 |
1 files changed, 689 insertions, 689 deletions
diff --git a/dev/MinGfx/docs/html/classmingfx_1_1_ray.html b/dev/MinGfx/docs/html/classmingfx_1_1_ray.html index 0c5b500..32845ac 100644 --- a/dev/MinGfx/docs/html/classmingfx_1_1_ray.html +++ b/dev/MinGfx/docs/html/classmingfx_1_1_ray.html @@ -1,689 +1,689 @@ -<!-- HTML header for doxygen 1.8.9.1--> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> -<meta http-equiv="X-UA-Compatible" content="IE=9"/> -<meta name="generator" content="Doxygen 1.9.1"/> -<title>MinGfx Toolkit: mingfx::Ray Class Reference</title> -<link href="tabs.css" rel="stylesheet" type="text/css"/> -<script type="text/javascript" src="jquery.js"></script> -<script type="text/javascript" src="dynsections.js"></script> -<link href="search/search.css" rel="stylesheet" type="text/css"/> -<script type="text/javascript" src="search/searchdata.js"></script> -<script type="text/javascript" src="search/search.js"></script> -<script type="text/x-mathjax-config"> - MathJax.Hub.Config({ - extensions: ["tex2jax.js"], - jax: ["input/TeX","output/HTML-CSS"], -}); -</script> -<script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> -<link href="doxygen.css" rel="stylesheet" type="text/css" /> -<link href="customdoxygen.css" rel="stylesheet" type="text/css"/> -</head> -<body> -<div id="top"><!-- do not remove this div, it is closed by doxygen! --> -<div id="titlearea"> -<table cellspacing="0" cellpadding="0"> - <tbody> - <tr style="height: 56px;"> - <td style="padding-left: 0.5em;"> - <div id="projectname">MinGfx Toolkit -  <span id="projectnumber">1.0</span> - </div> - <div id="projectbrief">A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.</div> - </td> - </tr> - </tbody> -</table> -</div> -<!-- end header part --> -<!-- Generated by Doxygen 1.9.1 --> -<script type="text/javascript"> -/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ -var searchBox = new SearchBox("searchBox", "search",false,'Search','.html'); -/* @license-end */ -</script> -<script type="text/javascript" src="menudata.js"></script> -<script type="text/javascript" src="menu.js"></script> -<script type="text/javascript"> -/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ -$(function() { - initMenu('',true,false,'search.php','Search'); - $(document).ready(function() { init_search(); }); -}); -/* @license-end */</script> -<div id="main-nav"></div> -<!-- window showing the filter options --> -<div id="MSearchSelectWindow" - onmouseover="return searchBox.OnSearchSelectShow()" - onmouseout="return searchBox.OnSearchSelectHide()" - onkeydown="return searchBox.OnSearchSelectKey(event)"> -</div> - -<!-- iframe showing the search results (closed by default) --> -<div id="MSearchResultsWindow"> -<iframe src="javascript:void(0)" frameborder="0" - name="MSearchResults" id="MSearchResults"> -</iframe> -</div> - -<div id="nav-path" class="navpath"> - <ul> -<li class="navelem"><a class="el" href="namespacemingfx.html">mingfx</a></li><li class="navelem"><a class="el" href="classmingfx_1_1_ray.html">Ray</a></li> </ul> -</div> -</div><!-- top --> -<div class="header"> - <div class="summary"> -<a href="#pub-methods">Public Member Functions</a> | -<a href="classmingfx_1_1_ray-members.html">List of all members</a> </div> - <div class="headertitle"> -<div class="title">mingfx::Ray Class Reference</div> </div> -</div><!--header--> -<div class="contents"> -<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> -<div class="textblock"><p>Stores the mathematical object of a ray that begins at an origin (a 3D point) and points in a direction (a unit 3D vector). </p> -<p>Rays can intersect a variety of other computer graphics objects, such as planes, triangles, spheres, 3D meshes, etc. These intersections can be tested with the Intersect...() methods. The <a class="el" href="classmingfx_1_1_ray.html" title="Stores the mathematical object of a ray that begins at an origin (a 3D point) and points in a directi...">Ray</a> can also be transformed by a <a class="el" href="classmingfx_1_1_matrix4.html" title="A 4x4 transformation matrix stored internally as an array of floats in column-major order so as to be...">Matrix4</a>. Example: </p><div class="fragment"><div class="line"><span class="comment">// Create a pick ray from the mouse position</span></div> -<div class="line"><span class="keywordtype">void</span> MyGraphicsApp::OnLeftMouseDown(<span class="keyword">const</span> Point2 &pos) {</div> -<div class="line"> Point2 mouse_xy = PixelsToNormalizedDeviceCoords(pos);</div> -<div class="line"> <span class="keywordtype">float</span> mouse_z = ReadZValueAtPixel(pos);</div> -<div class="line"> Point3 mouse_3d = <a class="code" href="classmingfx_1_1_gfx_math.html#a2086a2f885f887fb53da8a5adb5860f0">GfxMath::ScreenToNearPlane</a>(view_matrix, proj_matrix, mouse_xy, mouse_z);</div> -<div class="line"> Matrix4 camera_matrix = view_matrix.Inverse();</div> -<div class="line"> Point3 eye = camera_matrix.ColumnToPoint3(3);</div> -<div class="line"> </div> -<div class="line"> <a class="code" href="classmingfx_1_1_ray.html#aee3fe586869e00ae657a74bb4bbbbfda">Ray</a> pick_ray(eye, mouse_3d - eye);</div> -<div class="line"> </div> -<div class="line"> <span class="comment">// check to see if the ray intersects a sphere</span></div> -<div class="line"> <span class="keywordtype">float</span> t;</div> -<div class="line"> Point3 p;</div> -<div class="line"> <span class="keywordflow">if</span> (pick_ray.IntersectSphere(Point3(0,0,0), 2.0, &t, &p)) {</div> -<div class="line"> std::cout << <span class="stringliteral">"Mouse pointing at sphere! Intersection point = "</span> << p << std::endl;</div> -<div class="line"> }</div> -<div class="line">}</div> -<div class="ttc" id="aclassmingfx_1_1_gfx_math_html_a2086a2f885f887fb53da8a5adb5860f0"><div class="ttname"><a href="classmingfx_1_1_gfx_math.html#a2086a2f885f887fb53da8a5adb5860f0">mingfx::GfxMath::ScreenToNearPlane</a></div><div class="ttdeci">static Point3 ScreenToNearPlane(const Matrix4 &viewMatrix, const Matrix4 &projMatrix, const Point2 &normalizedScreenPt)</div><div class="ttdoc">Converts a 2D point on the filmplane represented in Normalized Device Coorindates,...</div></div> -<div class="ttc" id="aclassmingfx_1_1_ray_html_aee3fe586869e00ae657a74bb4bbbbfda"><div class="ttname"><a href="classmingfx_1_1_ray.html#aee3fe586869e00ae657a74bb4bbbbfda">mingfx::Ray::Ray</a></div><div class="ttdeci">Ray()</div><div class="ttdoc">Defaults to a ray at the origin and pointing in the -Z direction.</div></div> -</div><!-- fragment --> -<p class="definition">Definition at line <a class="el" href="ray_8h_source.html#l00054">54</a> of file <a class="el" href="ray_8h_source.html">ray.h</a>.</p> -</div> -<p><code>#include <<a class="el" href="ray_8h_source.html">ray.h</a>></code></p> -<table class="memberdecls"> -<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> -Public Member Functions</h2></td></tr> -<tr class="memitem:aee3fe586869e00ae657a74bb4bbbbfda"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#aee3fe586869e00ae657a74bb4bbbbfda">Ray</a> ()</td></tr> -<tr class="memdesc:aee3fe586869e00ae657a74bb4bbbbfda"><td class="mdescLeft"> </td><td class="mdescRight">Defaults to a ray at the origin and pointing in the -Z direction. <a href="classmingfx_1_1_ray.html#aee3fe586869e00ae657a74bb4bbbbfda">More...</a><br /></td></tr> -<tr class="separator:aee3fe586869e00ae657a74bb4bbbbfda"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:ab38cdd0793b3acfe55fa9ebca5ddebf6"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#ab38cdd0793b3acfe55fa9ebca5ddebf6">Ray</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &<a class="el" href="classmingfx_1_1_ray.html#a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe">origin</a>, const <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> &<a class="el" href="classmingfx_1_1_ray.html#a7b7826730a410c10be00122c99fe6dbe">direction</a>)</td></tr> -<tr class="memdesc:ab38cdd0793b3acfe55fa9ebca5ddebf6"><td class="mdescLeft"> </td><td class="mdescRight">Creates a ray from a 3D origin and direction. <a href="classmingfx_1_1_ray.html#ab38cdd0793b3acfe55fa9ebca5ddebf6">More...</a><br /></td></tr> -<tr class="separator:ab38cdd0793b3acfe55fa9ebca5ddebf6"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:ac20909f30c07d5375598876c6d294625"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#ac20909f30c07d5375598876c6d294625">~Ray</a> ()</td></tr> -<tr class="memdesc:ac20909f30c07d5375598876c6d294625"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classmingfx_1_1_ray.html" title="Stores the mathematical object of a ray that begins at an origin (a 3D point) and points in a directi...">Ray</a> destructor. <a href="classmingfx_1_1_ray.html#ac20909f30c07d5375598876c6d294625">More...</a><br /></td></tr> -<tr class="separator:ac20909f30c07d5375598876c6d294625"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a87b07c4f7c9f33189efade7e519b5d9d"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a87b07c4f7c9f33189efade7e519b5d9d">operator==</a> (const <a class="el" href="classmingfx_1_1_ray.html">Ray</a> &other) const</td></tr> -<tr class="memdesc:a87b07c4f7c9f33189efade7e519b5d9d"><td class="mdescLeft"> </td><td class="mdescRight">Check for "equality", taking floating point imprecision into account. <a href="classmingfx_1_1_ray.html#a87b07c4f7c9f33189efade7e519b5d9d">More...</a><br /></td></tr> -<tr class="separator:a87b07c4f7c9f33189efade7e519b5d9d"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:ab62fa6ea1c20870f67c58401aefe3eff"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#ab62fa6ea1c20870f67c58401aefe3eff">operator!=</a> (const <a class="el" href="classmingfx_1_1_ray.html">Ray</a> &other) const</td></tr> -<tr class="memdesc:ab62fa6ea1c20870f67c58401aefe3eff"><td class="mdescLeft"> </td><td class="mdescRight">Check for "inequality", taking floating point imprecision into account. <a href="classmingfx_1_1_ray.html#ab62fa6ea1c20870f67c58401aefe3eff">More...</a><br /></td></tr> -<tr class="separator:ab62fa6ea1c20870f67c58401aefe3eff"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a3c926e2da6dfd1b0a435577617eae984"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a3c926e2da6dfd1b0a435577617eae984">Length</a> () const</td></tr> -<tr class="memdesc:a3c926e2da6dfd1b0a435577617eae984"><td class="mdescLeft"> </td><td class="mdescRight">Returns the length of the direction vector. <a href="classmingfx_1_1_ray.html#a3c926e2da6dfd1b0a435577617eae984">More...</a><br /></td></tr> -<tr class="separator:a3c926e2da6dfd1b0a435577617eae984"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a8707604031eb9437c449345d85d69d24"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a8707604031eb9437c449345d85d69d24">IntersectPlane</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &planePt, const <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> &planeNormal, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint) const</td></tr> -<tr class="memdesc:a8707604031eb9437c449345d85d69d24"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a plane defined by a point and a normal. <a href="classmingfx_1_1_ray.html#a8707604031eb9437c449345d85d69d24">More...</a><br /></td></tr> -<tr class="separator:a8707604031eb9437c449345d85d69d24"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a1a6130616c4e4eebe9d09181b0f8b734"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a1a6130616c4e4eebe9d09181b0f8b734">IntersectTriangle</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v1, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v2, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v3, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint) const</td></tr> -<tr class="memdesc:a1a6130616c4e4eebe9d09181b0f8b734"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a triangle defined by the vertices v1, v2, and v3. <a href="classmingfx_1_1_ray.html#a1a6130616c4e4eebe9d09181b0f8b734">More...</a><br /></td></tr> -<tr class="separator:a1a6130616c4e4eebe9d09181b0f8b734"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a37689523a0b73d3d3288ce60bdcb7ae3"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a37689523a0b73d3d3288ce60bdcb7ae3">IntersectQuad</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v1, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v2, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v3, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v4, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint) const</td></tr> -<tr class="memdesc:a37689523a0b73d3d3288ce60bdcb7ae3"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a quad defined by the vertices v1, v2, v3, and v4. <a href="classmingfx_1_1_ray.html#a37689523a0b73d3d3288ce60bdcb7ae3">More...</a><br /></td></tr> -<tr class="separator:a37689523a0b73d3d3288ce60bdcb7ae3"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a970c7dbc19167be625967fabfb39b4ff"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a970c7dbc19167be625967fabfb39b4ff">IntersectSphere</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &center, float radius, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint) const</td></tr> -<tr class="memdesc:a970c7dbc19167be625967fabfb39b4ff"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a sphere defined by a center point and a radius. <a href="classmingfx_1_1_ray.html#a970c7dbc19167be625967fabfb39b4ff">More...</a><br /></td></tr> -<tr class="separator:a970c7dbc19167be625967fabfb39b4ff"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a79caa1df0839d13339575d3d5527ae6f"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a79caa1df0839d13339575d3d5527ae6f">IntersectMesh</a> (const <a class="el" href="classmingfx_1_1_mesh.html">Mesh</a> &mesh, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint, int *iTriangleID) const</td></tr> -<tr class="memdesc:a79caa1df0839d13339575d3d5527ae6f"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a triangle mesh. <a href="classmingfx_1_1_ray.html#a79caa1df0839d13339575d3d5527ae6f">More...</a><br /></td></tr> -<tr class="separator:a79caa1df0839d13339575d3d5527ae6f"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:ac90097090f0f8f49db13f6f232712afc"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#ac90097090f0f8f49db13f6f232712afc">FastIntersectMesh</a> (<a class="el" href="classmingfx_1_1_mesh.html">Mesh</a> *mesh, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint, int *iTriangleID) const</td></tr> -<tr class="memdesc:ac90097090f0f8f49db13f6f232712afc"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a triangle mesh. <a href="classmingfx_1_1_ray.html#ac90097090f0f8f49db13f6f232712afc">More...</a><br /></td></tr> -<tr class="separator:ac90097090f0f8f49db13f6f232712afc"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a57d3ee10518ed361ae02d9cbdef842b7"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a57d3ee10518ed361ae02d9cbdef842b7">IntersectAABB</a> (const <a class="el" href="classmingfx_1_1_a_a_b_b.html">AABB</a> &box, float *iTime) const</td></tr> -<tr class="memdesc:a57d3ee10518ed361ae02d9cbdef842b7"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects an <a class="el" href="classmingfx_1_1_a_a_b_b.html" title="A 3D axis-aligned bounding box defined by two corners (min and max).">AABB</a> (Axis-Aligned Bounding Box). <a href="classmingfx_1_1_ray.html#a57d3ee10518ed361ae02d9cbdef842b7">More...</a><br /></td></tr> -<tr class="separator:a57d3ee10518ed361ae02d9cbdef842b7"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe">origin</a> () const</td></tr> -<tr class="memdesc:a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe"><td class="mdescLeft"> </td><td class="mdescRight">Returns the origin. <a href="classmingfx_1_1_ray.html#a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe">More...</a><br /></td></tr> -<tr class="separator:a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a7b7826730a410c10be00122c99fe6dbe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a7b7826730a410c10be00122c99fe6dbe">direction</a> () const</td></tr> -<tr class="memdesc:a7b7826730a410c10be00122c99fe6dbe"><td class="mdescLeft"> </td><td class="mdescRight">Returns the direction. <a href="classmingfx_1_1_ray.html#a7b7826730a410c10be00122c99fe6dbe">More...</a><br /></td></tr> -<tr class="separator:a7b7826730a410c10be00122c99fe6dbe"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a75593293307b4eead15a876bf3597071"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a75593293307b4eead15a876bf3597071">set</a> (<a class="el" href="classmingfx_1_1_point3.html">Point3</a> newOrigin, <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> newDir)</td></tr> -<tr class="memdesc:a75593293307b4eead15a876bf3597071"><td class="mdescLeft"> </td><td class="mdescRight">Sets a new origin and direction. <a href="classmingfx_1_1_ray.html#a75593293307b4eead15a876bf3597071">More...</a><br /></td></tr> -<tr class="separator:a75593293307b4eead15a876bf3597071"><td class="memSeparator" colspan="2"> </td></tr> -</table> -<h2 class="groupheader">Constructor & Destructor Documentation</h2> -<a id="aee3fe586869e00ae657a74bb4bbbbfda"></a> -<h2 class="memtitle"><span class="permalink"><a href="#aee3fe586869e00ae657a74bb4bbbbfda">◆ </a></span>Ray() <span class="overload">[1/2]</span></h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">mingfx::Ray::Ray </td> - <td>(</td> - <td class="paramname"></td><td>)</td> - <td></td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Defaults to a ray at the origin and pointing in the -Z direction. </p> - -</div> -</div> -<a id="ab38cdd0793b3acfe55fa9ebca5ddebf6"></a> -<h2 class="memtitle"><span class="permalink"><a href="#ab38cdd0793b3acfe55fa9ebca5ddebf6">◆ </a></span>Ray() <span class="overload">[2/2]</span></h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">mingfx::Ray::Ray </td> - <td>(</td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>origin</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> & </td> - <td class="paramname"><em>direction</em> </td> - </tr> - <tr> - <td></td> - <td>)</td> - <td></td><td></td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Creates a ray from a 3D origin and direction. </p> - -</div> -</div> -<a id="ac20909f30c07d5375598876c6d294625"></a> -<h2 class="memtitle"><span class="permalink"><a href="#ac20909f30c07d5375598876c6d294625">◆ </a></span>~Ray()</h2> - -<div class="memitem"> -<div class="memproto"> -<table class="mlabels"> - <tr> - <td class="mlabels-left"> - <table class="memname"> - <tr> - <td class="memname">virtual mingfx::Ray::~Ray </td> - <td>(</td> - <td class="paramname"></td><td>)</td> - <td></td> - </tr> - </table> - </td> - <td class="mlabels-right"> -<span class="mlabels"><span class="mlabel">virtual</span></span> </td> - </tr> -</table> -</div><div class="memdoc"> - -<p><a class="el" href="classmingfx_1_1_ray.html" title="Stores the mathematical object of a ray that begins at an origin (a 3D point) and points in a directi...">Ray</a> destructor. </p> - -</div> -</div> -<h2 class="groupheader">Member Function Documentation</h2> -<a id="a7b7826730a410c10be00122c99fe6dbe"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a7b7826730a410c10be00122c99fe6dbe">◆ </a></span>direction()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname"><a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> mingfx::Ray::direction </td> - <td>(</td> - <td class="paramname"></td><td>)</td> - <td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Returns the direction. </p> - -</div> -</div> -<a id="ac90097090f0f8f49db13f6f232712afc"></a> -<h2 class="memtitle"><span class="permalink"><a href="#ac90097090f0f8f49db13f6f232712afc">◆ </a></span>FastIntersectMesh()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">bool mingfx::Ray::FastIntersectMesh </td> - <td>(</td> - <td class="paramtype"><a class="el" href="classmingfx_1_1_mesh.html">Mesh</a> * </td> - <td class="paramname"><em>mesh</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">float * </td> - <td class="paramname"><em>iTime</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td> - <td class="paramname"><em>iPoint</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">int * </td> - <td class="paramname"><em>iTriangleID</em> </td> - </tr> - <tr> - <td></td> - <td>)</td> - <td></td><td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Checks to see if the ray intersects a triangle mesh. </p> -<p>This uses a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a> (Bounding Volume Hierarchy) to accelerate the ray-triangle intersection tests. Each mesh can optionally store a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a>. If a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a> has already been calculated for the mesh (done with Mesh::CalculateBVH()), then this function will be much faster than the brute-force <a class="el" href="classmingfx_1_1_ray.html#a79caa1df0839d13339575d3d5527ae6f" title="Checks to see if the ray intersects a triangle mesh.">IntersectMesh()</a> function. If a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a> has not already been calculated for the mesh, the first call to <a class="el" href="classmingfx_1_1_ray.html#ac90097090f0f8f49db13f6f232712afc" title="Checks to see if the ray intersects a triangle mesh.">FastIntersectMesh()</a> will trigger the mesh to create a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a> (not a fast operation) but then subsequent calls to <a class="el" href="classmingfx_1_1_ray.html#ac90097090f0f8f49db13f6f232712afc" title="Checks to see if the ray intersects a triangle mesh.">FastIntersectMesh()</a> will be fast. </p> - -</div> -</div> -<a id="a57d3ee10518ed361ae02d9cbdef842b7"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a57d3ee10518ed361ae02d9cbdef842b7">◆ </a></span>IntersectAABB()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">bool mingfx::Ray::IntersectAABB </td> - <td>(</td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_a_a_b_b.html">AABB</a> & </td> - <td class="paramname"><em>box</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">float * </td> - <td class="paramname"><em>iTime</em> </td> - </tr> - <tr> - <td></td> - <td>)</td> - <td></td><td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Checks to see if the ray intersects an <a class="el" href="classmingfx_1_1_a_a_b_b.html" title="A 3D axis-aligned bounding box defined by two corners (min and max).">AABB</a> (Axis-Aligned Bounding Box). </p> -<p>Typically, this is the first step of a more detailed intersection test and we don't care about the actual point of intersection, just whether it intersects or not. So, we don't bother calculating the iPoint. We get the iTime for free though, so we do return that. You can calc the iPoint if you want using: </p><div class="fragment"><div class="line"><span class="keywordtype">float</span> t;</div> -<div class="line"><span class="keywordflow">if</span> (ray.IntersectAABB(box, &t)) {</div> -<div class="line"> Point3 iPoint = ray.origin() + t*ray.direction();</div> -<div class="line">}</div> -</div><!-- fragment --> -</div> -</div> -<a id="a79caa1df0839d13339575d3d5527ae6f"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a79caa1df0839d13339575d3d5527ae6f">◆ </a></span>IntersectMesh()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">bool mingfx::Ray::IntersectMesh </td> - <td>(</td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_mesh.html">Mesh</a> & </td> - <td class="paramname"><em>mesh</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">float * </td> - <td class="paramname"><em>iTime</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td> - <td class="paramname"><em>iPoint</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">int * </td> - <td class="paramname"><em>iTriangleID</em> </td> - </tr> - <tr> - <td></td> - <td>)</td> - <td></td><td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Checks to see if the ray intersects a triangle mesh. </p> -<p>This is a brute-force check over each triangle in the mesh. If there was an intersection, true is returned, iTime is set to the intersection time, iPoint is set to the intersection point, and iTriangleID is set to the ID of the closest intersected triangle along the ray. </p> - -</div> -</div> -<a id="a8707604031eb9437c449345d85d69d24"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a8707604031eb9437c449345d85d69d24">◆ </a></span>IntersectPlane()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">bool mingfx::Ray::IntersectPlane </td> - <td>(</td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>planePt</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> & </td> - <td class="paramname"><em>planeNormal</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">float * </td> - <td class="paramname"><em>iTime</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td> - <td class="paramname"><em>iPoint</em> </td> - </tr> - <tr> - <td></td> - <td>)</td> - <td></td><td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Checks to see if the ray intersects a plane defined by a point and a normal. </p> -<p>If there was an intersection, true is returned, iTime is set to the intersection time, and iPoint is set to the intersection point. The plane is considered to be 1-sided. That is the intersection will only occur if the ray hits the plane from its front side as determined by the plane's normal. </p> - -</div> -</div> -<a id="a37689523a0b73d3d3288ce60bdcb7ae3"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a37689523a0b73d3d3288ce60bdcb7ae3">◆ </a></span>IntersectQuad()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">bool mingfx::Ray::IntersectQuad </td> - <td>(</td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>v1</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>v2</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>v3</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>v4</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">float * </td> - <td class="paramname"><em>iTime</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td> - <td class="paramname"><em>iPoint</em> </td> - </tr> - <tr> - <td></td> - <td>)</td> - <td></td><td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Checks to see if the ray intersects a quad defined by the vertices v1, v2, v3, and v4. </p> -<p>The vertices must be provided in counter-clockwise order so that the normal of the triangle can be determined via the right-hand rule. The intersection will only happen if the ray hits the front side of the triangle. If there was an intersection, true is returned, iTime is set to the intersection time, and iPoint is set to the intersection point. </p> - -</div> -</div> -<a id="a970c7dbc19167be625967fabfb39b4ff"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a970c7dbc19167be625967fabfb39b4ff">◆ </a></span>IntersectSphere()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">bool mingfx::Ray::IntersectSphere </td> - <td>(</td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>center</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">float </td> - <td class="paramname"><em>radius</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">float * </td> - <td class="paramname"><em>iTime</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td> - <td class="paramname"><em>iPoint</em> </td> - </tr> - <tr> - <td></td> - <td>)</td> - <td></td><td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Checks to see if the ray intersects a sphere defined by a center point and a radius. </p> -<p>If there was an intersection, true is returned, iTime is set to the intersection time, and iPoint is set to the intersection point. </p> - -</div> -</div> -<a id="a1a6130616c4e4eebe9d09181b0f8b734"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a1a6130616c4e4eebe9d09181b0f8b734">◆ </a></span>IntersectTriangle()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">bool mingfx::Ray::IntersectTriangle </td> - <td>(</td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>v1</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>v2</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td> - <td class="paramname"><em>v3</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype">float * </td> - <td class="paramname"><em>iTime</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td> - <td class="paramname"><em>iPoint</em> </td> - </tr> - <tr> - <td></td> - <td>)</td> - <td></td><td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Checks to see if the ray intersects a triangle defined by the vertices v1, v2, and v3. </p> -<p>The vertices must be provided in counter-clockwise order so that the normal of the triangle can be determined via the right-hand rule. The intersection will only happen if the ray hits the front side of the triangle. If there was an intersection, true is returned, iTime is set to the intersection time, and iPoint is set to the intersection point. </p> - -</div> -</div> -<a id="a3c926e2da6dfd1b0a435577617eae984"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a3c926e2da6dfd1b0a435577617eae984">◆ </a></span>Length()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">float mingfx::Ray::Length </td> - <td>(</td> - <td class="paramname"></td><td>)</td> - <td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Returns the length of the direction vector. </p> - -</div> -</div> -<a id="ab62fa6ea1c20870f67c58401aefe3eff"></a> -<h2 class="memtitle"><span class="permalink"><a href="#ab62fa6ea1c20870f67c58401aefe3eff">◆ </a></span>operator!=()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">bool mingfx::Ray::operator!= </td> - <td>(</td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_ray.html">Ray</a> & </td> - <td class="paramname"><em>other</em></td><td>)</td> - <td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Check for "inequality", taking floating point imprecision into account. </p> - -</div> -</div> -<a id="a87b07c4f7c9f33189efade7e519b5d9d"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a87b07c4f7c9f33189efade7e519b5d9d">◆ </a></span>operator==()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">bool mingfx::Ray::operator== </td> - <td>(</td> - <td class="paramtype">const <a class="el" href="classmingfx_1_1_ray.html">Ray</a> & </td> - <td class="paramname"><em>other</em></td><td>)</td> - <td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Check for "equality", taking floating point imprecision into account. </p> - -</div> -</div> -<a id="a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe">◆ </a></span>origin()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> mingfx::Ray::origin </td> - <td>(</td> - <td class="paramname"></td><td>)</td> - <td> const</td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Returns the origin. </p> - -</div> -</div> -<a id="a75593293307b4eead15a876bf3597071"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a75593293307b4eead15a876bf3597071">◆ </a></span>set()</h2> - -<div class="memitem"> -<div class="memproto"> - <table class="memname"> - <tr> - <td class="memname">void mingfx::Ray::set </td> - <td>(</td> - <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> </td> - <td class="paramname"><em>newOrigin</em>, </td> - </tr> - <tr> - <td class="paramkey"></td> - <td></td> - <td class="paramtype"><a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> </td> - <td class="paramname"><em>newDir</em> </td> - </tr> - <tr> - <td></td> - <td>)</td> - <td></td><td></td> - </tr> - </table> -</div><div class="memdoc"> - -<p>Sets a new origin and direction. </p> - -</div> -</div> -<hr/>The documentation for this class was generated from the following file:<ul> -<li>src/<a class="el" href="ray_8h_source.html">ray.h</a></li> -</ul> -</div><!-- contents --> -<!-- HTML footer for doxygen 1.8.9.1--> -<!-- start footer part --> -<hr class="footer"/><address class="footer"><small> -Generated by  <a href="http://www.doxygen.org/index.html"> -<img class="footer" src="doxygen.png" alt="doxygen"/> -</a> 1.9.1 -</small></address> -</body> -</html> +<!-- HTML header for doxygen 1.8.9.1-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.9.1"/>
+<title>MinGfx Toolkit: mingfx::Ray Class Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/searchdata.js"></script>
+<script type="text/javascript" src="search/search.js"></script>
+<script type="text/x-mathjax-config">
+ MathJax.Hub.Config({
+ extensions: ["tex2jax.js"],
+ jax: ["input/TeX","output/HTML-CSS"],
+});
+</script>
+<script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">MinGfx Toolkit
+  <span id="projectnumber">1.0</span>
+ </div>
+ <div id="projectbrief">A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.9.1 -->
+<script type="text/javascript">
+/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
+var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
+/* @license-end */
+</script>
+<script type="text/javascript" src="menudata.js"></script>
+<script type="text/javascript" src="menu.js"></script>
+<script type="text/javascript">
+/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
+$(function() {
+ initMenu('',true,false,'search.php','Search');
+ $(document).ready(function() { init_search(); });
+});
+/* @license-end */</script>
+<div id="main-nav"></div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+</div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<div id="nav-path" class="navpath">
+ <ul>
+<li class="navelem"><a class="el" href="namespacemingfx.html">mingfx</a></li><li class="navelem"><a class="el" href="classmingfx_1_1_ray.html">Ray</a></li> </ul>
+</div>
+</div><!-- top -->
+<div class="header">
+ <div class="summary">
+<a href="#pub-methods">Public Member Functions</a> |
+<a href="classmingfx_1_1_ray-members.html">List of all members</a> </div>
+ <div class="headertitle">
+<div class="title">mingfx::Ray Class Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>Stores the mathematical object of a ray that begins at an origin (a 3D point) and points in a direction (a unit 3D vector). </p>
+<p>Rays can intersect a variety of other computer graphics objects, such as planes, triangles, spheres, 3D meshes, etc. These intersections can be tested with the Intersect...() methods. The <a class="el" href="classmingfx_1_1_ray.html" title="Stores the mathematical object of a ray that begins at an origin (a 3D point) and points in a directi...">Ray</a> can also be transformed by a <a class="el" href="classmingfx_1_1_matrix4.html" title="A 4x4 transformation matrix stored internally as an array of floats in column-major order so as to be...">Matrix4</a>. Example: </p><div class="fragment"><div class="line"><span class="comment">// Create a pick ray from the mouse position</span></div>
+<div class="line"><span class="keywordtype">void</span> MyGraphicsApp::OnLeftMouseDown(<span class="keyword">const</span> Point2 &pos) {</div>
+<div class="line"> Point2 mouse_xy = PixelsToNormalizedDeviceCoords(pos);</div>
+<div class="line"> <span class="keywordtype">float</span> mouse_z = ReadZValueAtPixel(pos);</div>
+<div class="line"> Point3 mouse_3d = <a class="code" href="classmingfx_1_1_gfx_math.html#a2086a2f885f887fb53da8a5adb5860f0">GfxMath::ScreenToNearPlane</a>(view_matrix, proj_matrix, mouse_xy, mouse_z);</div>
+<div class="line"> Matrix4 camera_matrix = view_matrix.Inverse();</div>
+<div class="line"> Point3 eye = camera_matrix.ColumnToPoint3(3);</div>
+<div class="line"> </div>
+<div class="line"> <a class="code" href="classmingfx_1_1_ray.html#aee3fe586869e00ae657a74bb4bbbbfda">Ray</a> pick_ray(eye, mouse_3d - eye);</div>
+<div class="line"> </div>
+<div class="line"> <span class="comment">// check to see if the ray intersects a sphere</span></div>
+<div class="line"> <span class="keywordtype">float</span> t;</div>
+<div class="line"> Point3 p;</div>
+<div class="line"> <span class="keywordflow">if</span> (pick_ray.IntersectSphere(Point3(0,0,0), 2.0, &t, &p)) {</div>
+<div class="line"> std::cout << <span class="stringliteral">"Mouse pointing at sphere! Intersection point = "</span> << p << std::endl;</div>
+<div class="line"> }</div>
+<div class="line">}</div>
+<div class="ttc" id="aclassmingfx_1_1_gfx_math_html_a2086a2f885f887fb53da8a5adb5860f0"><div class="ttname"><a href="classmingfx_1_1_gfx_math.html#a2086a2f885f887fb53da8a5adb5860f0">mingfx::GfxMath::ScreenToNearPlane</a></div><div class="ttdeci">static Point3 ScreenToNearPlane(const Matrix4 &viewMatrix, const Matrix4 &projMatrix, const Point2 &normalizedScreenPt)</div><div class="ttdoc">Converts a 2D point on the filmplane represented in Normalized Device Coorindates,...</div></div>
+<div class="ttc" id="aclassmingfx_1_1_ray_html_aee3fe586869e00ae657a74bb4bbbbfda"><div class="ttname"><a href="classmingfx_1_1_ray.html#aee3fe586869e00ae657a74bb4bbbbfda">mingfx::Ray::Ray</a></div><div class="ttdeci">Ray()</div><div class="ttdoc">Defaults to a ray at the origin and pointing in the -Z direction.</div></div>
+</div><!-- fragment -->
+<p class="definition">Definition at line <a class="el" href="ray_8h_source.html#l00054">54</a> of file <a class="el" href="ray_8h_source.html">ray.h</a>.</p>
+</div>
+<p><code>#include <<a class="el" href="ray_8h_source.html">ray.h</a>></code></p>
+<table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
+Public Member Functions</h2></td></tr>
+<tr class="memitem:aee3fe586869e00ae657a74bb4bbbbfda"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#aee3fe586869e00ae657a74bb4bbbbfda">Ray</a> ()</td></tr>
+<tr class="memdesc:aee3fe586869e00ae657a74bb4bbbbfda"><td class="mdescLeft"> </td><td class="mdescRight">Defaults to a ray at the origin and pointing in the -Z direction. <a href="classmingfx_1_1_ray.html#aee3fe586869e00ae657a74bb4bbbbfda">More...</a><br /></td></tr>
+<tr class="separator:aee3fe586869e00ae657a74bb4bbbbfda"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ab38cdd0793b3acfe55fa9ebca5ddebf6"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#ab38cdd0793b3acfe55fa9ebca5ddebf6">Ray</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &<a class="el" href="classmingfx_1_1_ray.html#a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe">origin</a>, const <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> &<a class="el" href="classmingfx_1_1_ray.html#a7b7826730a410c10be00122c99fe6dbe">direction</a>)</td></tr>
+<tr class="memdesc:ab38cdd0793b3acfe55fa9ebca5ddebf6"><td class="mdescLeft"> </td><td class="mdescRight">Creates a ray from a 3D origin and direction. <a href="classmingfx_1_1_ray.html#ab38cdd0793b3acfe55fa9ebca5ddebf6">More...</a><br /></td></tr>
+<tr class="separator:ab38cdd0793b3acfe55fa9ebca5ddebf6"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ac20909f30c07d5375598876c6d294625"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#ac20909f30c07d5375598876c6d294625">~Ray</a> ()</td></tr>
+<tr class="memdesc:ac20909f30c07d5375598876c6d294625"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classmingfx_1_1_ray.html" title="Stores the mathematical object of a ray that begins at an origin (a 3D point) and points in a directi...">Ray</a> destructor. <a href="classmingfx_1_1_ray.html#ac20909f30c07d5375598876c6d294625">More...</a><br /></td></tr>
+<tr class="separator:ac20909f30c07d5375598876c6d294625"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a87b07c4f7c9f33189efade7e519b5d9d"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a87b07c4f7c9f33189efade7e519b5d9d">operator==</a> (const <a class="el" href="classmingfx_1_1_ray.html">Ray</a> &other) const</td></tr>
+<tr class="memdesc:a87b07c4f7c9f33189efade7e519b5d9d"><td class="mdescLeft"> </td><td class="mdescRight">Check for "equality", taking floating point imprecision into account. <a href="classmingfx_1_1_ray.html#a87b07c4f7c9f33189efade7e519b5d9d">More...</a><br /></td></tr>
+<tr class="separator:a87b07c4f7c9f33189efade7e519b5d9d"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ab62fa6ea1c20870f67c58401aefe3eff"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#ab62fa6ea1c20870f67c58401aefe3eff">operator!=</a> (const <a class="el" href="classmingfx_1_1_ray.html">Ray</a> &other) const</td></tr>
+<tr class="memdesc:ab62fa6ea1c20870f67c58401aefe3eff"><td class="mdescLeft"> </td><td class="mdescRight">Check for "inequality", taking floating point imprecision into account. <a href="classmingfx_1_1_ray.html#ab62fa6ea1c20870f67c58401aefe3eff">More...</a><br /></td></tr>
+<tr class="separator:ab62fa6ea1c20870f67c58401aefe3eff"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a3c926e2da6dfd1b0a435577617eae984"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a3c926e2da6dfd1b0a435577617eae984">Length</a> () const</td></tr>
+<tr class="memdesc:a3c926e2da6dfd1b0a435577617eae984"><td class="mdescLeft"> </td><td class="mdescRight">Returns the length of the direction vector. <a href="classmingfx_1_1_ray.html#a3c926e2da6dfd1b0a435577617eae984">More...</a><br /></td></tr>
+<tr class="separator:a3c926e2da6dfd1b0a435577617eae984"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a8707604031eb9437c449345d85d69d24"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a8707604031eb9437c449345d85d69d24">IntersectPlane</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &planePt, const <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> &planeNormal, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint) const</td></tr>
+<tr class="memdesc:a8707604031eb9437c449345d85d69d24"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a plane defined by a point and a normal. <a href="classmingfx_1_1_ray.html#a8707604031eb9437c449345d85d69d24">More...</a><br /></td></tr>
+<tr class="separator:a8707604031eb9437c449345d85d69d24"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a1a6130616c4e4eebe9d09181b0f8b734"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a1a6130616c4e4eebe9d09181b0f8b734">IntersectTriangle</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v1, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v2, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v3, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint) const</td></tr>
+<tr class="memdesc:a1a6130616c4e4eebe9d09181b0f8b734"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a triangle defined by the vertices v1, v2, and v3. <a href="classmingfx_1_1_ray.html#a1a6130616c4e4eebe9d09181b0f8b734">More...</a><br /></td></tr>
+<tr class="separator:a1a6130616c4e4eebe9d09181b0f8b734"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a37689523a0b73d3d3288ce60bdcb7ae3"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a37689523a0b73d3d3288ce60bdcb7ae3">IntersectQuad</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v1, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v2, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v3, const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &v4, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint) const</td></tr>
+<tr class="memdesc:a37689523a0b73d3d3288ce60bdcb7ae3"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a quad defined by the vertices v1, v2, v3, and v4. <a href="classmingfx_1_1_ray.html#a37689523a0b73d3d3288ce60bdcb7ae3">More...</a><br /></td></tr>
+<tr class="separator:a37689523a0b73d3d3288ce60bdcb7ae3"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a970c7dbc19167be625967fabfb39b4ff"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a970c7dbc19167be625967fabfb39b4ff">IntersectSphere</a> (const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> &center, float radius, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint) const</td></tr>
+<tr class="memdesc:a970c7dbc19167be625967fabfb39b4ff"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a sphere defined by a center point and a radius. <a href="classmingfx_1_1_ray.html#a970c7dbc19167be625967fabfb39b4ff">More...</a><br /></td></tr>
+<tr class="separator:a970c7dbc19167be625967fabfb39b4ff"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a79caa1df0839d13339575d3d5527ae6f"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a79caa1df0839d13339575d3d5527ae6f">IntersectMesh</a> (const <a class="el" href="classmingfx_1_1_mesh.html">Mesh</a> &mesh, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint, int *iTriangleID) const</td></tr>
+<tr class="memdesc:a79caa1df0839d13339575d3d5527ae6f"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a triangle mesh. <a href="classmingfx_1_1_ray.html#a79caa1df0839d13339575d3d5527ae6f">More...</a><br /></td></tr>
+<tr class="separator:a79caa1df0839d13339575d3d5527ae6f"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ac90097090f0f8f49db13f6f232712afc"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#ac90097090f0f8f49db13f6f232712afc">FastIntersectMesh</a> (<a class="el" href="classmingfx_1_1_mesh.html">Mesh</a> *mesh, float *iTime, <a class="el" href="classmingfx_1_1_point3.html">Point3</a> *iPoint, int *iTriangleID) const</td></tr>
+<tr class="memdesc:ac90097090f0f8f49db13f6f232712afc"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects a triangle mesh. <a href="classmingfx_1_1_ray.html#ac90097090f0f8f49db13f6f232712afc">More...</a><br /></td></tr>
+<tr class="separator:ac90097090f0f8f49db13f6f232712afc"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a57d3ee10518ed361ae02d9cbdef842b7"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a57d3ee10518ed361ae02d9cbdef842b7">IntersectAABB</a> (const <a class="el" href="classmingfx_1_1_a_a_b_b.html">AABB</a> &box, float *iTime) const</td></tr>
+<tr class="memdesc:a57d3ee10518ed361ae02d9cbdef842b7"><td class="mdescLeft"> </td><td class="mdescRight">Checks to see if the ray intersects an <a class="el" href="classmingfx_1_1_a_a_b_b.html" title="A 3D axis-aligned bounding box defined by two corners (min and max).">AABB</a> (Axis-Aligned Bounding Box). <a href="classmingfx_1_1_ray.html#a57d3ee10518ed361ae02d9cbdef842b7">More...</a><br /></td></tr>
+<tr class="separator:a57d3ee10518ed361ae02d9cbdef842b7"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe">origin</a> () const</td></tr>
+<tr class="memdesc:a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe"><td class="mdescLeft"> </td><td class="mdescRight">Returns the origin. <a href="classmingfx_1_1_ray.html#a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe">More...</a><br /></td></tr>
+<tr class="separator:a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a7b7826730a410c10be00122c99fe6dbe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a7b7826730a410c10be00122c99fe6dbe">direction</a> () const</td></tr>
+<tr class="memdesc:a7b7826730a410c10be00122c99fe6dbe"><td class="mdescLeft"> </td><td class="mdescRight">Returns the direction. <a href="classmingfx_1_1_ray.html#a7b7826730a410c10be00122c99fe6dbe">More...</a><br /></td></tr>
+<tr class="separator:a7b7826730a410c10be00122c99fe6dbe"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a75593293307b4eead15a876bf3597071"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_ray.html#a75593293307b4eead15a876bf3597071">set</a> (<a class="el" href="classmingfx_1_1_point3.html">Point3</a> newOrigin, <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> newDir)</td></tr>
+<tr class="memdesc:a75593293307b4eead15a876bf3597071"><td class="mdescLeft"> </td><td class="mdescRight">Sets a new origin and direction. <a href="classmingfx_1_1_ray.html#a75593293307b4eead15a876bf3597071">More...</a><br /></td></tr>
+<tr class="separator:a75593293307b4eead15a876bf3597071"><td class="memSeparator" colspan="2"> </td></tr>
+</table>
+<h2 class="groupheader">Constructor & Destructor Documentation</h2>
+<a id="aee3fe586869e00ae657a74bb4bbbbfda"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#aee3fe586869e00ae657a74bb4bbbbfda">◆ </a></span>Ray() <span class="overload">[1/2]</span></h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">mingfx::Ray::Ray </td>
+ <td>(</td>
+ <td class="paramname"></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Defaults to a ray at the origin and pointing in the -Z direction. </p>
+
+</div>
+</div>
+<a id="ab38cdd0793b3acfe55fa9ebca5ddebf6"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#ab38cdd0793b3acfe55fa9ebca5ddebf6">◆ </a></span>Ray() <span class="overload">[2/2]</span></h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">mingfx::Ray::Ray </td>
+ <td>(</td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>origin</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> & </td>
+ <td class="paramname"><em>direction</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Creates a ray from a 3D origin and direction. </p>
+
+</div>
+</div>
+<a id="ac20909f30c07d5375598876c6d294625"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#ac20909f30c07d5375598876c6d294625">◆ </a></span>~Ray()</h2>
+
+<div class="memitem">
+<div class="memproto">
+<table class="mlabels">
+ <tr>
+ <td class="mlabels-left">
+ <table class="memname">
+ <tr>
+ <td class="memname">virtual mingfx::Ray::~Ray </td>
+ <td>(</td>
+ <td class="paramname"></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+ </td>
+ <td class="mlabels-right">
+<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
+ </tr>
+</table>
+</div><div class="memdoc">
+
+<p><a class="el" href="classmingfx_1_1_ray.html" title="Stores the mathematical object of a ray that begins at an origin (a 3D point) and points in a directi...">Ray</a> destructor. </p>
+
+</div>
+</div>
+<h2 class="groupheader">Member Function Documentation</h2>
+<a id="a7b7826730a410c10be00122c99fe6dbe"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a7b7826730a410c10be00122c99fe6dbe">◆ </a></span>direction()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> mingfx::Ray::direction </td>
+ <td>(</td>
+ <td class="paramname"></td><td>)</td>
+ <td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Returns the direction. </p>
+
+</div>
+</div>
+<a id="ac90097090f0f8f49db13f6f232712afc"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#ac90097090f0f8f49db13f6f232712afc">◆ </a></span>FastIntersectMesh()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">bool mingfx::Ray::FastIntersectMesh </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="classmingfx_1_1_mesh.html">Mesh</a> * </td>
+ <td class="paramname"><em>mesh</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">float * </td>
+ <td class="paramname"><em>iTime</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td>
+ <td class="paramname"><em>iPoint</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int * </td>
+ <td class="paramname"><em>iTriangleID</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Checks to see if the ray intersects a triangle mesh. </p>
+<p>This uses a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a> (Bounding Volume Hierarchy) to accelerate the ray-triangle intersection tests. Each mesh can optionally store a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a>. If a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a> has already been calculated for the mesh (done with Mesh::CalculateBVH()), then this function will be much faster than the brute-force <a class="el" href="classmingfx_1_1_ray.html#a79caa1df0839d13339575d3d5527ae6f" title="Checks to see if the ray intersects a triangle mesh.">IntersectMesh()</a> function. If a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a> has not already been calculated for the mesh, the first call to <a class="el" href="classmingfx_1_1_ray.html#ac90097090f0f8f49db13f6f232712afc" title="Checks to see if the ray intersects a triangle mesh.">FastIntersectMesh()</a> will trigger the mesh to create a <a class="el" href="classmingfx_1_1_b_v_h.html" title="A Bounding Volume Hierarchy (BVH) data structure that can be used to accelerate ray-object intersecti...">BVH</a> (not a fast operation) but then subsequent calls to <a class="el" href="classmingfx_1_1_ray.html#ac90097090f0f8f49db13f6f232712afc" title="Checks to see if the ray intersects a triangle mesh.">FastIntersectMesh()</a> will be fast. </p>
+
+</div>
+</div>
+<a id="a57d3ee10518ed361ae02d9cbdef842b7"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a57d3ee10518ed361ae02d9cbdef842b7">◆ </a></span>IntersectAABB()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">bool mingfx::Ray::IntersectAABB </td>
+ <td>(</td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_a_a_b_b.html">AABB</a> & </td>
+ <td class="paramname"><em>box</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">float * </td>
+ <td class="paramname"><em>iTime</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Checks to see if the ray intersects an <a class="el" href="classmingfx_1_1_a_a_b_b.html" title="A 3D axis-aligned bounding box defined by two corners (min and max).">AABB</a> (Axis-Aligned Bounding Box). </p>
+<p>Typically, this is the first step of a more detailed intersection test and we don't care about the actual point of intersection, just whether it intersects or not. So, we don't bother calculating the iPoint. We get the iTime for free though, so we do return that. You can calc the iPoint if you want using: </p><div class="fragment"><div class="line"><span class="keywordtype">float</span> t;</div>
+<div class="line"><span class="keywordflow">if</span> (ray.IntersectAABB(box, &t)) {</div>
+<div class="line"> Point3 iPoint = ray.origin() + t*ray.direction();</div>
+<div class="line">}</div>
+</div><!-- fragment -->
+</div>
+</div>
+<a id="a79caa1df0839d13339575d3d5527ae6f"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a79caa1df0839d13339575d3d5527ae6f">◆ </a></span>IntersectMesh()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">bool mingfx::Ray::IntersectMesh </td>
+ <td>(</td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_mesh.html">Mesh</a> & </td>
+ <td class="paramname"><em>mesh</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">float * </td>
+ <td class="paramname"><em>iTime</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td>
+ <td class="paramname"><em>iPoint</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int * </td>
+ <td class="paramname"><em>iTriangleID</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Checks to see if the ray intersects a triangle mesh. </p>
+<p>This is a brute-force check over each triangle in the mesh. If there was an intersection, true is returned, iTime is set to the intersection time, iPoint is set to the intersection point, and iTriangleID is set to the ID of the closest intersected triangle along the ray. </p>
+
+</div>
+</div>
+<a id="a8707604031eb9437c449345d85d69d24"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a8707604031eb9437c449345d85d69d24">◆ </a></span>IntersectPlane()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">bool mingfx::Ray::IntersectPlane </td>
+ <td>(</td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>planePt</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> & </td>
+ <td class="paramname"><em>planeNormal</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">float * </td>
+ <td class="paramname"><em>iTime</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td>
+ <td class="paramname"><em>iPoint</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Checks to see if the ray intersects a plane defined by a point and a normal. </p>
+<p>If there was an intersection, true is returned, iTime is set to the intersection time, and iPoint is set to the intersection point. The plane is considered to be 1-sided. That is the intersection will only occur if the ray hits the plane from its front side as determined by the plane's normal. </p>
+
+</div>
+</div>
+<a id="a37689523a0b73d3d3288ce60bdcb7ae3"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a37689523a0b73d3d3288ce60bdcb7ae3">◆ </a></span>IntersectQuad()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">bool mingfx::Ray::IntersectQuad </td>
+ <td>(</td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>v1</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>v2</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>v3</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>v4</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">float * </td>
+ <td class="paramname"><em>iTime</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td>
+ <td class="paramname"><em>iPoint</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Checks to see if the ray intersects a quad defined by the vertices v1, v2, v3, and v4. </p>
+<p>The vertices must be provided in counter-clockwise order so that the normal of the triangle can be determined via the right-hand rule. The intersection will only happen if the ray hits the front side of the triangle. If there was an intersection, true is returned, iTime is set to the intersection time, and iPoint is set to the intersection point. </p>
+
+</div>
+</div>
+<a id="a970c7dbc19167be625967fabfb39b4ff"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a970c7dbc19167be625967fabfb39b4ff">◆ </a></span>IntersectSphere()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">bool mingfx::Ray::IntersectSphere </td>
+ <td>(</td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>center</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">float </td>
+ <td class="paramname"><em>radius</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">float * </td>
+ <td class="paramname"><em>iTime</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td>
+ <td class="paramname"><em>iPoint</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Checks to see if the ray intersects a sphere defined by a center point and a radius. </p>
+<p>If there was an intersection, true is returned, iTime is set to the intersection time, and iPoint is set to the intersection point. </p>
+
+</div>
+</div>
+<a id="a1a6130616c4e4eebe9d09181b0f8b734"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a1a6130616c4e4eebe9d09181b0f8b734">◆ </a></span>IntersectTriangle()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">bool mingfx::Ray::IntersectTriangle </td>
+ <td>(</td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>v1</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>v2</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_point3.html">Point3</a> & </td>
+ <td class="paramname"><em>v3</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">float * </td>
+ <td class="paramname"><em>iTime</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> * </td>
+ <td class="paramname"><em>iPoint</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Checks to see if the ray intersects a triangle defined by the vertices v1, v2, and v3. </p>
+<p>The vertices must be provided in counter-clockwise order so that the normal of the triangle can be determined via the right-hand rule. The intersection will only happen if the ray hits the front side of the triangle. If there was an intersection, true is returned, iTime is set to the intersection time, and iPoint is set to the intersection point. </p>
+
+</div>
+</div>
+<a id="a3c926e2da6dfd1b0a435577617eae984"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a3c926e2da6dfd1b0a435577617eae984">◆ </a></span>Length()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">float mingfx::Ray::Length </td>
+ <td>(</td>
+ <td class="paramname"></td><td>)</td>
+ <td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Returns the length of the direction vector. </p>
+
+</div>
+</div>
+<a id="ab62fa6ea1c20870f67c58401aefe3eff"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#ab62fa6ea1c20870f67c58401aefe3eff">◆ </a></span>operator!=()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">bool mingfx::Ray::operator!= </td>
+ <td>(</td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_ray.html">Ray</a> & </td>
+ <td class="paramname"><em>other</em></td><td>)</td>
+ <td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Check for "inequality", taking floating point imprecision into account. </p>
+
+</div>
+</div>
+<a id="a87b07c4f7c9f33189efade7e519b5d9d"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a87b07c4f7c9f33189efade7e519b5d9d">◆ </a></span>operator==()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">bool mingfx::Ray::operator== </td>
+ <td>(</td>
+ <td class="paramtype">const <a class="el" href="classmingfx_1_1_ray.html">Ray</a> & </td>
+ <td class="paramname"><em>other</em></td><td>)</td>
+ <td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Check for "equality", taking floating point imprecision into account. </p>
+
+</div>
+</div>
+<a id="a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a2fe0ca901c1a5f3ce5f74aa8e5f0d0fe">◆ </a></span>origin()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> mingfx::Ray::origin </td>
+ <td>(</td>
+ <td class="paramname"></td><td>)</td>
+ <td> const</td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Returns the origin. </p>
+
+</div>
+</div>
+<a id="a75593293307b4eead15a876bf3597071"></a>
+<h2 class="memtitle"><span class="permalink"><a href="#a75593293307b4eead15a876bf3597071">◆ </a></span>set()</h2>
+
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">void mingfx::Ray::set </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="classmingfx_1_1_point3.html">Point3</a> </td>
+ <td class="paramname"><em>newOrigin</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="classmingfx_1_1_vector3.html">Vector3</a> </td>
+ <td class="paramname"><em>newDir</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Sets a new origin and direction. </p>
+
+</div>
+</div>
+<hr/>The documentation for this class was generated from the following file:<ul>
+<li>src/<a class="el" href="ray_8h_source.html">ray.h</a></li>
+</ul>
+</div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.9.1-->
+<!-- start footer part -->
+<hr class="footer"/><address class="footer"><small>
+Generated by  <a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/>
+</a> 1.9.1
+</small></address>
+</body>
+</html>
|