Ray.html 6.7 KB

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