mirror of
https://github.com/g-truc/glm.git
synced 2024-11-29 11:24:35 +00:00
commit
64be09e1b1
@ -111,7 +111,7 @@ Functions</h2></td></tr>
|
||||
<tr class="memdesc:gad3697a9700ea379739a667ea02573488"><td class="mdescLeft"> </td><td class="mdescRight">Compute the intersection of a ray and a plane. <a href="a00331.html#gad3697a9700ea379739a667ea02573488">More...</a><br /></td></tr>
|
||||
<tr class="separator:gad3697a9700ea379739a667ea02573488"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="memTemplParams" colspan="2">template<typename genType > </td></tr>
|
||||
<tr class="memitem:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL bool </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e">intersectRaySphere</a> (genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, typename genType::value_type const sphereRadiusSquered, typename genType::value_type &intersectionDistance)</td></tr>
|
||||
<tr class="memitem:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL bool </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e">intersectRaySphere</a> (genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, typename genType::value_type const sphereRadiusSquared, typename genType::value_type &intersectionDistance)</td></tr>
|
||||
<tr class="memdesc:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="mdescLeft"> </td><td class="mdescRight">Compute the intersection distance of a ray and a sphere. <a href="a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e">More...</a><br /></td></tr>
|
||||
<tr class="separator:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gad28c00515b823b579c608aafa1100c1d"><td class="memTemplParams" colspan="2">template<typename genType > </td></tr>
|
||||
|
@ -131,7 +131,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keyword">template</span><<span class="keyword">typename</span> genType></div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  GLM_FUNC_DECL <span class="keywordtype">bool</span> <a class="code" href="a00331.html#gad28c00515b823b579c608aafa1100c1d">intersectRaySphere</a>(</div>
|
||||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  genType <span class="keyword">const</span>& rayStarting, genType <span class="keyword">const</span>& rayNormalizedDirection,</div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  genType <span class="keyword">const</span>& sphereCenter, <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> sphereRadiusSquered,</div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  genType <span class="keyword">const</span>& sphereCenter, <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> sphereRadiusSquared,</div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keyword">typename</span> genType::value_type & intersectionDistance);</div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div>
|
||||
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="keyword">template</span><<span class="keyword">typename</span> genType></div>
|
||||
|
@ -100,7 +100,7 @@ Functions</h2></td></tr>
|
||||
<tr class="memdesc:gad3697a9700ea379739a667ea02573488"><td class="mdescLeft"> </td><td class="mdescRight">Compute the intersection of a ray and a plane. <a href="a00331.html#gad3697a9700ea379739a667ea02573488">More...</a><br /></td></tr>
|
||||
<tr class="separator:gad3697a9700ea379739a667ea02573488"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="memTemplParams" colspan="2">template<typename genType > </td></tr>
|
||||
<tr class="memitem:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL bool </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e">intersectRaySphere</a> (genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, typename genType::value_type const sphereRadiusSquered, typename genType::value_type &intersectionDistance)</td></tr>
|
||||
<tr class="memitem:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL bool </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e">intersectRaySphere</a> (genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, typename genType::value_type const sphereRadiusSquared, typename genType::value_type &intersectionDistance)</td></tr>
|
||||
<tr class="memdesc:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="mdescLeft"> </td><td class="mdescRight">Compute the intersection distance of a ray and a sphere. <a href="a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e">More...</a><br /></td></tr>
|
||||
<tr class="separator:gac88f8cd84c4bcb5b947d56acbbcfa56e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:gad28c00515b823b579c608aafa1100c1d"><td class="memTemplParams" colspan="2">template<typename genType > </td></tr>
|
||||
@ -307,7 +307,7 @@ Functions</h2></td></tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">typename genType::value_type const </td>
|
||||
<td class="paramname"><em>sphereRadiusSquered</em>, </td>
|
||||
<td class="paramname"><em>sphereRadiusSquared</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
|
@ -68,7 +68,7 @@ var searchData=
|
||||
['intersectlinesphere',['intersectLineSphere',['../a00331.html#ga9c68139f3d8a4f3d7fe45f9dbc0de5b7',1,'glm']]],
|
||||
['intersectlinetriangle',['intersectLineTriangle',['../a00331.html#ga9d29b9b3acb504d43986502f42740df4',1,'glm']]],
|
||||
['intersectrayplane',['intersectRayPlane',['../a00331.html#gad3697a9700ea379739a667ea02573488',1,'glm']]],
|
||||
['intersectraysphere',['intersectRaySphere',['../a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e',1,'glm::intersectRaySphere(genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, typename genType::value_type const sphereRadiusSquered, typename genType::value_type &intersectionDistance)'],['../a00331.html#gad28c00515b823b579c608aafa1100c1d',1,'glm::intersectRaySphere(genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, const typename genType::value_type sphereRadius, genType &intersectionPosition, genType &intersectionNormal)']]],
|
||||
['intersectraysphere',['intersectRaySphere',['../a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e',1,'glm::intersectRaySphere(genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, typename genType::value_type const sphereRadiusSquared, typename genType::value_type &intersectionDistance)'],['../a00331.html#gad28c00515b823b579c608aafa1100c1d',1,'glm::intersectRaySphere(genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, const typename genType::value_type sphereRadius, genType &intersectionPosition, genType &intersectionNormal)']]],
|
||||
['intersectraytriangle',['intersectRayTriangle',['../a00331.html#ga65bf2c594482f04881c36bc761f9e946',1,'glm']]],
|
||||
['inverse',['inverse',['../a00248.html#gab41da854ae678e23e114b598cbca4065',1,'glm::inverse(qua< T, Q > const &q)'],['../a00317.html#ga070f521a953f6461af4ab4cf8ccbf27e',1,'glm::inverse(tdualquat< T, Q > const &q)'],['../a00371.html#gaed509fe8129b01e4f20a6d0de5690091',1,'glm::inverse(mat< C, R, T, Q > const &m)']]],
|
||||
['inversesqrt',['inversesqrt',['../a00242.html#ga523dd6bd0ad9f75ae2d24c8e4b017b7a',1,'glm']]],
|
||||
|
@ -11,7 +11,7 @@ var searchData=
|
||||
['intersectlinesphere',['intersectLineSphere',['../a00331.html#ga9c68139f3d8a4f3d7fe45f9dbc0de5b7',1,'glm']]],
|
||||
['intersectlinetriangle',['intersectLineTriangle',['../a00331.html#ga9d29b9b3acb504d43986502f42740df4',1,'glm']]],
|
||||
['intersectrayplane',['intersectRayPlane',['../a00331.html#gad3697a9700ea379739a667ea02573488',1,'glm']]],
|
||||
['intersectraysphere',['intersectRaySphere',['../a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e',1,'glm::intersectRaySphere(genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, typename genType::value_type const sphereRadiusSquered, typename genType::value_type &intersectionDistance)'],['../a00331.html#gad28c00515b823b579c608aafa1100c1d',1,'glm::intersectRaySphere(genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, const typename genType::value_type sphereRadius, genType &intersectionPosition, genType &intersectionNormal)']]],
|
||||
['intersectraysphere',['intersectRaySphere',['../a00331.html#gac88f8cd84c4bcb5b947d56acbbcfa56e',1,'glm::intersectRaySphere(genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, typename genType::value_type const sphereRadiusSquared, typename genType::value_type &intersectionDistance)'],['../a00331.html#gad28c00515b823b579c608aafa1100c1d',1,'glm::intersectRaySphere(genType const &rayStarting, genType const &rayNormalizedDirection, genType const &sphereCenter, const typename genType::value_type sphereRadius, genType &intersectionPosition, genType &intersectionNormal)']]],
|
||||
['intersectraytriangle',['intersectRayTriangle',['../a00331.html#ga65bf2c594482f04881c36bc761f9e946',1,'glm']]],
|
||||
['inverse',['inverse',['../a00248.html#gab41da854ae678e23e114b598cbca4065',1,'glm::inverse(qua< T, Q > const &q)'],['../a00317.html#ga070f521a953f6461af4ab4cf8ccbf27e',1,'glm::inverse(tdualquat< T, Q > const &q)'],['../a00371.html#gaed509fe8129b01e4f20a6d0de5690091',1,'glm::inverse(mat< C, R, T, Q > const &m)']]],
|
||||
['inversesqrt',['inversesqrt',['../a00242.html#ga523dd6bd0ad9f75ae2d24c8e4b017b7a',1,'glm']]],
|
||||
|
@ -66,7 +66,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL bool intersectRaySphere(
|
||||
genType const& rayStarting, genType const& rayNormalizedDirection,
|
||||
genType const& sphereCenter, typename genType::value_type const sphereRadiusSquered,
|
||||
genType const& sphereCenter, typename genType::value_type const sphereRadiusSquared,
|
||||
typename genType::value_type & intersectionDistance);
|
||||
|
||||
//! Compute the intersection of a ray and a sphere.
|
||||
|
@ -135,7 +135,7 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER bool intersectRaySphere
|
||||
(
|
||||
genType const& rayStarting, genType const& rayNormalizedDirection,
|
||||
genType const& sphereCenter, const typename genType::value_type sphereRadiusSquered,
|
||||
genType const& sphereCenter, const typename genType::value_type sphereRadiusSquared,
|
||||
typename genType::value_type & intersectionDistance
|
||||
)
|
||||
{
|
||||
@ -143,11 +143,11 @@ namespace glm
|
||||
genType diff = sphereCenter - rayStarting;
|
||||
typename genType::value_type t0 = dot(diff, rayNormalizedDirection);
|
||||
typename genType::value_type dSquared = dot(diff, diff) - t0 * t0;
|
||||
if( dSquared > sphereRadiusSquered )
|
||||
if( dSquared > sphereRadiusSquared )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
typename genType::value_type t1 = sqrt( sphereRadiusSquered - dSquared );
|
||||
typename genType::value_type t1 = sqrt( sphereRadiusSquared - dSquared );
|
||||
intersectionDistance = t0 > t1 + Epsilon ? t0 - t1 : t0 + t1;
|
||||
return intersectionDistance > Epsilon;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user