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