Ray.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <div class="desc">A ray that emits from an origin in a certain direction.</div>
  13. <h2>Constructor</h2>
  14. <h3>[name]( [page:Vector3 origin], [page:Vector3 direction] )</h3>
  15. <div>
  16. origin -- [page:Vector3] The origin of the [page:Ray].<br />
  17. direction -- [page:Vector3] The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.
  18. </div>
  19. <div>
  20. Initialises the origin and direction properties to the provided values.
  21. </div>
  22. <h2>Properties</h2>
  23. <h3>[property:Vector3 origin]</h3>
  24. <div>
  25. The origin of the [page:Ray].
  26. </div>
  27. <h3>[property:Vector3 direction]</h3>
  28. <div>
  29. The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.
  30. </div>
  31. <h2>Methods</h2>
  32. <h3>[method:Ray applyMatrix4]( [page:Matrix4 matrix4] )</h3>
  33. <div>
  34. matrix4 -- [page:Matrix4] The [page:Matrix4] to transform this [page:Ray] by.
  35. </div>
  36. <div>
  37. Transform this [page:Ray] by the [page:Matrix4].
  38. </div>
  39. <h3>[method:Vector3 at]( [page:Float t], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
  40. <div>
  41. t -- [page:Float] The distance along the [page:Ray] to retrieve a position for.<br />
  42. optionalTarget -- [page:Vector3] Receives the position along the [page:Ray] if passed; otherwise a new [page:Vector3] is created.
  43. </div>
  44. <div>
  45. Get a [page:Vector3] that is a given distance along this [page:Ray].
  46. </div>
  47. <h3>[method:Ray clone]()</h3>
  48. <div>
  49. Create a clone of this [page:Ray].
  50. </div>
  51. <h3>[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
  52. <div>
  53. point -- [page:Vector3] The point to get the closest approach to. <br />
  54. optionalTarget -- [page:Vector3] Receives the return value if passed; otherwise a new [page:Vector3] is created.
  55. </div>
  56. <div>
  57. Get the point along this [page:Ray] that is closest to the [page:Vector3] provided.
  58. </div>
  59. <h3>[method:Ray copy]( [page:Ray ray] )</h3>
  60. <div>
  61. ray -- [page:Ray] The [page:Ray] to copy values from.
  62. </div>
  63. <div>
  64. Copy the properties of the provided [page:Ray], then return this [page:Ray].
  65. </div>
  66. <h3>[method:Float distanceSqToSegment]( [page:Vector3 v0], [page:Vector3 v1], [page:Vector3 optionalPointOnRay] = null, [page:Vector3 optionalPointOnSegment] = null ) [page:Float]</h3>
  67. <div>
  68. v0 -- [page:Vector3] The start of the line segment.
  69. v1 -- [page:Vector3] The end of the line segment.
  70. optionalPointOnRay -- [page:Vector3] If this is provided, it receives the point on this [page:Ray] that is closest to the segment.
  71. optionalPointOnSegment -- [page:Vector3] If this is provided, it receives the point on the line segment that is closest to this [page:Ray].
  72. </div>
  73. <div>
  74. Get the squared distance between this [page:Ray] and a line segment.
  75. </div>
  76. <h3>[method:Float distanceToPlane]( [page:Plane plane] )</h3>
  77. <div>
  78. plane -- [page:Plane] The [page:Plane] to get the distance to.
  79. </div>
  80. <div>
  81. Get the distance from the origin to the [page:Plane], or *null* if the [page:Ray] doesn't intersect the [page:Plane].
  82. </div>
  83. <h3>[method:Float distanceToPoint]( [page:Vector3 point] )</h3>
  84. <div>
  85. point -- [page:Vector3] The [page:Vector3] to compute a distance to.
  86. </div>
  87. <div>
  88. Get the distance of the closest approach between the [page:Ray] and the [page:Vector3].
  89. </div>
  90. <h3>[method:Float distanceSqToPoint]( [page:Vector3 point] )</h3>
  91. <div>
  92. point -- [page:Vector3] The [page:Vector3] to compute a distance to.
  93. </div>
  94. <div>
  95. Get the squared distance of the closest approach between the [page:Ray] and the [page:Vector3].
  96. </div>
  97. <h3>[method:Boolean equals]( [page:Ray ray] )</h3>
  98. <div>
  99. ray -- [page:Ray] The [page:Ray] to compare to.
  100. </div>
  101. <div>
  102. Return whether this and the other [page:Ray] have equal offsets and directions.
  103. </div>
  104. <h3>[method:Vector3 intersectBox]( [page:Box3 box], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
  105. <div>
  106. box -- [page:Box3] The [page:Box3] to intersect with.<br />
  107. optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
  108. </div>
  109. <div>
  110. Intersect this [page:Ray] with a [page:Box3], returning the intersection point or *null* if there is no intersection.
  111. </div>
  112. <h3>[method:Vector3 intersectPlane]( [page:Plane plane], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
  113. <div>
  114. plane -- [page:Plane] The [page:Plane] to intersect with.<br />
  115. optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
  116. </div>
  117. <div>
  118. Intersect this [page:Ray] with a [page:Plane], returning the intersection point or *null* if there is no intersection.
  119. </div>
  120. <h3>[method:Vector3 intersectSphere]( [page:Sphere sphere], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
  121. <div>
  122. sphere -- [page:Sphere] The [page:Sphere] to intersect with.<br />
  123. optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
  124. </div>
  125. <div>
  126. Intersect this [page:Ray] with a [page:Sphere], returning the intersection point or *null* if there is no intersection.
  127. </div>
  128. <h3>[method:Vector3 intersectTriangle]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c], [page:Boolean backfaceCulling], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
  129. <div>
  130. a, b, c -- [page:Vector3] The [page:Vector3] points on the triangle.<br />
  131. backfaceCulling -- [page:Boolean] Whether to use backface culling.<br />
  132. optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
  133. </div>
  134. <div>
  135. Intersect this [page:Ray] with a triangle, returning the intersection point or *null* if there is no intersection.
  136. </div>
  137. <h3>[method:Boolean intersectsBox]( [page:Box3 box] )</h3>
  138. <div>
  139. box -- [page:Box3] The [page:Box3] to intersect with.
  140. </div>
  141. <div>
  142. Return whether or not this [page:Ray] intersects with the [page:Box3].
  143. </div>
  144. <h3>[method:Boolean intersectsPlane]( [page:Plane plane] )</h3>
  145. <div>
  146. plane -- [page:Plane] The [page:Plane] to intersect with.
  147. </div>
  148. <div>
  149. Return whether or not this [page:Ray] intersects with the [page:Plane].
  150. </div>
  151. <h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] )</h3>
  152. <div>
  153. sphere -- [page:Sphere] The [page:Sphere] to intersect with.
  154. </div>
  155. <div>
  156. Return whether or not this [page:Ray] intersects with the [page:Sphere].
  157. </div>
  158. <h3>[method:Ray recast]( [page:Float t] )</h3>
  159. <div>
  160. t -- The distance along the [page:Ray] to interpolate.
  161. </div>
  162. <div>
  163. Shift the origin of this [page:Ray] along its direction by the distance given.
  164. </div>
  165. <h3>[method:Ray set]( [page:Vector3 origin], [page:Vector3 direction] )</h3>
  166. <div>
  167. origin -- [page:Vector3] The origin of the [page:Ray].<br />
  168. direction -- [page:Vector3] The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.
  169. </div>
  170. <div>
  171. Copy the parameters to the origin and direction properties.
  172. </div>
  173. <h3>[method:Ray lookAt]( [page:Vector3 v] )</h3>
  174. <div>
  175. v -- [page:Vector3] The vector to look at.
  176. </div>
  177. <div>
  178. Adjusts the direction of the ray to point at the vector in world coordinates.
  179. </div>
  180. <h2>Source</h2>
  181. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  182. </body>
  183. </html>