提交 487248f5 编写于 作者: M Mr.doob

Merge branch 'dev' of https://github.com/mrdoob/three.js into dev

......@@ -59,8 +59,6 @@
<h3>[method:Vector3 getWorldDirection]( [page:Vector3 optionalTarget] )</h3>
<div>
vector — (optional)<br /><br />
Returns a vector representing the direction in which the camera is looking,
in world space. If the [page:Vector3 optionalTarget] is set, returns a vector representing the direction
from the camera's position to the [page:Vector3 optionalTarget].
......
......@@ -217,29 +217,32 @@
<h3>[method:Quaternion getWorldQuaternion]( [page:Quaternion optionalTarget] )</h3>
<div>
optionalTarget — (optional) target to set the result. Otherwise, a new [page:Quaternion] is
instantiated. <br /><br />
optionalTarget — (optional) if specified, the result will be copied into this Quaternion,
otherwise a new Quaternion will be created. <br /><br />
Returns a quaternion representing the rotation of the object in world space.
</div>
<h3>[method:Euler getWorldRotation]( [page:Euler optionalTarget] )</h3>
<div>
optionalTarget — (optional) target to set the result. Otherwise, a new [page:Euler] is instantiated.<br /><br />
optionalTarget — (optional) if specified, the result will be copied into this Euler,
otherwise a new Euler will be created. <br /><br />
Returns the euler angles representing the rotation of the object in world space.
</div>
<h3>[method:Vector3 getWorldScale]( [page:Vector3 optionalTarget] )</h3>
<div>
optionalTarget — (optional) target to set the result. Otherwise, a new [page:Vector3] is instantiated.<br /><br />
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created. <br /><br />
Returns a vector of the scaling factors applied to the object for each axis in world space.
</div>
<h3>[method:Vector3 getWorldDirection]( [page:Vector3 optionalTarget] )</h3>
<div>
optionalTarget — (optional) target to set the result. Otherwise, a new [page:Vector3] is instantiated.<br /><br />
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created. <br /><br />
Returns a vector representing the direction of object's positive z-axis in world space.
</div>
......
......@@ -58,7 +58,7 @@
</div>
<h3>[property:Object textures]</h3>
<div>Object holding any textures used by the material. See [page.setTextures].</div>
<div>Object holding any textures used by the material. See [page:.setTextures].</div>
<h2>Methods</h2>
......
......@@ -10,7 +10,9 @@
<body>
<h1>[name]</h1>
<div class="desc">Represents a boundary box in 2D space.</div>
<div class="desc">
Represents a box in 2D space.
</div>
<h2>Constructor</h2>
......@@ -18,11 +20,13 @@
<h3>[name]( [page:Vector2 min], [page:Vector2 max] )</h3>
<div>
min -- Lower (x, y) boundary of the box.<br>
max -- Upper (x, y) boundary of the box.
</div>
<div>
Creates a box bounded by min and max.
[page:Vector2 min] - (optional) [page:Vector2] representing the lower (x, y) boundary of the box.
Default is ( + Infinity, + Infinity ).<br>
[page:Vector2 max] - (optional) [page:Vector2] representing the lower upper (x, y) boundary of the box.
Default is ( - Infinity, - Infinity ).<br /><br />
Creates a [name] bounded by min and max.
</div>
......@@ -32,203 +36,186 @@
<h3>[property:Vector2 min]</h3>
<div>
Lower (x, y) boundary of this box.
[page:Vector2] representing the lower (x, y) boundary of the box.<br />
Default is ( + Infinity, + Infinity ).
</div>
<h3>[property:Vector2 max]</h3>
<div>
Upper (x, y) boundary of this box.
[page:Vector2] representing the lower upper (x, y) boundary of the box.<br />
Default is ( - Infinity, - Infinity ).
</div>
<h2>Methods</h2>
<h2>Methods</h2>
<h3>[method:Box2 set]( [page:Vector2 min], [page:Vector2 max] ) [page:Box2 this]</h3>
<h3>[method:Vector2 clampPoint]( [page:Vector2 point], [page:Vector2 optionalTarget] )</h3>
<div>
min -- Lower (x, y) boundary of the box. <br>
max -- Upper (x, y) boundary of the box.
</div>
<div>
Sets the lower and upper (x, y) boundaries of this box.
</div>
[page:Vector2 point] - [page:Vector2] to clamp. <br>
[page:Vector2 optionalTarget] — (optional) if specified, the result will be copied into this Vector2,
otherwise a new Vector2 will be created. <br /><br />
<h3>[method:Box2 expandByPoint]( [page:Vector2 point] ) [page:Box2 this]</h3>
<div>
point -- Point that should be included in the box.
</div>
<div>
Expands the boundaries of this box to include *point*.
[link:https://en.wikipedia.org/wiki/Clamping_(graphics) Clamps] the [page:Vector2 point] within the bounds of this box.<br />
</div>
<h3>[method:Vector2 clampPoint]( [page:Vector2 point], [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
<div>
point -- Position to clamp. <br>
optionalTarget -- If specified, the clamped result will be copied here.
</div>
<div>
Clamps *point* within the bounds of this box.
</div>
<h3>[method:Box2 clone]()</h3>
<div>Returns a new [page:Box2] with the same [page:.min min] and [page:.max max] as this one.</div>
<h3>[method:Boolean intersectsBox]( [page:Box2 box] ) [page:Box2 this]</h3>
<h3>[method:Boolean containsBox]( [page:Box2 box] )</h3>
<div>
box -- Box to check for intersection against.
[page:Box2 box] - [page:Box2 Box2] to test for inclusion.<br /><br />
Returns true if this box includes the entirety of [page:Box2 box]. If this and [page:Box2 box] are identical, <br>
this function also returns true.
</div>
<h3>[method:Boolean containsPoint]( [page:Vector2 point] )</h3>
<div>
Determines whether or not this box intersects *box*.
[page:Vector2 point] - [page:Vector2] to check for inclusion.<br /><br />
Returns true if the specified [page:Vector2 point] lies within or on the boundaries of this box.
</div>
<h3>[method:Box2 setFromPoints]( [page:Array points] ) [page:Box2 this]</h3>
<h3>[method:Box2 copy]( [page:Box2 box] )</h3>
<div>
points -- Set of points that the resulting box will envelop.
Copies the [page:.min min] and [page:.max max] from [page:Box2 box] to this box.
</div>
<h3>[method:Float distanceToPoint]( [page:Vector2 point] )</h3>
<div>
Sets the upper and lower bounds of this box to include all of the points in *points*.
[page:Vector2 point] - [page:Vector2] to measure distance to.<br /><br />
Returns the distance from any edge of this box to the specified point.
If the [page:Vector2 point] lies inside of this box, the distance will be 0.
</div>
<h3>[method:Vector2 getSize]( [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
<h3>[method:Boolean equals]( [page:Box2 box] )</h3>
<div>
optionalTarget -- If specified, the result will be copied here.
[page:Box2 box] - Box to compare with this one.<br /><br />
Returns true if this box and [page:Box2 box] share the same lower and upper bounds.
</div>
<h3>[method:Box2 expandByPoint]( [page:Vector2 point] )</h3>
<div>
Returns the width and height of this box.
[page:Vector2 point] - [page:Vector2] that should be included in the box.<br /><br />
Expands the boundaries of this box to include [page:Vector2 point].
</div>
<h3>[method:Box2 union]( [page:Box2 box] ) [page:Box2 this]</h3>
<h3>[method:Box2 expandByScalar]( [page:float scalar] )</h3>
<div>
box -- Box that will be unioned with this box.
[page:float scalar] - Distance to expand the box by.<br /><br />
Expands each dimension of the box by [page:float scalar]. If negative, the dimensions of the box
will be contracted.
</div>
<h3>[method:Box2 expandByVector]( [page:Vector2 vector] )</h3>
<div>
Unions this box with *box* setting the upper bound of this box to the greater of the <br>
two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' <br>
lower bounds.
[page:Vector2 vector] - [page:Vector2] to expand the box by.<br /><br />
Expands this box equilaterally by [page:Vector2 vector]. The width of this box will be
expanded by the x component of [page:Vector2 vector] in both directions. The height of
this box will be expanded by the y component of [page:Vector2 vector] in both directions.
</div>
<h3>[method:Vector2 getParameter]( [page:Vector2 point], [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
<h3>[method:Vector2 getCenter]( [page:Vector2 optionalTarget] )</h3>
<div>
point -- [page:Vector2]<br/>
optionalTarget -- [page:Vector2]<br/>
[page:Vector2 optionalTarget] — (optional) if specified, the result will be copied into this Vector2,
otherwise a new Vector2 will be created. <br /><br />
Returns the center point of the box as a [page:Vector2].
</div>
<h3>[method:Vector2 getParameter]( [page:Vector2 point], [page:Vector2 optionalTarget] ) </h3>
<div>
[page:Vector2 point] - [page:Vector2].<br/>
[page:Vector2 optionalTarget] — (optional) if specified, the result will be copied into this Vector2,
otherwise a new Vector2 will be created. <br /><br />
Returns a point as a proportion of this box's width and height.
</div>
<h3>[method:Box2 expandByScalar]( [page:float scalar] ) [page:Box2 this]</h3>
<h3>[method:Vector2 getSize]( [page:Vector2 optionalTarget] )</h3>
<div>
scalar -- Distance to expand.
</div>
<div>
Expands each dimension of the box by *scalar*. If negative, the dimensions of the box <br>
will be contracted.
</div>
[page:Vector2 optionalTarget] — (optional) if specified, the result will be copied into this Vector2,
otherwise a new Vector2 will be created. <br /><br />
<h3>[method:Box2 intersect]( [page:Box2 box] ) [page:Box2 this]</h3>
<div>
box -- Box to intersect with.
Returns the width and height of this box.
</div>
<h3>[method:Box2 intersect]( [page:Box2 box] )</h3>
<div>
Returns the intersection of this and *box*, setting the upper bound of this box to the lesser <br>
of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' <br>
[page:Box2 box] - Box to intersect with.<br /><br />
Returns the intersection of this and [page:Box2 box], setting the upper bound of this box to the lesser
of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes'
lower bounds.
</div>
<h3>[method:Boolean containsBox]( [page:Box2 box] ) [page:Box2 this]</h3>
<div>
box -- Box to test for inclusion.
</div>
<h3>[method:Boolean intersectsBox]( [page:Box2 box] )</h3>
<div>
Returns true if this box includes the entirety of *box*. If this and *box* overlap exactly, <br>
this function also returns true.
</div>
[page:Box2 box] - Box to check for intersection against.<br /><br />
<h3>[method:Box2 translate]( [page:Vector2 offset] ) [page:Box2 this]</h3>
<div>
offset -- Direction and distance of offset.
</div>
<div>
Adds *offset* to both the upper and lower bounds of this box, effectively moving this box <br>
*offset* units in 2D space.
Determines whether or not this box intersects [page:Box2 box].
</div>
<h3>[method:Boolean isEmpty]() [page:Box2 this]</h3>
<h3>[method:Boolean isEmpty]()</h3>
<div>
Returns true if this box includes zero points within its bounds.<br>
Note that a box with equal lower and upper bounds still includes one point, the <br>
Note that a box with equal lower and upper bounds still includes one point, the
one both bounds share.
</div>
<h3>[method:Box2 clone]() [page:Box2 this]</h3>
<div>
Returns a copy of this box.
</div>
<h3>[method:Box2 makeEmpty]()</h3>
<div>Makes this box empty.</div>
<h3>[method:Boolean equals]( [page:Box2 box] ) [page:Box2 this]</h3>
<div>
box -- Box to compare.
</div>
<div>
Returns true if this box and *box* share the same lower and upper bounds.
</div>
<h3>[method:Box2 expandByVector]( [page:Vector2 vector] ) [page:Box2 this]</h3>
<div>
vector -- Amount to expand this box in each dimension.
</div>
<h3>[method:Box2 set]( [page:Vector2 min], [page:Vector2 max] )</h3>
<div>
Expands this box equilaterally by *vector*. The width of this box will be <br>
expanded by the x component of *vector* in both directions. The height of <br>
this box will be expanded by the y component of *vector* in both directions.
</div>
[page:Vector2 min] - (required ) [page:Vector2] representing the lower (x, y) boundary of the box. <br>
[page:Vector2 max] - (required) [page:Vector2] representing the lower upper (x, y) boundary of the box. <br /><br />
<h3>[method:Box2 copy]( [page:Box2 box] ) [page:Box2 this]</h3>
<div>
box -- Box to copy.
</div>
<div>
Copies the values of *box* to this box.
Sets the lower and upper (x, y) boundaries of this box.
</div>
<h3>[method:Box2 makeEmpty]() [page:Box2 this]</h3>
<h3>[method:Box2 setFromCenterAndSize]( [page:Vector2 center], [page:Vector2 size] )</h3>
<div>
Makes this box empty.
</div>
[page:Vector2 center] - Desired center position of the box ([page:Vector2]). <br>
[page:Vector2 size] - Desired x and y dimensions of the box ([page:Vector2]).<br /><br />
<h3>[method:Vector2 getCenter]( [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
<div>
optionalTarget -- If specified, the result will be copied here.
</div>
<div>
Returns the center point of this box.
Centers this box on [page:Vector2 center] and sets this box's width and height to the values specified
in [page:Vector2 size].
</div>
<h3>[method:Float distanceToPoint]( [page:Vector2 point] ) [page:Box2 this]</h3>
<h3>[method:Box2 setFromPoints]( [page:Array points] )</h3>
<div>
point -- Point to measure distance to.
</div>
<div>
Returns the distance from any edge of this box to the specified point. <br>
If the point lies inside of this box, the distance will be 0.
</div>
[page:Array points] - Array of [page:Vector2 Vector2s] that the resulting box will contain.<br /><br />
<h3>[method:Boolean containsPoint]( [page:Vector2 point] ) [page:Box2 this]</h3>
<div>
point -- [page:Vector2] to check for inclusion.
</div>
<div>
Returns true if the specified point lies within the boundaries of this box.
Sets the upper and lower bounds of this box to include all of the points in [page:Array points].
</div>
<h3>[method:Box2 setFromCenterAndSize]( [page:Vector2 center], [page:Vector2 size] ) [page:Box2 this]</h3>
<h3>[method:Box2 translate]( [page:Vector2 offset] )</h3>
<div>
center -- Desired center position of the box. <br>
size -- Desired x and y dimensions of the box.
[page:Vector2 offset] - Direction and distance of offset.<br /><br />
Adds [page:Vector2 offset] to both the upper and lower bounds of this box, effectively moving this box
[page:Vector2 offset] units in 2D space.
</div>
<h3>[method:Box2 union]( [page:Box2 box] )</h3>
<div>
Centers this box on *center* and sets this box's width and height to the values specified <br>
in *size*.
[page:Box2 box] - Box that will be unioned with this box.<br /><br />
Unions this box with [page:Box2 box], setting the upper bound of this box to the greater of the
two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes'
lower bounds.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -10,282 +10,276 @@
<body>
<h1>[name]</h1>
<div class="desc">Represents a boundary box in 3d space.</div>
<div class="desc">
Represents a box or cube in 3D space. The main purpose of this is to represent
the [link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Boxes]
for objects.
</div>
<h2>Constructor</h2>
<h3>[name]( [page:Vector3 min], [page:Vector3 max] )</h3>
<div>
min -- Lower (x, y, z) boundary of the box.<br>
max -- Upper (x, y, z) boundary of the box.
</div>
<div>
Creates a box bounded by min and max.
[page:Vector3 min] - (optional) [page:Vector3] representing the lower (x, y, z) boundary of the box.
Default is ( + Infinity, + Infinity, + Infinity ).<br>
[page:Vector3 max] - (optional) [page:Vector3] representing the lower upper (x, y, z) boundary of the box.
Default is ( - Infinity, - Infinity, - Infinity ).<br /><br />
Creates a [name] bounded by min and max.
</div>
<h2>Properties</h2>
<h3>[property:Boolean isBox3]</h3>
<div>
Used to check whether this or derived classes are Box3s. Default is *true*.<br /><br />
You should not change this, as it used internally for optimisation.
</div>
<h3>[property:Vector3 min]</h3>
<div>
Lower (x, y, z) boundary of this box.
[page:Vector3] representing the lower (x, y, z) boundary of the box.<br />
Default is ( + Infinity, + Infinity, + Infinity ).
</div>
<h3>[property:Vector3 max]</h3>
<div>
Upper (x, y, z) boundary of this box.
[page:Vector3] representing the lower upper (x, y, z) boundary of the box.<br />
Default is ( - Infinity, - Infinity, - Infinity ).
</div>
<h2>Methods</h2>
<h2>Methods</h2>
<h3>[method:Box3 set]( [page:Vector3 min], [page:Vector3 max] ) [page:Box3 this]</h3>
<h3>[method:Box3 applyMatrix4]( [page:Matrix4 matrix] )</h3>
<div>
min -- Lower (x, y, z) boundary of the box. <br>
max -- Upper (x, y, z) boundary of the box.
</div>
<div>
Sets the lower and upper (x, y, z) boundaries of this box.
</div>
[page:Matrix4 matrix] - The [page:Matrix4] to apply<br /><br />
<h3>[method:Box3 applyMatrix4]( [page:Matrix4 matrix] ) [page:Box3 this]</h3>
<div>
matrix -- The [page:Matrix4] to apply
</div>
<div>
Transforms this Box3 with the supplied matrix.
</div>
<h3>[method:Vector3 clampPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] ) [page:Box3 this]</h3>
<h3>[method:Vector3 clampPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<div>
point -- Position to clamp. <br>
optionalTarget -- If specified, the clamped result will be copied here.
</div>
<div>
Clamps *point* within the bounds of this box.
</div>
[page:Vector3 point] - [page:Vector3] to clamp. <br>
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created. <br /><br />
<h3>[method:Boolean intersectsBox]( [page:Box3 box] ) [page:Box3 this]</h3>
<div>
box -- Box to check for intersection against.
</div>
<div>
Determines whether or not this box intersects *box*.
[link:https://en.wikipedia.org/wiki/Clamping_(graphics) Clamps] the [page:Vector3 point] within the bounds of this box.<br />
</div>
<h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] ) [page:Box3 this]</h3>
<div>
sphere -- Sphere to check for intersection against.
</div>
<div>
Determines whether or not this box intersects *sphere*.
</div>
<h3>[method:Box3 clone]()</h3>
<div>Returns a new [page:Box3] with the same [page:.min min] and [page:.max max] as this one.</div>
<h3>[method:Boolean intersectsPlane]( [page:Plane plane] ) [page:Box3 this]</h3>
<div>
plane -- Plane to check for intersection against.
</div>
<h3>[method:Boolean containsBox]( [page:Box3 box] )</h3>
<div>
Determines whether or not this box intersects *plane*.
</div>
[page:Box3 box] - [page:Box3 Box3] to test for inclusion.<br /><br />
<h3>[method:Box3 setFromArray]( [page:Array array] ) [page:Box3 this]</h3>
<div>
array -- An array of position data that the resulting box will envelop.
</div>
<div>
Sets the upper and lower bounds of this box to include all of the data in *array*.
Returns true if this box includes the entirety of [page:Box3 box]. If this and [page:Box3 box] are identical, <br>
this function also returns true.
</div>
<h3>[method:Box3 setFromBufferAttribute]( [page:BufferAttribute attribute] ) [page:Box3 this]</h3>
<div>
buffer -- A buffer attribute of position data that the resulting box will envelop.
</div>
<h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
<div>
Sets the upper and lower bounds of this box to include all of the data in *attribute*.
</div>
[page:Vector3 point] - [page:Vector3] to check for inclusion.<br /><br />
<h3>[method:Box3 setFromPoints]( [page:Array points] ) [page:Box3 this]</h3>
<div>
points -- Set of points that the resulting box will envelop.
</div>
<div>
Sets the upper and lower bounds of this box to include all of the points in *points*.
Returns true if the specified [page:Vector3 point] lies within or on the boundaries of this box.
</div>
<h3>[method:Box3 setFromCenterAndSize]( [page:Vector3 center], [page:Vector3 size] ) [page:Box3 this]</h3>
<div>
center -- Desired center position of the box. <br>
size -- Desired x, y and z dimensions of the box.
</div>
<h3>[method:Box3 copy]( [page:Box3 box] )</h3>
<div>
Centers this box on *center* and sets this box's width, height and depth to the values specified <br>
in *size*.
</div>
[page:Box3 box] - [page:Box3] to copy.<br /><br />
<h3>[method:Box3 setFromObject]( [page:Object3D object] ) [page:Box3 this]</h3>
<div>
object -- [page:Object3D] to compute the bounding box for.
Copies the [page:.min min] and [page:.max max] from [page:Box3 box] to this box.
</div>
<h3>[method:Float distanceToPoint]( [page:Vector3 point] )</h3>
<div>
Computes the world-axis-aligned bounding box of an object (including its children), <br>
accounting for both the object's, and childrens', world transforms
</div>
[page:Vector3 point] - [page:Vector3] to measure distance to.<br /><br />
Returns the distance from any edge of this box to the specified point.
If the [page:Vector3 point] lies inside of this box, the distance will be 0.
</div>
<h3>[method:Vector3 getSize]( [page:Vector3 optionalTarget] ) [page:Box3 this]</h3>
<div>
optionalTarget -- If specified, the result will be copied here.
</div>
<h3>[method:Boolean equals]( [page:Box3 box] )</h3>
<div>
Returns the width, height, and depth of this box.
</div>
[page:Box3 box] - Box to compare with this one.<br /><br />
<h3>[method:Box3 union]( [page:Box3 box] ) [page:Box3 this]</h3>
<div>
box -- Box that will be unioned with this box.
Returns true if this box and [page:Box3 box] share the same lower and upper bounds.
</div>
<h3>[method:Box3 expandByPoint]( [page:Vector3 point] )</h3>
<div>
Unions this box with *box* setting the upper bound of this box to the greater of the <br>
two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' <br>
lower bounds.
[page:Vector3 point] - [page:Vector3] that should be included in the box.<br /><br />
Expands the boundaries of this box to include [page:Vector3 point].
</div>
<h3>[method:Vector3 getParameter]( [page:Vector3 point], [page:Vector3 optionalTarget] ) [page:Box3 this]</h3>
<h3>[method:Box3 expandByScalar]( [page:float scalar] )</h3>
<div>
point -- Point to parametrize.
optionalTarget -- If specified, the result will be copied here.
[page:float scalar] - Distance to expand the box by.<br /><br />
Expands each dimension of the box by [page:float scalar]. If negative, the dimensions of the box
will be contracted.
</div>
<h3>[method:Box3 expandByVector]( [page:Vector3 vector] )</h3>
<div>
Returns point as a proportion of this box's width and height.
[page:Vector3 vector] - [page:Vector3] to expand the box by.<br /><br />
Expands this box equilaterally by [page:Vector3 vector]. The width of this box will be
expanded by the x component of [page:Vector3 vector] in both directions. The height of
this box will be expanded by the y component of [page:Vector3 vector] in both directions.
The depth of this box will be expanded by the z component of *vector* in both directions.
</div>
<h3>[method:Box3 intersect]( [page:Box3 box] ) [page:Box3 this]</h3>
<h3>[method:Sphere getBoundingSphere]( [page:Sphere optionalTarget] )</h3>
<div>
box -- Box to intersect with.
[page:Sphere optionalTarget] — (optional) if specified, the result will be copied into this Sphere,
otherwise a new Sphere will be created. <br /><br />
Gets a [page:Sphere] that bounds the box.
</div>
<h3>[method:Vector3 getCenter]( [page:Vector3 optionalTarget] )</h3>
<div>
Returns the intersection of this and *box*, setting the upper bound of this box to the lesser <br>
of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' <br>
lower bounds.
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created. <br /><br />
Returns the center point of the box as a [page:Vector3].
</div>
<h3>[method:Boolean containsBox]( [page:Box3 box] ) [page:Box3 this]</h3>
<h3>[method:Vector3 getParameter]( [page:Vector3 point], [page:Vector3 optionalTarget] ) </h3>
<div>
box -- Box to test for inclusion.
[page:Vector3 point] - [page:Vector3].<br/>
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created. <br /><br />
Returns a point as a proportion of this box's width and height.
</div>
<h3>[method:Vector3 getSize]( [page:Vector3 optionalTarget] )</h3>
<div>
Returns true if this box includes the entirety of *box*. If this and *box* overlap exactly,<br>
this function also returns true.
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created. <br /><br />
Returns the width and height of this box.
</div>
<h3>[method:Boolean containsPoint]( [page:Vector3 point] ) [page:Box3 this]</h3>
<h3>[method:Box3 intersect]( [page:Box3 box] )</h3>
<div>
point -- [page:Vector3] to check for inclusion.
[page:Box3 box] - Box to intersect with.<br /><br />
Returns the intersection of this and [page:Box3 box], setting the upper bound of this box to the lesser
of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes'
lower bounds.
</div>
<h3>[method:Boolean intersectsBox]( [page:Box3 box] )</h3>
<div>
Returns true if the specified point lies within the boundaries of this box.
[page:Box3 box] - Box to check for intersection against.<br /><br />
Determines whether or not this box intersects [page:Box3 box].
</div>
<h3>[method:Box3 translate]( [page:Vector3 offset] ) [page:Box3 this]</h3>
<h3>[method:Boolean intersectsPlane]( [page:Plane plane] )</h3>
<div>
offset -- Direction and distance of offset.
[page:Plane plane] - [page:Plane] to check for intersection against.<br /><br />
Determines whether or not this box intersects [page:Plane plane].
</div>
<h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] )</h3>
<div>
Adds *offset* to both the upper and lower bounds of this box, effectively moving this box <br>
*offset* units in 3D space.
[page:Sphere sphere] - [page:Sphere] to check for intersection against.<br /><br />
Determines whether or not this box intersects [page:Sphere sphere].
</div>
<h3>[method:Boolean isEmpty]() [page:Box3 this]</h3>
<h3>[method:Boolean isEmpty]()</h3>
<div>
Returns true if this box includes zero points within its bounds.<br>
Note that a box with equal lower and upper bounds still includes one point, the <br>
one both bounds share.
Note that a box with equal lower and upper bounds still includes one point,
the one both bounds share.
</div>
<h3>[method:Box3 clone]() [page:Box3 this]</h3>
<div>
Returns a copy of this box.
</div>
<h3>[method:Box3 makeEmpty]()</h3>
<div>Makes this box empty.</div>
<h3>[method:Boolean equals]( [page:Box3 box] ) [page:Box3 this]</h3>
<div>
box -- Box to compare.
</div>
<h3>[method:Box3 set]( [page:Vector3 min], [page:Vector3 max] )</h3>
<div>
Returns true if this box and *box* share the same lower and upper bounds.
</div>
[page:Vector3 min] - [page:Vector3] representing the lower (x, y, z) boundary of the box.<br />
[page:Vector3 max] - [page:Vector3] representing the lower upper (x, y, z) boundary of the box.<br /><br />
<h3>[method:Box3 expandByPoint]( [page:Vector3 point] ) [page:Box3 this]</h3>
<div>
point -- Point that should be included in the box.
</div>
<div>
Expands the boundaries of this box to include *point*.
Sets the lower and upper (x, y, z) boundaries of this box.
</div>
<h3>[method:Box3 expandByScalar]( [page:float scalar] ) [page:Box3 this]</h3>
<div>
scalar -- Distance to expand.
</div>
<h3>[method:Box3 setFromArray]( [page:Array array] ) [page:Box3 this]</h3>
<div>
Expands each dimension of the box by *scalar*. If negative, the dimensions of the box <br/>
will be contracted.
</div>
array -- An array of position data that the resulting box will envelop.<br /><br />
<h3>[method:Box3 expandByVector]( [page:Vector3 vector] ) [page:Box3 this]</h3>
<div>
vector -- Amount to expand this box in each dimension.
</div>
<div>
Expands this box equilaterally by *vector*. The width of this box will be <br>
expanded by the x component of *vector* in both directions. The height of <br>
this box will be expanded by the y component of *vector* in both directions. <br>
The depth of this box will be expanded by the z component of *vector* in <br>
both directions.
Sets the upper and lower bounds of this box to include all of the data in *array*.
</div>
<h3>[method:Box3 copy]( [page:Box3 box] ) [page:Box3 this]</h3>
<div>
box -- Box to copy.
</div>
<h3>[method:Box3 setFromBufferAttribute]( [page:BufferAttribute attribute] ) [page:Box3 this]</h3>
<div>
Copies the values of *box* to this box.
</div>
[page:BufferAttribute attribute] - A buffer attribute of position data that the resulting box will envelop.<br /><br />
<h3>[method:Box3 makeEmpty]() [page:Box3 this]</h3>
<div>
Makes this box empty.
Sets the upper and lower bounds of this box to include all of the data in [page:BufferAttribute attribute].
</div>
<h3>[method:Vector3 getCenter]( [page:Vector3 optionalTarget] ) [page:Box3 this]</h3>
<h3>[method:Box3 setFromCenterAndSize]( [page:Vector3 center], [page:Vector3 size] )</h3>
<div>
optionalTarget -- If specified, the result will be copied here.
[page:Vector3 center] - Desired center position of the box ([page:Vector3]). <br>
[page:Vector3 size] - Desired x and y dimensions of the box ([page:Vector3]).<br /><br />
Centers this box on [page:Vector3 center] and sets this box's width and height to the values specified
in [page:Vector3 size].
</div>
<h3>[method:Box3 setFromCenterAndSize]( [page:Vector3 center], [page:Vector3 size] ) [page:Box3 this]</h3>
<div>
Returns the center point of this box.
[page:Vector3 center], - Desired center position of the box. <br>
[page:Vector3 size] - Desired x, y and z dimensions of the box.<br /><br />
Centers this box on [page:Vector3 center] and sets this box's width, height and depth to the values specified <br>
in [page:Vector3 size]
</div>
<h3>[method:Sphere getBoundingSphere]( [page:Sphere optionalTarget] ) [page:Box3 this]</h3>
<h3>[method:Box3 setFromObject]( [page:Object3D object] )</h3>
<div>
optionalTarget -- [page:Sphere] to optionally set the result to.
[page:Object3D object] - [page:Object3D] to compute the bounding box of.<br /><br />
Computes the world-axis-aligned bounding box of an [page:Object3D] (including its children),
accounting for the world transforms of both the object and its childrens.
</div>
<h3>[method:Box3 setFromPoints]( [page:Array points] )</h3>
<div>
Gets a sphere that bounds the box.
[page:Array points] - Array of [page:Vector3 Vector3s] that the resulting box will contain.<br /><br />
Sets the upper and lower bounds of this box to include all of the points in [page:Array points].
</div>
<h3>[method:Float distanceToPoint]( [page:Vector3 point] ) [page:Box3 this]</h3>
<h3>[method:Box3 translate]( [page:Vector3 offset] )</h3>
<div>
point -- Point to measure distance to.
[page:Vector3 offset] - Direction and distance of offset.<br /><br />
Adds [page:Vector3 offset] to both the upper and lower bounds of this box, effectively moving this box
[page:Vector3 offset] units in 2D space.
</div>
<h3>[method:Box3 union]( [page:Box3 box] )</h3>
<div>
Returns the distance from any edge of this box to the specified point. <br>
If the point lies inside of this box, the distance will be 0.
[page:Box3 box] - Box that will be unioned with this box.<br /><br />
Unions this box with [page:Box3 box], setting the upper bound of this box to the greater of the
two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes'
lower bounds.
</div>
<h2>Source</h2>
......
......@@ -11,51 +11,77 @@
<h1>[name]</h1>
<div class="desc">
Represents a color.
Class representing a color.
</div>
<h2>Example</h2>
<code>var color = new THREE.Color();</code>
<code>var color = new THREE.Color( 0xff0000 );</code>
<code>var color = new THREE.Color("rgb(255, 0, 0)");</code>
<code>var color = new THREE.Color("rgb(100%, 0%, 0%)");</code>
<code>var color = new THREE.Color("hsl(0, 100%, 50%)");</code>
<code>var color = new THREE.Color( 1, 0, 0 );</code>
<h2>Examples</h2>
A Color can be initialised in any of the following ways:
<code>
//empty constructor - will default white
var color = new THREE.Color();
//Hexadecimal color (recommended)
var color = new THREE.Color( 0xff0000 );
//RGB string
var color = new THREE.Color("rgb(255, 0, 0)");
var color = new THREE.Color("rgb(100%, 0%, 0%)");
//X11 color name - all 140 color names are supported.
//Note the lack of CamelCase in the name
var color = new THREE.Color( 'skyblue' );
//HSL string
var color = new THREE.Color("hsl(0, 100%, 50%)");
//Seperate RGB values between 0 and 1
var color = new THREE.Color( 1, 0, 0 );
</code>
<h2>Constructor</h2>
<h3>[name]( r, g, b )</h3>
<h3>[name]( [page:Multi r], [page:Float g], [page:Float b] )</h3>
<div>
r - the red component of the color if arguments g and b are defined. If they are not defined, it can be a hexadecimal or a CSS-style string or a Color instance.<br />
g - The green component of the color if it is defined.<br />
b - The blue component of the color if it is defined.
</div>
<div>
All arguments are optional. The default color is White.<br />
[page:Multi r] - (optional) the red component of the color if arguments g and b are defined.
If they are not defined, it can be a [link:https://en.wikipedia.org/wiki/Web_colors#Hex_triplet hexadecimal triplet] (recommended) or a CSS-style string or another Color instance.<br />
[page:Float g] - (optional) The green component of the color if it is defined.<br />
[page:Float b] - (optional) The blue component of the color if it is defined.<br /><br />
Note that standard method of specifying color in Three is with a [link:https://en.wikipedia.org/wiki/Web_colors#Hex_triplet hexadecimal triplet], and that method is used
throughout the rest of the documentation.<br /><br />
When all arguments are defined then r is the red component, g is the green component and b is the blue component of the color.<br />
When only r is defined:<br />
<ul>
<li>It can be a hexadecimal of the color.</li>
<li>It can be an another color instance.</li>
<li>It can be a CSS style. For Instance:
<li>It can be a [link:https://en.wikipedia.org/wiki/Web_colors#Hex_triplet hexadecimal triplet] representing the color (recommended).</li>
<li>It can be an another Color instance.</li>
<li>It can be a CSS style string. For Instance:
<ul>
<li>rgb(250, 0,0)</li>
<li>rgb(100%,0%,0%)</li>
<li>hsl(0, 100%, 50%)</li>
<li>#ff0000</li>
<li>#f00</li>
<li>red</li>
<li>'rgb(250, 0,0)'</li>
<li>'rgb(100%,0%,0%)'</li>
<li>'hsl(0, 100%, 50%)'</li>
<li>'#ff0000'</li>
<li>'#f00'</li>
<li>'red'</li>
</ul>
</li>
</ul>
</div>
<h2>Properties</h2>
<h3>[property:Boolean isColor]</h3>
<div>
Used to check whether this or derived classes are Colors. Default is *true*.<br /><br />
You should not change this, as it used internally for optimisation.
</div>
<h3>[property:Float r]</h3>
<div>
Red channel value between 0 and 1. Default is 1.
......@@ -71,183 +97,182 @@
Blue channel value between 0 and 1. Default is 1.
</div>
<h2>Methods</h2>
<h3>[method:Color set]( value ) [page:Color this]</h3>
<div>
value -- either an instance of [page:Color], a [page:Integer hexadecimal] value, or a css style [page:String string]
</div>
<div>
Delegates to .copy, .setStyle, or .setHex depending on input type.
</div>
<h3>[method:Color add]( [page:Color color] ) </h3>
<div>Adds the RGB values of [page:Color color] to the RGB values of this color.</div>
<h3>[method:Color copy]( [page:Color color] ) [page:Color this]</h3>
<div>
color — Color to copy.
</div>
<div>
Copies given color.
</div>
<h3>[method:Color addColors]( [page:Color color1], [page:Color color2] ) </h3>
<div>Sets this color's RGB values to the sum of the RGB values of [page:Color color1] and [page:Color color2].</div>
<h3>[method:Color fromArray]( [page:Array array], [page:Integer offset] ) [page:Color this]</h3>
<div>
array -- [page:Array] [r, g, b] <br />
offset -- [page:Integer] An optional offset into the array.
</div>
<div>
Sets this color's components based on an array formatted like [r, g, b]
</div>
<h3>[method:Color addScalar]( [page:Number s] ) </h3>
<div>Adds [page:Number s] to the RGB values of this color.</div>
<h3>[method:Color copyGammaToLinear]( [page:Color color] ) [page:Color this]</h3>
<div>
color — Color to copy.
</div>
<div>
Copies given color making conversion from gamma to linear space.
</div>
<h3>[method:Color clone]() </h3>
<div>Returns a new Color with the same [page:.r r], [page:.g g] and [page:.b b] parameters a this one.</div>
<h3>[method:Color copyLinearToGamma]( [page:Color color] ) [page:Color this]</h3>
<h3>[method:Color copy]( [page:Color color] ) </h3>
<div>
color — Color to copy.
</div>
<div>
Copies given color making conversion from linear to gamma space.
Copies the [page:.r r], [page:.g g] and [page:.b b] parameters from [page:Color color] in to this color.
</div>
<h3>[method:Color convertGammaToLinear]() [page:Color this]</h3>
<div>
Converts this color from gamma to linear space.
</div>
<h3>[method:Color convertGammaToLinear]() </h3>
<div>Converts this color from gamma to linear space (squares the values of [page:.r r], [page:.g g] and [page:.b b] ).</div>
<h3>[method:Color convertLinearToGamma]() </h3>
<div>Converts this color from linear to gamma space (takes the squareroot of [page:.r r], [page:.g g] and [page:.b b]).</div>
<h3>[method:Color convertLinearToGamma]() [page:Color this]</h3>
<h3>[method:Color copyGammaToLinear]( [page:Color color], [page:Float gammaFactor] ) </h3>
<div>
Converts this color from linear to gamma space.
[page:Color color] — Color to copy.<br />
[page:Float gammaFactor] - (optional). Default is *2.0*.<br /><br />
Copies given color making conversion from gamma to linear space,
by taking [page:.r r], [page:.g g] and [page:.b b] to the power of [page:Float gammaFactor].
</div>
<h3>[method:Color setRGB]( [page:Float r], [page:Float g], [page:Float b] ) [page:Color this]</h3>
<h3>[method:Color copyLinearToGamma]( [page:Color color], [page:Float gammaFactor] ) </h3>
<div>
r — Red channel value between 0 and 1.<br />
g — Green channel value between 0 and 1.<br />
b — Blue channel value between 0 and 1.
[page:Color color] — Color to copy.<br />
[page:Float gammaFactor] - (optional). Default is *2.0*.<br /><br />
Copies given color making conversion from linear to gamma space,
by taking [page:.r r], [page:.g g] and [page:.b b] to the power of 1 / [page:Float gammaFactor].
</div>
<h3>[method:Boolean equals]( [page:Color color] ) </h3>
<div>Compares [page:Color color] with this one and returns true if they are the same, false otherwise.</div>
<h3>[method:Color fromArray]( [page:Array array], [page:Integer offset] ) </h3>
<div>
Sets this color from RGB values.
[page:Array array] - [page:Array] of float in the form [ [page:Float r], [page:Float g], [page:Float b] ].<br />
[page:Integer offset] - An optional offset into the array.<br /><br />
Sets this color's components based on an array formatted like [ [page:Float r], [page:Float g], [page:Float b] ].
</div>
<h3>[method:Integer getHex]()</h3>
<div>
Returns the hexadecimal value of this color.
</div>
<div>Returns the hexadecimal value of this color.</div>
<h3>[method:String getHexString]()</h3>
<div>
Returns the string formated hexadecimal value of this color.
</div>
<div>Returns the string formatted hexadecimal value of this color.</div>
<h3>[method:Color setHex]( [page:Integer hex] ) [page:Color this]</h3>
<div>
hex — Color in hexadecimal.<br />
</div>
<h3>[method:Object getHSL]( [page:Object optionalTarget] )</h3>
<div>
Sets this color from a hexadecimal value.
</div>
[page:Object optionalTarget] — (optional) if specified, adds h, s and l keys to object (if not already present)
and sets the results there, otherwise a new Object will be created. <br /><br />
Convert the values [page:.r r], [page:.g g] and [page:.b b] to [link:https://en.wikipedia.org/wiki/HSL_and_HSV HSL]
format and returns an object of the form:
<code>
{ h: 0, s: 0, l: 0 }
</code>
<h3>[method:Color setStyle]( [page:String style] ) [page:Color this]</h3>
<div>
style — color as a CSS-style string.
</div>
<div>
Sets this color from a CSS-style string. For example, "rgb(250, 0,0)", "rgb(100%, 0%, 0%)", "hsl(0, 100%, 50%)", "#ff0000", "#f00", or "red". Transluent colors such as "rgba(255, 0, 0, 0.5)" and "hsla(0, 100%, 50%, 0.5)" are also accepted, but the alpha-channel coordinate will be discarded.
</div>
<h3>[method:String getStyle]()</h3>
<div>
Returns the value of this color as a CSS-style string. Example: rgb(255,0,0)
</div>
<div>Returns the value of this color as a CSS-style string. Example: 'rgb(255,0,0)'.</div>
<h3>[method:Color setScalar]( [page:Float scalar] ) [page:Color this]</h3>
<div>
scalar — a value between 0.0 and 1.0.
</div>
<h3>[method:Color lerp]( [page:Color color], [page:Float alpha] ) </h3>
<div>
Sets all three color components to the value *scalar*.
</div>
[page:Color color] - color to converge on.<br />
[page:Float alpha] - interpolation factor in the closed interval [0, 1].<br /><br />
<h3>[method:Color setHSL]( [page:Float h], [page:Float s], [page:Float l] ) [page:Color this]</h3>
<div>
h — hue value between 0.0 and 1.0 <br />
s — saturation value between 0.0 and 1.0 <br />
l — lightness value between 0.0 and 1.0
</div>
<div>
Sets color from hsl
Linear interpolation of this colors RGB values and the RGB values of the passed argument.
The alpha argument can be thought of as the percent between the two colors, where 0 is
this color and 1 is the first argument.
</div>
<h3>[method:Object getHSL]() [page:Object hsl]</h3>
<div>
Returns an object with properties h, s, and l.
</div>
<h3>[method:Color multiply]( [page:Color color] ) </h3>
<div>Multiplies this color's RGB values by given [page:Color color]'s RGB values.</div>
<h3>[method:Color offsetHSL]( [page:Float h], [page:Float s], [page:Float l] ) [page:Color this]</h3>
<div>
Adds given h, s, and l to this color's existing h, s, and l values.
</div>
<h3>[method:Color multiplyScalar]( [page:Number s] ) </h3>
<div>Multiplies this color's RGB values by [page:Number s].</div>
<h3>[method:Color sub]( [page:Color color] ) [page:Color this]</h3>
<h3>[method:Color offsetHSL]( [page:Float h], [page:Float s], [page:Float l] ) </h3>
<div>
Subtracts rgb components of given color from rgb components of this color. If a component is negative, it is set to zero.
Adds given [page:Float h], [page:Float s], and [page:Float l] to this color's existing values.
Internally this converts the [page:.r r], [page:.g g] and [page:.b b] values to HSL, adds
[page:Float h], [page:Float s], and [page:Float l] and then converts back to RGB.
</div>
<h3>[method:Color add]( [page:Color color] ) [page:Color this]</h3>
<h3>[method:Color set]( [page:Multi value] ) </h3>
<div>
Adds rgb values of given color to rgb values of this color
</div>
[page:Multi value] - Value to set this color to.<br /><br />
<h3>[method:Color addColors]( [page:Color color1], [page:Color color2] ) [page:Color this]</h3>
<div>
Sets this color to the sum of color1 and color2
See the Constructor above for full details of what [page:Multi value] can be.
Delegates to [page:.copy], .setStyle, or .setHex depending on input type.
</div>
<h3>[method:Color addScalar]( [page:Number s] ) [page:Color this]</h3>
<h3>[method:Color setHex]( [page:Integer hex] ) </h3>
<div>
Adds s to the rgb values of this color
</div>
[page:Integer hex] — [link:https://en.wikipedia.org/wiki/Web_colors#Hex_triplet hexadecimal triplet] format.<br /><br />
<h3>[method:Color multiply]( [page:Color color] ) [page:Color this]</h3>
<div>
Multiplies this color's rgb values by given color's rgb values
Sets this color from a hexadecimal value.
</div>
<h3>[method:Color multiplyScalar]( [page:Number s] ) [page:Color this]</h3>
<h3>[method:Color setHSL]( [page:Float h], [page:Float s], [page:Float l] ) </h3>
<div>
Multiplies this color's rgb values by s
</div>
[page:Float h] — hue value between 0.0 and 1.0 <br />
[page:Float s] — saturation value between 0.0 and 1.0 <br />
[page:Float l] — lightness value between 0.0 and 1.0<br /><br />
<h3>[method:Color lerp]( [page:Color color], alpha ) [page:Color this]</h3>
<div>
alpha -- a number between 0 and 1.
Sets color from HSL values.
</div>
<h3>[method:Color setRGB]( [page:Float r], [page:Float g], [page:Float b] ) </h3>
<div>
Linear interpolation of this colors rgb values and the rgb values of the first argument. The alpha argument can be thought of as the percent between the two colors, where 0 is this color and 1 is the first argument.
[page:Float r] — Red channel value between 0 and 1.<br />
[page:Float g] — Green channel value between 0 and 1.<br />
[page:Float b] — Blue channel value between 0 and 1.<br /><br />
Sets this color from RGB values.
</div>
<h3>[method:Boolean equals]( [page:Color c] ) [page:Color this]</h3>
<h3>[method:Color setScalar]( [page:Float scalar] ) </h3>
<div>
Compares this color and c and returns true if they are the same, false otherwise.
[page:Float scalar] — a value between 0.0 and 1.0.<br /><br />
Sets all three color components to the value [page:Float scalar].
</div>
<h3>[method:Color clone]() [page:Color this]</h3>
<h3>[method:Color setStyle]( [page:String style] ) </h3>
<div>
Clones this color.
[page:String style] — color as a CSS-style string.<br /><br />
Sets this color from a CSS-style string. For example,
"rgb(250, 0,0)",
"rgb(100%, 0%, 0%)",
"hsl(0, 100%, 50%)",
"#ff0000",
"#f00", or
"red" ( or any [link:https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart X11 color name]
- all 140 color names are supported ).<br />
Transluent colors such as "rgba(255, 0, 0, 0.5)" and "hsla(0, 100%, 50%, 0.5)" are also accepted,
but the alpha-channel coordinate will be discarded.<br /><br />
Note that for X11 color names, multiple words such as Dark Orange become the string 'darkorange' (all lowercase).
</div>
<h3>[method:Array toArray]( [page:Array array], [page:Integer offset] ) [page:Color this]</h3>
<h3>[method:Color sub]( [page:Color color] ) </h3>
<div>
array -- An optional array to store the color to. <br />
offset -- An optional offset into the array.
Subtracts RGB components of the given color from the RGB components of this color.
If a component is negative, it is set to zero.
</div>
<h3>[method:Array toArray]( [page:Array array], [page:Integer offset] ) </h3>
<div>
Returns an array [r,g,b]
[page:Array array] - An optional array to store the color to. <br />
[page:Integer offset] - An optional offset into the array.<br /><br />
Returns an array of the form [ r, g, b ].
</div>
<h2>Source</h2>
......
......@@ -10,17 +10,20 @@
<body>
<h1>[name]</h1>
<div class="desc">A point's cylindrical coordinates.</div>
<div class="desc">
A point's [link:https://en.wikipedia.org/wiki/Cylindrical_coordinate_system cylindrical coordinates].
</div>
<h2>Constructor</h2>
<h3>[name]( [page:Float radius], [page:Float theta], [page:Float y] )</h3>
<div>
radius -- [page:Float] distance from the origin to a point in the x-z plane<br />
theta -- [page:Float] counterclockwise angle in the x-z plane measured in radians from the positive z-axis<br />
y -- [page:Float] height above the x-z plane
[page:Float radius] - distance from the origin to a point in the x-z plane.
Default is *1.0*.<br />
[page:Float theta] - counterclockwise angle in the x-z plane measured in radians
from the positive z-axis. Default is *0*.<br />
[page:Float y] - height above the x-z plane. Default is *0*.
</div>
......@@ -35,24 +38,30 @@
<h2>Methods</h2>
<h3>[method:Cylindrical set]( [page:Float radius], [page:Float theta], [page:Float y] ) [page:Cylindrical this]</h3>
<h3>[method:Cylindrical clone]()</h3>
<div>
Sets values of this cylindrical's component coordinates.
Returns a new cylindrical with the same [page:.radius radius], [page:.theta theta]
and [page:.y y] properties as this one.
</div>
<h3>[method:Cylindrical copy]( [page:Cylindrical c] ) [page:Cylindrical this]</h3>
<h3>[method:Cylindrical copy]( [page:Cylindrical other] )</h3>
<div>
Copies value of *c* to this cylindrical.
Copies the values of the passed Cylindrical's [page:.radius radius], [page:.theta theta]
and [page:.y y] properties to this cylindrical.
</div>
<h3>[method:Cylindrical clone]() [page:Cylindrical this]</h3>
<div>
Clones this cylindrical.
</div>
<h3>[method:Cylindrical set]( [page:Float radius], [page:Float phi], [page:Float theta] )</h3>
<div>Sets values of this cylindrical's [page:.radius radius], [page:.theta theta]
and [page:.y y] properties.</div>
<h3>[method:Cylindrical setFromVector3]( [page:Vector3 v] ) [page:Cylindrical this]</h3>
<h3>[method:Cylindrical setFromVector3]( [page:Vector3 vec3] )</h3>
<div>
Sets this object from the vector *v*.
Sets values of this cylindrical's [page:.radius radius], [page:.theta theta]
and [page:.y y] properties from the [page:Vector3 Vector3].<br /><br />
The [page:.radius radius] is set the vector's distance from the origin as measured along
the the x-z plane, while [page:.theta theta] is set from its direction on
the the x-z plane and [page:.y y] is set from the vector's y component.
</div>
<h2>Source</h2>
......
......@@ -10,10 +10,11 @@
<body>
<h1>[name]</h1>
<div class="desc">Euler Angles. <br/><br/>
<div class="desc">A class representing [link:http://en.wikipedia.org/wiki/Euler_angles Euler Angles].<br /><br />
Euler angles describe a rotation transformation by rotating an object on its various axes in specified amounts per axis, and a specified axis order.
(More information on <a href='http://en.wikipedia.org/wiki/Euler_angles' target='blank'>Wikipedia</a>)</div>
Euler angles describe a rotational transformation by rotating an object on its various
axes in specified amounts per axis, and a specified axis order.
</div>
<h2>Example</h2>
......@@ -28,114 +29,149 @@
<h3>[name]( [page:Float x], [page:Float y], [page:Float z], [page:String order] )</h3>
<div>
x -- [page:Float] the angle of the x axis in radians<br />
y -- [page:Float] the angle of the y axis in radians<br />
z -- [page:Float] the angle of the z axis in radians<br />
order -- [page:String] A string representing the order that the rotations are applied, defaults to 'XYZ' (must be upper case).
</div>
<div>
A euler angle for transforming
[page:Float x] - (optional) the angle of the x axis in radians. Default is *0*.<br />
[page:Float y] - (optional) the angle of the y axis in radians. Default is *0*.<br />
[page:Float z] - (optional) the angle of the z axis in radians. Default is *0*.<br />
[page:String order] - (optional) a string representing the order that the rotations are applied,
defaults to 'XYZ' (must be upper case).<br /><br />
</div>
<h2>Properties</h2>
<h3>[property:Float x]</h3>
<h3>[property:Float y]</h3>
<h3>[property:Boolean isEuler]</h3>
<div>
Used to check whether this or derived classes are Eulers. Default is *true*.<br /><br />
<h3>[property:Float z]</h3>
You should not change this, as it used internally for optimisation.
</div>
<h3>[property:String order]</h3>
<h2>Methods</h2>
<h3>[method:Euler set]( [page:Float x], [page:Float y], [page:Float z], [page:String order] ) [page:Euler this]</h3>
<div>
x -- [page:Float] Angle in x axis in radians<br />
y -- [page:Float] Angle in y axis in radians<br />
z -- [page:Float] Angle in z axis in radians<br />
order -- [page:string] Order of axes, defaults to 'XYZ' (must be upper case)
</div>
<div>
Sets the angles of this euler transform.
</div>
The order in which to apply rotations. Default is 'XYZ', which means that the object will first be
rotated around its X axis, then its Y axis and finally its Z axis. Other possibilities are:
'YZX', 'ZXY', 'XZY', 'YXZ' and 'ZYX'. Note that these must be in upper case.<br /><br />
<h3>[method:Euler copy]( [page:Euler euler] ) [page:Euler this]</h3>
<div>
Copies value of *euler* to this euler.
If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
</div>
<h3>[method:Euler setFromRotationMatrix]( [page:Matrix4 m], [page:String order] ) [page:Euler this]</h3>
<div>
m -- [page:Matrix4] assumes upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled)<br />
order -- [page:string] Order of axes, defaults to 'XYZ' (must be upper case)
</div>
<h3>[property:Float x]</h3>
<div>
Sets the angles of this euler transform from a pure rotation matrix based on the orientation specified by order.
</div>
The current value of the x component.<br /><br />
<h3>[method:Euler setFromQuaternion]( [page:Quaternion q], [page:String order] ) [page:Euler this]</h3>
<div>
q -- [page:Quaternion] quaternion must be normalized<br />
order -- [page:string] Order of axes, defaults to 'XYZ' (must be upper case)
If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
</div>
<h3>[property:Float y]</h3>
<div>
Sets the angles of this euler transform from a normalized quaternion based on the orientation specified by order.
The current value of the y component.<br /><br />
If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
</div>
<h3>[method:Euler reorder]( [page:String newOrder] ) [page:Euler this]</h3>
<h3>[property:Float z]</h3>
<div>
Resets the euler angle with a new order by creating a quaternion from this euler angle and then setting this euler angle with the quaternion and the new order. <br />
WARNING: this discards revolution information.
The current value of the z component.<br /><br />
If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
</div>
<h3>[method:Euler setFromVector3]( [page:Vector3 vector], [page:String order] ) [page:Euler this]</h3>
<h2>Methods</h2>
<h3>[method:Euler copy]( [page:Euler euler] )</h3>
<div>Copies value of [page:Euler euler] to this euler.</div>
<h3>[method:Euler clone]()</h3>
<div>Returns a new Euler with the same parameters as this one.</div>
<h3>[method:Boolean equals]( [page:Euler euler] )</h3>
<div>Checks for strict equality of this euler and [page:Euler euler].</div>
<h3>[method:Euler fromArray]( [page:Array array] )</h3>
<div>
vector -- [page:Vector3].
order -- [page:string] Order of axes, defaults to 'XYZ' (must be upper case)
[page:Array array] of length 3 or 4. The optional 4th argument corresponds to the [page:.order order].<br /><br />
Assigns this euler's [page:.x x] angle to array[0]. <br />
Assigns this euler's [page:.y y] angle to array[1]. <br />
Assigns this euler's [page:.z z] angle to array[2]. <br />
Optionally assigns this euler's [page:.order order] to array[3].
</div>
<h3>[method:Euler onChange]( [page:Function onChangeCallback] )</h3>
<div>
Optionally Vector3 to the XYZ parameters of Euler, and order to the Euler's order property.
[page:Function onChangeCallback] - set the value of the onChangeCallback() function.
</div>
<h3>[method:Vector3 toVector3]()</h3>
<h3>[method:Euler onChangeCallback]( )</h3>
<div>
Returns the Euler's XYZ properties as a Vector3.
By default this is an empty function, however it can be set via [page:.onChange onChange]().<br />
It gets called after changing the [page:.x x], [page:.y y], [page:.z z] or [page:.order order] properties,
and also after calling most setter functions (see those for details).
</div>
<h3>[method:Euler fromArray]( [page:Array array] ) [page:Euler this]</h3>
<h3>[method:Euler reorder]( [page:String newOrder] )</h3>
<div>
array -- [page:Array] of length 3 or 4. array[3] is an optional order argument.
Resets the euler angle with a new order by creating a quaternion from this euler angle
and then setting this euler angle with the quaternion and the new order. <br /><br />
<em>WARNING</em>: this discards revolution information.
</div>
<h3>[method:Euler set]( [page:Float x], [page:Float y], [page:Float z], [page:String order] )</h3>
<div>
Assigns this euler's x angle to array[0]. <br />
Assigns this euler's y angle to array[1]. <br />
Assigns this euler's z angle to array[2]. <br />
Optionally assigns this euler's order to array[3].
[page:.x x] - the angle of the x axis in radians.<br />
[page:.y y] - the angle of the y axis in radians.<br />
[page:.z z] - the angle of the z axis in radians.<br />
[page:.order order] - (optional) a string representing the order that the rotations are applied.<br /><br />
Sets the angles of this euler transform and optionally the [page:.order order] and then call [page:.onChangeCallback onChangeCallback]().
</div>
<h3>[method:Array toArray]( [page:Array array] )</h3>
<h3>[method:Euler setFromRotationMatrix]( [page:Matrix4 m], [page:String order], [page:Boolean update] )</h3>
<div>
array -- Optional array to store the euler.
[page:Matrix4 m] - a [page:Matrix4] of which the upper 3x3 of matrix is a pure
[link:https://en.wikipedia.org/wiki/Rotation_matrix rotation matrix] (i.e. unscaled).<br />
[page:.order order] - (optional) a string representing the order that the rotations are applied.<br />
[page:Boolean update] - (optional) whether to call [page:.onChangeCallback onChangeCallback]() after applying
the matrix.<br /><br />
Sets the angles of this euler transform from a pure rotation matrix based on the orientation
specified by order.
</div>
<h3>[method:Euler setFromQuaternion]( [page:Quaternion q], [page:String order], [page:Boolean update] )</h3>
<div>
Returns an array [x, y, z, order]
[page:Quaternion q] - a normalized quaternion.<br />
[page:.order order] - (optional) a string representing the order that the rotations are applied.<br />
[page:Boolean update] - (optional) whether to call [page:.onChangeCallback onChangeCallback]() after applying
the matrix.<br /><br />
Sets the angles of this euler transform from a normalized quaternion based on the orientation
specified by [page:.order order].
</div>
<h3>[method:Boolean equals]( [page:Euler euler] )</h3>
<h3>[method:Euler setFromVector3]( [page:Vector3 vector], [page:String order] )</h3>
<div>
Checks for strict equality of this euler and *euler*.
[page:Vector3 vector] - [page:Vector3].<br />
[page:.order order] - (optional) a string representing the order that the rotations are applied.<br /><br />
Set the [page:.x x], [page:.y y] and [page:.z z], and optionally update the [page:.order order]. [page:.onChangeCallback onChangeCallback]()
is called after these changes are made.
</div>
<h3>[method:Euler clone]()</h3>
<h3>[method:Array toArray]( [page:Array array], [page:Integer offset] )</h3>
<div>
Returns a new euler created from this euler.
</div>
[page:Array array] - (optional) array to store the euler in.<br />
[page:Integer offset] (optional) offset in the array.<br />
Returns an array of the form [[page:.x x], [page:.y y], [page:.z z], [page:.order order ]].
</div>
<h3>[method:Vector3 toVector3]()</h3>
<div>Returns the Euler's [page:.x x], [page:.y y] and [page:.z z] properties as a [page:Vector3].</div>
<h2>Source</h2>
......
......@@ -10,7 +10,14 @@
<body>
<h1>[name]</h1>
<div class="desc"><a href="http://en.wikipedia.org/wiki/Frustum">Frustums</a> are used to determine what is inside the camera's field of view. They help speed up the rendering process.</div>
<div class="desc">
[link:http://en.wikipedia.org/wiki/Frustum Frustums] are used to determine what is
inside the camera's field of view. They help speed up the rendering process - object which lie
outside a camera's frustum can safely be excluded from rendering.<br /><br />
This class is mainly intended for use internally by a renderer for calculating
a [page:Camera camera] or [page:LightShadow.camera shadowCamera]'s frustum.
</div>
<h2>Constructor</h2>
......@@ -18,85 +25,95 @@
<h3>[name]([page:Plane p0], [page:Plane p1], [page:Plane p2], [page:Plane p3], [page:Plane p4], [page:Plane p5])</h3>
<div>
p0 -- [page:Plane] <br />
p1 -- [page:Plane] <br />
p2 -- [page:Plane] <br />
p3 -- [page:Plane] <br />
p4 -- [page:Plane] <br />
p5 -- [page:Plane]
</div>
<div>
Creates a frustum from the designated planes.
[page:Plane p0] - (optional) defaults to a new [page:Plane].<br />
[page:Plane p1] - (optional) defaults to a new [page:Plane].<br />
[page:Plane p2] - (optional) defaults to a new [page:Plane].<br />
[page:Plane p3] - (optional) defaults to a new [page:Plane].<br />
[page:Plane p4] - (optional) defaults to a new [page:Plane].<br />
[page:Plane p5] - (optional) defaults to a new [page:Plane].<br /><br />
Creates a new [name].
</div>
<h2>Properties</h2>
<h3>[property:Array planes]</h3>
<div>
Array of 6 [page:Plane planes].
</div>
<div>Array of 6 [page:Plane planes].</div>
<h2>Methods</h2>
<h3>[method:Frustum setFromMatrix]( [page:Matrix4 matrix] )</h3>
<h3>[method:Frustum clone]()</h3>
<div>Return a new Frustum with the same parameters as this one.</div>
<h3>[method:Boolean intersectsObject]( [page:Object3D object] )</h3>
<div>
Checks whether the object's bounding sphere is intersecting the Frustum.
</div>
<h3>[method:Frustum clone]()</h3>
<h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
<div>
Return a copy of this Frustum
</div>
[page:Vector3 point] - [page:Vector3] to test.<br /><br />
<h3>[method:Frustum set]( [page:Plane p0], [page:Plane p1], [page:Plane p2], [page:Plane p3], [page:Plane p4], [page:Plane p5] )</h3>
<div>
p0 -- [page:Plane] <br />
p1 -- [page:Plane] <br />
p2 -- [page:Plane] <br />
p3 -- [page:Plane] <br />
p4 -- [page:Plane] <br />
p5 -- [page:Plane]
</div>
<div>
Sets the current frustum from the passed planes. No plane order is implicitely implied.
Checks to see if the frustum contains the [page:Vector3 point].
</div>
<h3>[method:Frustum copy]( [page:Frustum frustum] ) [page:Frustum this]</h3>
<h3>[method:Frustum copy]( [page:Frustum frustum] )</h3>
<div>
frustum -- The frustum to copy
</div>
<div>
Copies the values of the passed frustum.
[page:Frustum frustum] - The frustum to copy<br /><br />
Copies the properties of the passed [page:Frustum frustum] into this one.
</div>
<h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
<h3>[method:Boolean intersectsBox]( [page:Box3 box] )</h3>
<div>
point -- [page:Vector3] to test
[page:Box3 box] - [page:Box3] to check for intersection.<br /><br />
Return true if [page:Box3 box] intersects with this frustum.
</div>
<h3>[method:Boolean intersectsObject]( [page:Object3D object] )</h3>
<div>
Checks to see if the frustum contains the point.
Checks whether the [page:Object3D object]'s [page:Geometry.boundingSphere bounding sphere] is intersecting the Frustum.<br /><br />
Note that the object must have a [page:Geometry] or [page:BufferGeometry] so that the bounding sphere
can be calculated.
</div>
<h3>[method:Boolean intersectsBox]( [page:Box3 box] )</h3>
<h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] )</h3>
<div>
box -- [page:Box3]
[page:Sphere sphere] - [page:Sphere] to check for intersection.<br /><br />
Return true if [page:Sphere sphere] intersects with this frustum.
</div>
<h3>[method:Boolean intersectsSprite]( [page:Sprite sprite] )</h3>
<div>
Check to see if the box intersects with the frustum.
Checks whether the [page:Sprite sprite] is intersecting the Frustum.<br /><br />
</div>
<h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] )</h3>
<h3>[method:Frustum set]( [page:Plane p0], [page:Plane p1], [page:Plane p2], [page:Plane p3], [page:Plane p4], [page:Plane p5] )</h3>
<div>
sphere -- [page:Sphere]
Sets the current frustum from the passed planes. No plane order is implicitely implied.
</div>
<h3>[method:Frustum setFromMatrix]( [page:Matrix4 matrix] )</h3>
<div>
Check to see if the sphere intersects with the frustum.
[page:Matrix4 matrix] - [page:Matrix4] used to set the [page:.planes planes]<br /><br />
This is used by the [page:WebGLRenderer] to set up the Frustum from a [page:Camera Camera's]
[page:Camera.projectionMatrix projectionMatrix] and [page:Camera.matrixWorldInverse matrixWorldInverse].
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -18,116 +18,106 @@
<h3>[name]( [page:Vector3 start], [page:Vector3 end] )</h3>
<div>
start -- [page:Vector3] Start of the line segment<br />
end -- [page:Vector3] End of the line segment
</div>
<div>
The start and end vectors default to origin vectors if none are set.
[page:Vector3 start] - Start of the line segment. Default is (0, 0, 0).<br />
[page:Vector3 end] - End of the line segment. Default is (0, 0, 0).<br /><br />
Creates a new [name].
</div>
<h2>Properties</h2>
<h3>[property:Vector3 start]</h3>
<div>[page:Vector3] representing the start point of the line.</div>
<h3>[property:Vector3 end]</h3>
<div>[page:Vector3] representing the end point of the line.</div>
<h2>Methods</h2>
<h3>[method:Line3 set]( [page:Vector3 start], [page:Vector3 end] )</h3>
<div>
start -- [page:Vector3] <br />
end -- [page:Vector3]
</div>
<div>
Sets the start and end values by copying the provided vectors.
</div>
<h3>[method:Line3 copy]( [page:Line3 line] )</h3>
<div>
line -- [page:Line3]
</div>
<h2>Methods</h2>
<h3>[method:Line3 applyMatrix4]( [page:Matrix4 matrix] )</h3>
<div>Apply a matrix transform to the line segment.</div>
<h3>[method:Vector3 at]( [page:Float t], [page:Vector3 optionalTarget] )</h3>
<div>
Copies the passed line's start and end vectors to this line.
[page:Float t] - Use values 0-1 to return a position along the line segment. <br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
Return a vector at a certain position along the line. When [page:Float t] = 0, it returns the start vector,
and when [page:Float t] = 1 it returns the end vector.<br />
</div>
<h3>[method:Line3 clone]()</h3>
<div>Return a new [page:Line3] with the same [page:.start start] and [page:.end end] vectors as this one.</div>
<h3>[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Boolean clampToLine], [page:Vector3 optionalTarget] )</h3>
<div>
Return a new copy of this [page:Line3].
[page:Vector3 point] - return the closest point on the line to this point.<br />
[page:Boolean clampToLine] - whether to clamp the returned value to the line segment.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
Returns the closets point on the line. If [page:Boolean clampToLine] is true, then the returned value will be
clamped to the line segment.
</div>
<h3>[method:Boolean equals]( [page:Line3 line] )</h3>
<h3>[method:Float closestPointToPointParameter]( [page:Vector3 point], [page:Boolean clampToLine] )</h3>
<div>
line -- [page:Line3]
[page:Vector3 point] - the point for which to return a point parameter. <br />
[page:Boolean clampToLine] - Whether to clamp the result to the range [0, 1].<br /><br />
Returns a point parameter based on the closest point as projected on the line segement.
If clamp to line is true, then the returned value will be between 0 and 1.
</div>
<h3>[method:Line3 copy]( [page:Line3 line] )</h3>
<div>Copies the passed line's [page:.start start] and [page:.end end] vectors to this line.</div>
<h3>[method:Vector3 delta]( [page:Vector3 optionalTarget] )</h3>
<div>
Returns true if both line's start and end points are equal.
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
Returns the delta vector of the line segment ( [page:.end end] vector minus the [page:.start start] vector).
</div>
<h3>[method:Float distance]()</h3>
<div>
Returns the length of the line segment.
</div>
<div>Returns the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance]
(straight-line distance) between the line's [page:.start start] and [page:.end end] points.</div>
<h3>[method:Float distanceSq]()</h3>
<div>
Returns the line segment's length squared.
Returns the square of the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance]
(straight-line distance) between the line's [page:.start start]
and [page:.end end] vectors.
</div>
<h3>[method:Line3 applyMatrix4]( [page:Matrix4 matrix] ) [page:Line3 this]</h3>
<div>
matrix -- [page:Matrix4]
</div>
<h3>[method:Boolean equals]( [page:Line3 line] )</h3>
<div>
Apply a matrix transform to the line segment.
</div>
[page:Line3 line] - [page:Line3] to compare with this one.<br /><br />
<h3>[method:Vector3 at]( [page:Float t], [page:Vector3 optionalTarget] )</h3>
<div>
t -- [page:Float] Use values 0-1 to return a result on the line segment. <br />
optionalTarget -- [page:Vector] Optional target to set the result.
</div>
<div>
Return a vector at a certain position along the line. When t = 0, it returns the start vector, and when t=1 it returns the end vector.
Returns true if both line's [page:.start start] and [page:.end en] points are equal.
</div>
<h3>[method:Vector3 getCenter]( [page:Vector3 optionalTarget] )</h3>
<div>
optionalTarget -- [page:Vector3] Optional target to set the result.
</div>
<div>
Return the center of the line segment.
</div>
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
<h3>[method:Vector3 delta]( [page:Vector3 optionalTarget] )</h3>
<div>
optionalTarget -- [page:Vector3] Optional target to set the result.
</div>
<div>
Returns the delta vector of the line segment, or the end vector minus the start vector.
Return the center of the line segment.
</div>
<h3>[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Boolean clampToLine], [page:Vector3 optionalTarget] )</h3>
<div>
point -- [page:Vector3] <br />
clampToLine -- [page:Boolean] <br />
optionalTarget -- [page:Vector3] Optional target to set the result.
</div>
<h3>[method:Line3 set]( [page:Vector3 start], [page:Vector3 end] )</h3>
<div>
Returns the closets point on the line. If clamp to line is true, then the returned value will be clamped to the line segment.
</div>
[page:Vector3 start] - set the [page:.start start point] of the line.<br />
end - [page:Vector3] - set the [page:.end end point] of the line.<br /><br />
<h3>[method:Float closestPointToPointParameter]( [page:Vector3 point], [page:Boolean clampToLine] )</h3>
<div>
point -- [page:Vector3] <br />
clampToLine -- [page:Boolean]
</div>
<div>
Returns a point parameter based on the closest point as projected on the line segement. If clamp to line is true, then the returned value will be between 0 and 1.
Sets the start and end values by copying the provided vectors.
</div>
<h2>Source</h2>
......
......@@ -10,131 +10,104 @@
<body>
<h1>[name]</h1>
<div class="desc">Math utility functions</div>
<div class="desc">An object with several math utility functions.</div>
<h2>Properties</h2>
<h2>Methods</h2>
<h2>Functions</h2>
<h3>[method:Float clamp]( [page:Float value], [page:Float min], [page:Float max] )</h3>
<div>
value — Value to be clamped.<br />
min — Minimum value<br />
max — Maximum value.
</div>
<div>
Clamps the *value* to be between *min* and *max*.
[page:Float value] — Value to be clamped.<br />
[page:Float min] — Minimum value.<br />
[page:Float max] — Maximum value.<br /><br />
Clamps the [page:Float value] to be between [page:Float min] and [page:Float max].
</div>
<h3>[method:Float degToRad]( [page:Float degrees] )</h3>
<div>
degrees -- [page:Float]
</div>
<div>
Converts degrees to radians.
</div>
<div>Converts degrees to radians.</div>
<h3>[method:Integer euclideanModulo]( [page:Integer n], [page:Integer m] )</h3>
<div>
n, m --Integers
</div>
<div>
Compute the Euclidian modulo of m % n, that is:
[page:Integer n], [page:Integer m] - Integers<br /><br />
Compute the Euclidean modulo of m % [page:Integer n], that is:
<code>( ( n % m ) + m ) % m</code>
</div>
<h3>[method:UUID generateUUID]( )</h3>
<div>
Generate a [link:https://en.wikipedia.org/wiki/Universally_unique_identifier UUID] (universally unique identifier).
Generate a [link:https://en.wikipedia.org/wiki/Universally_unique_identifier UUID]
(universally unique identifier).
</div>
<h3>[method:Boolean isPowerOfTwo]( n )</h3>
<div>
Return *true* if n is a power of 2.
</div>
<h3>[method:Boolean isPowerOfTwo]( [page:Number n] )</h3>
<div>Return *true* if [page:Number n] is a power of 2.</div>
<h3>[method:Float lerp]( [page:Float x], [page:Float y], [page:Float t] )</h3>
<div>
x -- Start point. <br />
y -- End point. <br />
t -- Closed unit interval from [0,1].
</div>
<div>
Returns a value [link:https://en.wikipedia.org/wiki/Linear_interpolation linearly interpolated] from two known points based on the given interval.
</div>
[page:Float x] - Start point. <br />
[page:Float y] - End point. <br />
[page:Float t] - interpolation factor in the closed interval [0, 1].<br><br />
<h3>[method:Float mapLinear]( [page:Float x], [page:Float a1], [page:Float a2], [page:Float b1], [page:Float b2] )</h3>
<div>
x — Value to be mapped.<br />
a1 — Minimum value for range A.<br />
a2 — Maximum value for range A.<br />
b1 — Minimum value for range B.<br />
b2 — Maximum value for range B.
</div>
<div>
Linear mapping of *x* from range [*a1*, *a2*] to range [*b1*, *b2*].
Returns a value [link:https://en.wikipedia.org/wiki/Linear_interpolation linearly interpolated]
from two known points based on the given interval - [page:Float t] = 0 will return [page:Float x]
and [page:Float t] = 1 will return [page:Float y].
</div>
<h3>[method:Integer nearestPowerOfTwo]( n )</h3>
<h3>[method:Float mapLinear](
[page:Float x],
[page:Float a1],
[page:Float a2],
[page:Float b1],
[page:Float b2] )</h3>
<div>
Return the nearest power of 2 to a given number n.
</div>
[page:Float x] — Value to be mapped.<br />
[page:Float a1] — Minimum value for range A.<br />
[page:Float a2] — Maximum value for range A.<br />
[page:Float b1] — Minimum value for range B.<br />
[page:Float b2] — Maximum value for range B.<br /><br />
<h3>[method:Integer nextPowerOfTwo]( n )</h3>
<div>
Return the nearest power of 2 that is bigger than n.
Linear mapping of [page:Float x] from range [[page:Float a1], [page:Float a2]] to range [[page:Float b1], [page:Float b2]].
</div>
<h3>[method:Integer nearestPowerOfTwo]( [page:Number n] )</h3>
<div> Return the nearest power of 2 to a given number [page:Number n].</div>
<h3>[method:Integer nextPowerOfTwo]( [page:Number n] )</h3>
<div>Return the nearest power of 2 that is bigger than [page:Number n].</div>
<h3>[method:Float radToDeg]( [page:Float radians] )</h3>
<div>
radians -- [page:Float]
</div>
<div>
Converts radians to degrees
</div>
<div>Converts radians to degrees.</div>
<h3>[method:Float randFloat]( [page:Float low], [page:Float high] )</h3>
<div>
Random float from *low* to *high* interval.
</div>
<div>Random float in the interval [page:Float low] to [page:Float high].</div>
<h3>[method:Float randFloatSpread]( [page:Float range] )</h3>
<div>
Random float from *- range / 2* to *range / 2* interval.
</div>
<div>Random float in the intercal *- [page:Float range] / 2* to *[page:Float range] / 2*.</div>
<h3>[method:Integer randInt]( [page:Integer low], [page:Integer high] )</h3>
<div>
Random integer from *low* to *high* interval.
</div>
<h3>[method:Float random16]()</h3>
<div>
Random float from 0 to 1 with 16 bits of randomness.<br />
Standard Math.random() creates repetitive patterns when applied over larger space.
</div>
<div>Random integer in the interval [page:Float low] to [page:Float high].</div>
<h3>[method:Float smoothstep]( [page:Float x], [page:Float min], [page:Float max] )</h3>
<div>
x -- The value to evaluate based on its position between min and max. <br />
min -- Any x value below min will be 0 <br />
max -- Any x value above max will be 1
</div>
<div>
[page:Float x] - The value to evaluate based on its position between min and max. <br />
[page:Float min] - Any x value below min will be 0.<br />
[page:Float max] - Any x value above max will be 1.<br /><br />
Returns a value between 0-1 that represents the percentage that x has moved between min and max,
but smoothed or slowed down the closer X is to the min and max.<br/><br/>
[link:http://en.wikipedia.org/wiki/Smoothstep Wikipedia]
See [link:http://en.wikipedia.org/wiki/Smoothstep Smoothstep] for details.
</div>
<h3>[method:Float smootherstep]( [page:Float x], [page:Float min], [page:Float max] )</h3>
<div>
x -- The value to evaluate based on its position between min and max. <br />
min -- Any x value below min will be 0 <br />
max -- Any x value above max will be 1
</div>
<div>
Returns a value between 0-1. It works the same as smoothstep, but more smooth.
[page:Float x] - The value to evaluate based on its position between min and max. <br />
[page:Float min] - Any x value below min will be 0.<br />
[page:Float max] - Any x value above max will be 1.<br /><br />
Returns a value between 0-1. A [link:https://en.wikipedia.org/wiki/Smoothstep#Variations variation on smoothstep]
that has zero 1st and 2nd order derivatives at x=0 and x=1.
</div>
<h2>Source</h2>
......
......@@ -10,15 +10,45 @@
<body>
<h1>[name]</h1>
<div class="desc">A 3x3 matrix.</div>
<div class="desc">
A class representing a 3x3 [link:https://en.wikipedia.org/wiki/Matrix_(mathematics) matrix].
</div>
<h2>Example</h2>
<code>
var m = new Matrix3();
</code>
<h2>A Note on Row-Major and Column-Major Ordering</h2>
<div>
The [page:set]() method takes arguments in [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order row-major]
order, while internally they are stored in the [page:.elements elements] array in column-major order.<br /><br />
This means that calling
<code>
m.set( 11, 12, 13,
21, 22, 23,
31, 32, 33 );
</code>
will result in the [page:.elements elements] array containing:
<code>
m.elements = [ 11, 21, 31,
12, 22, 32,
13, 23, 33 ];
</code>
and internally all calculations are performed using column-major ordering. However, as the actual ordering
makes no difference mathematically and most people are used to thinking about matrices in row-major order,
the Three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source
code, you'll have to take the transpose of any matrices outlined here to make sense of the calculations.
</div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
Creates and initializes the 3x3 matrix to the identity matrix.
Creates and initializes the [name] to the 3x3
[link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix].
</div>
......@@ -27,117 +57,138 @@
<h3>[property:Float32Array elements]</h3>
<div>
A column-major list of matrix values.
A [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order column-major]
list of matrix values.
</div>
<h3>[property:Boolean isMatrix3]</h3>
<div>
Used to check whether this or derived classes are Matrix3s. Default is *true*.<br /><br />
You should not change this, as it used internally for optimisation.
</div>
<h2>Methods</h2>
<h3>[method:Matrix3 set]( [page:Float n11], [page:Float n12], [page:Float n13], [page:Float n21], [page:Float n22], [page:Float n23], [page:Float n31], [page:Float n32], [page:Float n33] ) [page:Matrix3 this]</h3>
<div>
n11 -- [page:Float] <br />
n12 -- [page:Float] <br />
n13 -- [page:Float] <br />
n21 -- [page:Float] <br />
n22 -- [page:Float] <br />
n23 -- [page:Float] <br />
n31 -- [page:Float] <br />
n32 -- [page:Float] <br />
n33 -- [page:Float]
</div>
<h3>[method:Array applyToBuffer]( [page:ArrayBuffer buffer], [page:Number offset], [page:Number length] )</h3>
<div>
Sets the 3x3 matrix values to the given row-major sequence of values.
</div>
[page:Array buffer] - An [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer]
of floats in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...], that represent 3D vectors.<br />
[page:Number offset] - (optional) index in the array of the first vector's x component. Default is 0.<br />
[page:Number length] - (optional) index in the array of the last vector's z component.
Default is the last element in the array.<br /><br />
<h3>[method:Matrix3 copy]( [page:Matrix3 m] ) [page:Matrix3 this]</h3>
<div>
m -- [page:Matrix4]
</div>
<div>
Copies the values of matrix *m* into this matrix.
Multiplies (applies) this matrix to every 3D vector in the [page:ArrayBuffer buffer].
</div>
<h3>[method:Matrix3 fromArray]( [page:Array array], [page:Integer offset] ) [page:Matrix3 this]</h3>
<h3>[method:Array applyToVector3Array]( [page:Array array], [page:Number offset], [page:Number length] )</h3>
<div>
array -- [page:Array] The array to read the elements from.<br />
offset -- [page:Integer] optional offset into the array. Default is 0.
</div>
<div>
Sets the elements of this matrix based on an array in column-major format.
</div>
[page:Array array] - An array of floats in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...],
that represent 3D vectors.<br />
[page:Number offset] - (optional) index in the array of the first vector's x component. Default is 0.<br />
[page:Number length] - (optional) index in the array of the last vector's z component.
Default is the last element in the array.<br /><br />
<h3>[method:Matrix3 transpose]() [page:Matrix3 this]</h3>
<div>
Transposes this matrix in place.
Multiplies (applies) this matrix to every 3D vector in the [page:Array array].
</div>
<h3>[method:Matrix3 transposeIntoArray]( [page:Array array] ) [page:Matrix3 this]</h3>
<div>
array -- [page:Array] <br />
</div>
<div>
Transposes this matrix into the supplied array, and returns itself unchanged.
</div>
<h3>[method:Matrix3 clone]()</h3>
<div>Creates a new Matrix3 and with identical elements to this one.</div>
<h3>[method:Float determinant]() [page:Matrix3 this]</h3>
<div>
Computes and returns the determinant of this matrix.
</div>
<h3>[method:Matrix3 copy]( [page:Matrix3 m] )</h3>
<div>Copies the elements of matrix [page:Matrix3 m] into this matrix.</div>
<h3>[method:Matrix3 multiplyScalar]( [page:Float s] ) [page:Matrix3 this]</h3>
<div>
scalar -- [page:Float]
</div>
<h3>[method:Float determinant]()</h3>
<div>
Multiplies every component of the matrix by the scalar value *s*.
Computes and returns the
[link:https://en.wikipedia.org/wiki/Determinant determinant] of this matrix.
</div>
<h3>[method:Array applyToVector3Array]( [page:Array array] ) [page:Matrix3 this]</h3>
<div>
array -- An array in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...]
</div>
<h3>[method:Matrix3 fromArray]( [page:Array array], [page:Integer offset] )</h3>
<div>
Multiplies (applies) this matrix to every vector3 in the array.
</div>
[page:Array array] - the array to read the elements from.<br />
[page:Integer offset] - (optional) index of first element in the array. Default is 0.<br /><br />
<h3>[method:Matrix3 getNormalMatrix]( [page:Matrix4 m] ) [page:Matrix3 this]</h3>
<div>
m -- [page:Matrix4]
</div>
<div>
Sets this matrix as the normal matrix (upper left 3x3)of the passed [page:Matrix4 matrix4]. The normal matrix is the inverse transpose of the matrix *m*.
Sets the elements of this matrix based on an array in
[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
</div>
<h3>[method:Matrix3 getInverse]( [page:Matrix4 m], [page:Boolean throwOnDegenerate] ) [page:Matrix3 this]</h3>
<h3>[method:Matrix3 getInverse]( [page:Matrix3 m], [page:Boolean throwOnDegenerate] )</h3>
<div>
m -- [page:Matrix4]<br />
throwOnDegenerate -- [Page:Boolean] If true, throw an error if the matrix is degenerate (not invertible).
[page:Matrix3 m] - the matrix to take the inverse of.<br />
[page:Boolean throwOnDegenerate] - (optional) If true, throw an error if the matrix is degenerate (not invertible).<br /><br />
Set this matrix to the [link:https://en.wikipedia.org/wiki/Invertible_matrix inverse] of the passed matrix [page:Matrix3 m],
using the [link:https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution analytic method].
If [page:Boolean throwOnDegenerate] is not set and the matrix is not invertible, set this to the 3x3 identity matrix.
</div>
<h3>[method:Matrix3 getNormalMatrix]( [page:Matrix4 m] )</h3>
<div>
Set this matrix to the inverse of the passed matrix.
[page:Matrix4 m] - [page:Matrix4]<br /><br />
Sets this matrix as the upper left 3x3 of the [link:https://en.wikipedia.org/wiki/Normal_matrix normal matrix]
of the passed [page:Matrix4 matrix4]. The normal matrix is the [link:https://en.wikipedia.org/wiki/Invertible_matrix inverse] [link:https://en.wikipedia.org/wiki/Transpose transpose]
of the matrix [page:Matrix4 m].
</div>
<h3>[method:Matrix3 identity]() [page:Matrix3 this]</h3>
<h3>[method:Matrix3 identity]()</h3>
<div>
Resets this matrix to identity.<br/><br/>
Resets this matrix to the 3x3 identity matrix:
<code>
1, 0, 0
0, 1, 0
0, 0, 1
</code>
1, 0, 0<br/>
0, 1, 0<br/>
0, 0, 1<br/>
</div>
<h3>[method:Matrix3 clone]() [page:Matrix3 this]</h3>
<h3>[method:Matrix3 multiplyScalar]( [page:Float s] )</h3>
<div>Multiplies every component of the matrix by the scalar value *s*.</div>
<h3>
[method:Matrix3 set](
[page:Float n11], [page:Float n12], [page:Float n13],
[page:Float n21], [page:Float n22], [page:Float n23],
[page:Float n31], [page:Float n32], [page:Float n33] )
</h3>
<div>
Creates a copy of this matrix.
[page:Float n11] - value to put in row 1, col 1.<br />
[page:Float n12] - value to put in row 1, col 2.<br />
...<br />
...<br />
[page:Float n32] - value to put in row 3, col 2.<br />
[page:Float n33] - value to put in row 3, col 3.<br /><br />
Sets the 3x3 matrix values to the given
[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order row-major]
sequence of values.
</div>
<h3>[method:Array toArray]( [page:Array array], [page:Integer offset] ) [page:Matrix3 this]</h3>
<h3>[method:Matrix3 setFromMatrix4]( [page:Matrix4 m] )</h3>
<div>Set this matrx to the upper 3x3 matrix of the Matrix4 [page:Matrix4 m].</div>
<h3>[method:Array toArray]( [page:Array array], [page:Integer offset] )</h3>
<div>
array -- [page:Array] optional array to store the vector <br />
offset -- [page:Integer] optional offset into the array
[page:Array array] - (optional) array to store the resulting vector in. If not given a new array will be created.<br />
[page:Integer offset] - (optional) offset in the array at which to put the result.<br /><br />
Writes the elements of this matrix to an array in
[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
</div>
<h3>[method:Matrix3 transpose]()</h3>
<div>[link:https://en.wikipedia.org/wiki/Transpose Transposes] this matrix in place.</div>
<h3>[method:Matrix3 transposeIntoArray]( [page:Array array] )</h3>
<div>
Writes the elements of this matrix to an array in column-major format.
[page:Array array] - array to store the resulting vector in.<br /><br />
[link:https://en.wikipedia.org/wiki/Transpose Transposes] this matrix into the supplied array,
and returns itself unchanged.
</div>
<h2>Source</h2>
......
此差异已折叠。
......@@ -10,7 +10,11 @@
<body>
<h1>[name]</h1>
<div class="desc">A two dimensional surface that extends infinitely in 3d space.</div>
<div class="desc">
A two dimensional surface that extends infinitely in 3d space, defined by
a [link:https://en.wikipedia.org/wiki/Normal_(geometry) normal vector], and a
distance from the origin along the normal.
</div>
<h2>Constructor</h2>
......@@ -18,8 +22,10 @@
<h3>[name]( [page:Vector3 normal], [page:Float constant] )</h3>
<div>
normal -- ([Page:Vector3]) normal vector defining the plane pointing towards the origin <br />
constant -- ([Page:Float]) the negative distance from the origin to the plane along the normal vector
[page:Vector3 normal] - (optional) a [page:Vector3] defining the direction of the
plane. Default is *(1, 0, 0)*.<br />
[page:Float constant] - (optional) the negative distance from the origin to the plane along
the [page:Vector3 normal] vector. Default is *0*.
</div>
......@@ -31,173 +37,157 @@
<h2>Methods</h2>
<h3>[method:Plane normalize]() [page:Plane this]</h3>
<h3>[method:Plane applyMatrix4]( [page:Matrix4 matrix], [page:Matrix3 optionalNormalMatrix] )</h3>
<div>
Normalizes the normal vector, and adjusts the constant value accordingly.
</div>
[page:Matrix4 matrix] - the [Page:Matrix4] to apply.<br />
[page:Matrix3 optionalNormalMatrix] - (optional) pre-computed normal [Page:Matrix3] of the Matrix4 being applied.<br /><br />
<h3>[method:Plane set]( [page:Vector3 normal], [page:Float constant] ) [page:Plane this]</h3>
<div>
normal -- [Page:Vector3] <br />
constant -- [Page:Float]
</div>
<div>
Sets the plane's values.
Apply a Matrix4 to the plane. The matrix must be an affine, homogeneous transform.<br />
If supplying an [page:Matrix3 optionalNormalMatrix], it can be created like so:
<code>
var optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
</code>
</div>
<h3>[method:Plane copy]( [page:Plane plane] ) [page:Plane this]</h3>
<div>
plane -- [page:Plane] to copy
</div>
<div>
Copies the values of the passed plane to this plane.
</div>
<h3>[method:Plane clone]()</h3>
<div>Returns a new plane with the same [page:.normal normal] and [page:.constant constant] as this one.</div>
<h3>[method:Plane applyMatrix4]( [page:Matrix4 matrix], [page:Matrix3 optionalNormalMatrix] ) [page:Plane this]</h3>
<div>
matrix -- [Page:Matrix4] to apply <br />
optionalNormalMatrix -- (optional) pre-computed normal [Page:Matrix3] of the Matrix4 to apply
</div>
<h3>[method:Vector3 coplanarPoint]( [page:Vector3 optionalTarget] )</h3>
<div>
Apply a Matrix4 to the plane. The matrix must be an affine, homogeneous transform.
The second parameter is optional.
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
<code>
var optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix )
</code>
Returns a [page:Vector3] coplanar to the plane, by calculating the projection of the
normal vector at the origin onto the plane.
</div>
<h3>[method:Vector3 orthoPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<h3>[method:Plane copy]( [page:Plane plane] )</h3>
<div>
point -- [page:Vector3] <br />
optionalTarget -- [page:Vector3]
</div>
<div>
Returns a vector in the same direction as the Plane's normal, but the magnitude is passed point's original distance to the plane.
Copies the values of the passed plane's [page:.normal normal] and [page:.constant constant]
properties to this plane.
</div>
<h3>[method:Boolean intersectsLine]( [page:Line3 line] )</h3>
<div>
line -- [page:Line3]
</div>
<div>
Tests whether a line segment intersects with the plane. (Do not mistake this for a collinear check.)
</div>
<h3>[method:Float distanceToPoint]( [page:Vector3 point] )</h3>
<div>Returns the smallest distance from the [page:Vector3 point] to the plane.</div>
<h3>[method:Boolean intersectsBox]( [page:Box3 box] ) [page:Plane this]</h3>
<div>
box -- Box to check for intersection against.
</div>
<div>
Determines whether or not this plane intersects *box*.
</div>
<h3>[method:Float distanceToSphere]( [page:Sphere sphere] )</h3>
<div>Returns the smallest distance from the [page:Sphere sphere] to the plane.</div>
<h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] ) [page:Plane this]</h3>
<div>
sphere -- Sphere to check for intersection against.
</div>
<h3>[method:Boolean equals]( [page:Plane plane] )</h3>
<div>
Determines whether or not this plane intersects *sphere*.
Checks to see if two planes are equal (their [page:.normal normal] and
[page:.constant constant] properties match).
</div>
<h3>[method:Vector3 intersectLine]( [page:Line3 line], [page:Vector3 optionalTarget] ) or [page:undefined]</h3>
<div>
line -- [page:Line3] <br />
optionalTarget -- [page:Vector3]
</div>
<div>
Returns the intersection point of the passed line and the plane. Returns undefined if the line does not intersect. Returns the line's starting point if the line is coplanar with the plane.
</div>
[page:Line3 line] - the [page:Line3] to check for intersection.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
<h3>[method:Plane setFromNormalAndCoplanarPoint]( [page:Vector3 normal], [page:Vector3 point] ) [page:Vector3 this]</h3>
<div>
normal -- [page:Vector3] <br />
point -- [page:Vector3]
</div>
<div>
Sets the plane's values as defined by a normal and arbitrary coplanar point.
Returns the intersection point of the passed line and the plane. Returns undefined
if the line does not intersect. Returns the line's starting point if the line is
coplanar with the plane.
</div>
<h3>[method:Plane clone]()</h3>
<h3>[method:Boolean intersectsBox]( [page:Box3 box] )</h3>
<div>
Returns a new copy of this plane.
</div>
[page:Box3 box] - the [page:Box3] to check for intersection.<br /><br />
<h3>[method:Float distanceToPoint]( [page:Vector3 point] )</h3>
<div>
point -- [page:Vector3]
</div>
<div>
Returns the smallest distance from the point to the plane.
Determines whether or not this plane intersects [page:Box3 box].
</div>
<h3>[method:Boolean equals]( [page:Plane plane] )</h3>
<div>
plane -- [page:Planen]
</div>
<h3>[method:Boolean intersectsLine]( [page:Line3 line] )</h3>
<div>
Checks to see if two planes are equal (their normals and constants match)
</div>
[page:Line3 line] - the [page:Line3] to check for intersection.<br /><br />
<h3>[method:Plane setComponents]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Plane this]</h3>
<div>
x -- [page:Float] x of the normal vector <br />
y -- [page:Float] y of the normal vector<br />
z -- [page:Float] z of the normal vector<br />
w -- [page:Float] distance of the plane from the origin along the normal vector
</div>
<div>
Set the individual components that make up the plane.
Tests whether a line segment intersects with (passes through) the plane.
</div>
<h3>[method:Float distanceToSphere]( [page:Sphere sphere] )</h3>
<h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] )</h3>
<div>
sphere -- [Page:Sphere]
[page:Sphere sphere] - the [page:Sphere] to check for intersection.<br /><br />
Determines whether or not this plane intersects [page:Sphere sphere].
</div>
<h3>[method:Plane negate]()</h3>
<div>
Returns the smallest distance from an edge of the sphere to the plane.
Negates both the normal vector and constant, effectively mirroring the plane across
the origin.
</div>
<h3>[method:Plane setFromCoplanarPoints]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] ) [page:Plane this]</h3>
<h3>[method:Plane normalize]()</h3>
<div>
a -- [page:Vector3] <br />
b -- [page:Vector3] <br />
c -- [page:Vector3]
Normalizes the [page:.normal normal] vector, and adjusts the [page:.constant constant]
value accordingly.
</div>
<h3>[method:Vector3 orthoPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<div>
Defines the plane based on the 3 provided points. The winding order is counter clockwise, and determines which direction the normal will point.
[page:Vector3 point] - [page:Vector3] <br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied
into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
Returns a vector in the same direction as the Plane's normal, but with magnitude
equal to the passed point's original distance to the plane.
</div>
<h3>[method:Vector3 projectPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<div>
point -- [page:Vector3] <br />
optionalTarget -- [page:Vector3]
</div>
<div>
Projects a point onto the plane. The projected point is the closest point on the plane to the passed point, so a line drawn from the projected point and the passed point would be orthogonal to the plane.
[page:Vector3 point] - the [page:Vector3] to project onto the plane.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
Projects a [page:Vector3 point] onto the plane. The projected point is the closest
point on the plane to the passed point, so a line drawn from the projected point
and the passed point would be orthogonal to the plane.
</div>
<h3>[method:Plane negate]() [page:Plane this]</h3>
<h3>[method:Plane set]( [page:Vector3 normal], [page:Float constant] )</h3>
<div>
Negates both the normal vector and constant, effectively mirroring the plane across the origin.
[page:Vector3 normal] - a [page:Vector3] defining the direction of the plane.<br />
[page:Float constant] - (optional) the negative distance from the origin to the plane along
the [page:Vector3 normal] vector. Default is *0*.<br /><br />
Sets the plane's [page:.normal normal] and [page:.constant constant] properties.
</div>
<h3>[method:Plane translate]( [page:Vector3 offset] ) [page:Plane this]</h3>
<h3>[method:Plane setComponents]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )</h3>
<div>
offset -- [page:Vector3]
[page:Float x] - x value of the normal vector.<br />
[page:Float y] - y value of the normal vector.<br />
[page:Float z] - z value of the normal vector.<br />
[page:Float w] - the value of the plane's [page:.constant constant] property.<br /><br />
Set the individual components that make up the plane.
</div>
<h3>[method:Plane setFromCoplanarPoints]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] )</h3>
<div>
Translates the plane the distance defined by the vector. Note that this only affects the constant (distance from origin) and will not affect the normal vector.
[page:Vector3 a] - first point on the plane.<br />
[page:Vector3 a] - second point on the plane.<br />
[page:Vector3 a] - third point on the plane.<br /><br />
Defines the plane based on the 3 provided points. The winding order is counter
clockwise, and determines which direction the [page:.normal normal] will point.
</div>
<h3>[method:Vector3 coplanarPoint]( [page:Vector3 optionalTarget] )</h3>
<h3>[method:Plane setFromNormalAndCoplanarPoint]( [page:Vector3 normal], [page:Vector3 point] ) [page:Vector3 this]</h3>
<div>
optionalTarget -- [page:Vector3]
[page:Vector3 normal] - a [page:Vector3] defining the direction of the plane.<br />
[page:Vector3 point] - [page:Vector3]<br /><br />
Sets the plane's properties as defined by a [page:Vector3 normal] and an arbitrary coplanar [page:Vector3 point].
</div>
<h3>[method:Plane translate]( [page:Vector3 offset] )</h3>
<div>
Returns a coplanar point. (The projection of the normal vector at the origin onto the plane.)
[page:Vector3 offset] - the amount to move the plane by.<br /><br />
Translates the plane the distance defined by the [page:Vector3 offset] vector.
Note that this only affects the constant (distance from origin) and will not affect
the normal vector.
</div>
<h2>Source</h2>
......
......@@ -10,12 +10,19 @@
<body>
<h1>[name]</h1>
<div class="desc">Implementation of a <a href="http://en.wikipedia.org/wiki/Quaternion">quaternion</a>. This is used for rotating things without encountering the dreaded <a href="http://en.wikipedia.org/wiki/Gimbal_lock">gimbal lock</a> issue, amongst other advantages.</div>
<div class="desc">
Implementation of a [link:http://en.wikipedia.org/wiki/Quaternion quaternion].
This is used for [link:https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation rotating things]
without encountering the dreaded
[link:http://en.wikipedia.org/wiki/Gimbal_lock gimbal lock] issue, amongst other
advantages.
</div>
<h2>Example</h2>
<code>var quaternion = new THREE.Quaternion();
<code>
var quaternion = new THREE.Quaternion();
quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );
var vector = new THREE.Vector3( 1, 0, 0 );
......@@ -28,190 +35,247 @@
<h3>[name]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )</h3>
<div>
x - x coordinate<br />
y - y coordinate<br />
z - z coordinate<br />
w - w coordinate
[page:Float x] - x coordinate<br />
[page:Float y] - y coordinate<br />
[page:Float z] - z coordinate<br />
[page:Float w] - w coordinate
</div>
<h2>Properties</h2>
<h3>[property:Float x]</h3>
<div>Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.</div>
<h3>[property:Float y]</h3>
<div>Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.</div>
<h3>[property:Float z]</h3>
<div>Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.</div>
<h3>[property:Float w]</h3>
<div>Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.</div>
<h2>Methods</h2>
<h3>[method:Quaternion set]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Quaternion this]</h3>
<h3>[method:Quaternion clone]()</h3>
<div>
Sets values of this quaternion.
Creates a new Quaternion with identical [page:.x x], [page:.y y],
[page:.z z] and [page:.w w] properties to this one.
</div>
<h3>[method:Quaternion copy]( [page:Quaternion q] ) [page:Quaternion this]</h3>
<div>
Copies values of *q* to this quaternion.
</div>
<h3>[method:Quaternion fromArray]( [page:Array array], [page:Integer offset] ) [page:Quaternion this]</h3>
<div>
array -- Array of format (x, y, z, w) used to construct the quaternion.<br />
offset -- An optional offset into the array.
</div>
<h3>[method:Quaternion conjugate]()</h3>
<div>
Sets this quaternion's component values from an array.
Returns the rotational conjugate of this quaternion. The conjugate of a quaternion
represents the same rotation in the opposite direction about the rotational axis.
</div>
<h3>[method:Quaternion setFromEuler]( [page:Euler euler] ) [page:Quaternion this]</h3>
<h3>[method:Quaternion copy]( [page:Quaternion q] )</h3>
<div>
Sets this quaternion from rotation specified by Euler angle.
Copies the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] properties
of [page:Quaternion q] into this quaternion.
</div>
<h3>[method:Quaternion setFromAxisAngle]( [page:Vector3 axis], [page:Float angle] ) [page:Quaternion this]</h3>
<h3>[method:Boolean equals]( [page:Quaternion v] )</h3>
<div>
Sets this quaternion from rotation specified by axis and angle.<br />
Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm].<br />
*Axis* is asumed to be normalized, *angle* is in radians.
</div>
[page:Quaternion v] - Quaternion that this quaternion will be compared to.<br /><br />
<h3>[method:Quaternion setFromRotationMatrix]( [page:Matrix4 m] ) [page:Quaternion this]</h3>
<div>
Sets this quaternion from rotation component of *m*.<br />
Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm].
Compares the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] properties of
[page:Quaternion v] to the equivalent properties of this quaternion to determine if they
represent the same rotation.
</div>
<h3>[method:Quaternion setFromUnitVectors]( [page:Vector3 vFrom], [page:Vector3 vTo] ) [page:Quaternion this]</h3>
<h3>[method:Float dot]( [page:Quaternion v] )</h3>
<div>
Sets this quaternion to the rotation required to rotate direction vector *vFrom* to direction vector *vTo*.<br />
Adapted from [link:http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors].<br />
*vFrom* and *vTo* are assumed to be normalized.
Calculate the [link:https://en.wikipedia.org/wiki/Dot_product dot product] of
quaternions [page:Quaternion v] and this one.
</div>
<h3>[method:Quaternion inverse]() [page:Quaternion this]</h3>
<h3>[method:Quaternion fromArray]( [page:Array array], [page:Integer offset] )</h3>
<div>
Inverts this quaternion.
</div>
[page:Array array] - array of format (x, y, z, w) used to construct the quaternion.<br />
[page:Integer offset] - (optional) an offset into the array.<br /><br />
<h3>[method:Float length]() [page:Quaternion this]</h3>
<div>
Computes length of this quaternion.
Sets this quaternion's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] properties
from an array.
</div>
<h3>[method:Quaternion normalize]() [page:Quaternion this]</h3>
<h3>[method:Quaternion inverse]()</h3>
<div>
Normalizes this quaternion.
Inverts this quaternion - calculate the [page:.conjugate conjugate] and then
[page:.normalize normalizes] the result.
</div>
<h3>[method:Quaternion multiply]( [page:Quaternion q] ) [page:Quaternion this]</h3>
<div>
Multiplies this quaternion by *q*.
</div>
<h3>[method:Float length]()</h3>
<div>Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
(straight-line length) of this quaternion, considered as a 4 dimensional vector.</div>
<h3>[method:Quaternion premultiply]( [page:Quaternion q] ) [page:Quaternion this]</h3>
<h3>[method:Float lengthSq]()</h3>
<div>
Pre-multiplies this quaternion by *q*.
Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
(straight-line length) of this quaternion, considered as a 4 dimensional
vector. This can be useful if you are comparing the lengths of two quaternions,
as this is a slightly more efficient calculation than [page:.length length]().
</div>
<h3>[method:Quaternion multiplyQuaternions]( [page:Quaternion a], [page:Quaternion b] ) [page:Quaternion this]</h3>
<h3>[method:Quaternion normalize]()</h3>
<div>
Sets this quaternion to *a x b*<br />
Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm].
[link:https://en.wikipedia.org/wiki/Normalized_vector Normalizes] this quaternion - that is,
calculated the quaternion that performs the same rotation as this one, but has [page:.length length]
equal to *1*.
</div>
<h3>[method:Quaternion multiplyVector3]( [page:Vector3 vector], [page:Vector3 dest] ) [page:Quaternion this]</h3>
<div>
Rotates *vector* by this quaternion into *dest*.<br />
If *dest* is not specified, result goes to *vec*.
</div>
<h3>[method:Quaternion multiply]( [page:Quaternion q] )</h3>
<div>Multiplies this quaternion by [page:Quaternion q].</div>
<h3>[method:Float lengthSq]() [page:Quaternion this]</h3>
<h3>[method:Quaternion multiplyQuaternions]( [page:Quaternion a], [page:Quaternion b] )</h3>
<div>
Calculates the squared length of the quaternion.
Sets this quaternion to [page:Quaternion a] x [page:Quaternion b].<br />
Adapted from the method outlined [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm here].
</div>
<h3>[method:Quaternion conjugate]() [page:Quaternion this]</h3>
<div>
Returns the rotational conjugate of this quaternion. The conjugate of a quaternion
represents the same rotation in the opposite direction about the rotational axis.
</div>
<h3>[method:Quaternion onChange]( [page:Function onChangeCallback] )</h3>
<div>Set the [page:.onChangeCallback onChangeCallback]() method.</div>
<h3>[method:Quaternion slerp]( [page:Quaternion quaternionB], [page:float t] ) [page:Quaternion this]</h3>
<h3>[method:Quaternion onChangeCallback]( )</h3>
<div>
quaternionB -- The other quaternion rotation<br />
t -- Normalized 0 to 1 interpolation factor
This function is called whenever and of the following occur:
<ul>
<li>
The [page:.x x], [page:.y y], [page:.z z] or
[page:.w w] properties are changed.
</li>
<li>
The [page:.set set](), [page:.copy copy](), [page:.clone clone](),
[page:.setFromAxisAngle setFromAxisAngle](), [page:.setFromRotationMatrix setFromRotationMatrix](),
[page:.conjugate conjugate](), [page:.normalize normalize](),
[page:.multiplyQuaternions multiplyQuaternions](), [page:.slerp slerp]() or [page:.fromArray fromArray]()
functions are called.
</li>
<li>
[page:.setFromEuler setFromEuler]() function is called with its *update* argument set to true.
</li>
</ul>
By default it is the empty function, however you can change it if needed using [page:.onChange onChange]( [page:Function onChangeCallback] ).
</div>
<div>
Handles the spherical linear interpolation between quaternions. *t* represents the amount of rotation
between this quaternion (where *t* is 0) and quaternionB (where *t* is 1). This quaternion is set to
the result. Also see the static version of the *slerp* below.
</div>
<code>
// rotate a mesh towards a target quaternion
mesh.quaternion.slerp( endQuaternion, 0.01 );
</code>
<h3>[method:Boolean equals]( [page:Quaternion v] ) [page:Quaternion this]</h3>
<h3>[method:Quaternion premultiply]( [page:Quaternion q] )</h3>
<div>Pre-multiplies this quaternion by [page:Quaternion q].</div>
<h3>[method:Quaternion slerp]( [page:Quaternion qb], [page:float t] )</h3>
<div>
v -- Quaternion that this quaternion will be compared to.
[page:Quaternion qb] - The other quaternion rotation<br />
[page:float t] - interpolation factor in the closed interval [0, 1].<br /><br />
Handles the spherical linear interpolation between quaternions. [page:float t] represents the
amount of rotation between this quaternion (where [page:float t] is 0) and [page:Quaternion qb] (where
[page:float t] is 1). This quaternion is set to the result. Also see the static version of the
*slerp* below.
<code>
// rotate a mesh towards a target quaternion
mesh.quaternion.slerp( endQuaternion, 0.01 );
</code>
</div>
<h3>[method:Quaternion set]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )</h3>
<div>Sets [page:.x x], [page:.y y], [page:.z z], [page:.w w] properties of this quaternion.</div>
<h3>[method:Quaternion setFromAxisAngle]( [page:Vector3 axis], [page:Float angle] )</h3>
<div>
Compares each component of *v* to each component of this quaternion to determine if they
represent the same rotation.
Sets this quaternion from rotation specified by [page:Vector3 axis] and [page:Float angle].<br />
Adapted from the method [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm here].<br />
*Axis* is asumed to be normalized, *angle* is in radians.
</div>
<h3>[method:Quaternion clone]() [page:Quaternion this]</h3>
<h3>[method:Quaternion setFromEuler]( [page:Euler euler] )</h3>
<div>Sets this quaternion from the rotation specified by [page:Euler] angle.</div>
<h3>[method:Quaternion setFromRotationMatrix]( [page:Matrix4 m] )</h3>
<div>
Clones this quaternion.
Sets this quaternion from rotation component of [page:Matrix4 m].<br />
Adapted from the method [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm here].
</div>
<h3>[method:Array toArray]( [page:Array array], [page:Integer offset] ) [page:Quaternion this]</h3>
<h3>[method:Quaternion setFromUnitVectors]( [page:Vector3 vFrom], [page:Vector3 vTo] )</h3>
<div>
array -- An optional array to store the quaternion.<br/>
offset -- An optional offset into the output array.
Sets this quaternion to the rotation required to rotate direction vector [page:Vector3 vFrom] to
direction vector [page:Vector3 vTo].<br />
Adapted from the method [link:http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors here].<br />
[page:Vector3 vFrom] and [page:Vector3 vTo] are assumed to be normalized.
</div>
<h3>[method:Array toArray]( [page:Array array], [page:Integer offset] )</h3>
<div>
Returns the numerical elements of this quaternion in an array of format (x, y, z, w).
[page:Array array] - An optional array to store the quaternion. If not specified a new array will be created.<br/>
[page:Integer offset] - optional) if specified, the result will be copied
into this [page:Array].<br /><br />
Returns the numerical elements of this quaternion in an array of format [x, y, z, w].
</div>
<h2>Static Methods</h2>
<h3>[method:Quaternion slerp]( [page:Quaternion qStart], [page:Quaternion qEnd], [page:Quaternion qTarget], [page:Float t] )</h3>
<div>
qStart -- The starting quaternion (where *t* is 0)<br />
qEnd -- The ending quaternion (where *t* is 1)<br />
qTarget -- The target quaternion that gets set with the result<br />
t -- Normalized 0 to 1 interpolation factor
Static methods (as opposed to instance methods) are designed to be called directly from the class,
rather than from a specific instance. So to use the static version of, call it like so:
<code>
THREE.Quaternion.slerp( qStart, qEnd, qTarget, t );
</code>
By contrast, to call the 'normal' or instanced slerp method, you would do the following:
<code>
//instantiate a quaternion with default values
var q = new THREE.Quaternion();
//call the instanced slerp method
q.slerp( qb, t )
</code>
</div>
<h3>[method:Quaternion slerp]( [page:Quaternion qStart], [page:Quaternion qEnd], [page:Quaternion qTarget], [page:Float t] )</h3>
<div>
Unlike the normal method, the static version of slerp sets a target quaternion to the result of the slerp operation.
[page:Quaternion qStart] - The starting quaternion (where [page:Float t] is 0)<br />
[page:Quaternion qEnd] - The ending quaternion (where [page:Float t] is 1)<br />
[page:Quaternion qTarget] - The target quaternion that gets set with the result<br />
[page:float t] - interpolation factor in the closed interval [0, 1].<br /><br />
Unlike the normal method, the static version of slerp sets a target quaternion to the result of the slerp operation.
<code>
// Code setup
var startQuaternion = new THREE.Quaternion().set( 0, 0, 0, 1 ).normalize();
var endQuaternion = new THREE.Quaternion().set( 1, 1, 1, 1 ).normalize();
var t = 0;
// Update a mesh's rotation in the loop
t = ( t + 0.01 ) % 1; // constant angular momentum
THREE.Quaternion.slerp( startQuaternion, endQuaternion, mesh.quaternion, t );
</code>
</div>
<code>
// Code setup
var startQuaternion = new THREE.Quaternion().set( 0, 0, 0, 1 ).normalize();
var endQuaternion = new THREE.Quaternion().set( 1, 1, 1, 1 ).normalize();
var t = 0;
</code>
<code>
// Update a mesh's rotation in the loop
t = ( t + 0.01 ) % 1; // constant angular momentum
THREE.Quaternion.slerp( startQuaternion, endQuaternion, mesh.quaternion, t );
</code>
<h3>[method:null slerpFlat]( [page:Array dst], [page:Integer dstOffset], [page:Array src0], [page:Integer srcOffset0], [page:Array src1], [page:Integer srcOffset1], [page:Float t] )</h3>
<h3>
[method:null slerpFlat](
[page:Array dst],
[page:Integer dstOffset],
[page:Array src0],
[page:Integer srcOffset0],
[page:Array src1],
[page:Integer srcOffset1],
[page:Float t]
)
</h3>
<div>
dst -- The output array.<br />
dstOffset -- An offset into the output array.<br />
src0 -- The source array of the starting quaternion.<br />
srcOffset0 -- An offset into the array *src0*.<br />
src1 -- The source array of the target quatnerion.<br />
srcOffset1 -- An offset into the array *src1*.<br />
t -- Interpolation factor 0 at start, 1 at end.
</div>
[page:Array dst] - The output array.<br />
[page:Integer dstOffset] - An offset into the output array.<br />
[page:Array src0] - The source array of the starting quaternion.<br />
[page:Integer srcOffset0] - An offset into the array *src0*.<br />
[page:Array src1] - The source array of the target quatnerion.<br />
[page:Integer srcOffset1] - An offset into the array *src1*.<br />
[page:float t] - Normalized interpolation factor (between 0 and 1).<br /><br />
<div>
Like the static *slerp* method above, but operates directly on flat arrays of numbers.
</div>
......
......@@ -10,7 +10,12 @@
<body>
<h1>[name]</h1>
<div class="desc">A ray that emits from an origin in a certain direction.</div>
<div class="desc">
A ray that emits from an origin in a certain direction. This is used by the
[page:RayCaster] to assist with [link:https://en.wikipedia.org/wiki/Ray_casting raycasting].
Raycasting is used for mouse picking (working out what objects in the 3D space the mouse is over) amongst
other things.
</div>
<h2>Constructor</h2>
......@@ -18,195 +23,196 @@
<h3>[name]( [page:Vector3 origin], [page:Vector3 direction] )</h3>
<div>
origin -- [page:Vector3] The origin of the [page:Ray].<br />
direction -- [page:Vector3] The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.
</div>
<div>
Initialises the origin and direction properties to the provided values.
[page:Vector3 origin] - (optional) the origin of the [page:Ray]. Default is a [page:Vector3] at (0, 0, 0).<br />
[page:Vector3 direction] - [page:Vector3] The direction of the [page:Ray]. This must be normalized
(with [page:Vector3.normalize]) for the methods to operate properly. Default is a [page:Vector3] at (0, 0, 0).<br /><br />
Creates a new [name].
</div>
<h2>Properties</h2>
<h3>[property:Vector3 origin]</h3>
<div>
The origin of the [page:Ray].
</div>
<div>The origin of the [page:Ray]. Default is a [page:Vector3] at (0, 0, 0).</div>
<h3>[property:Vector3 direction]</h3>
<div>
The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.
The direction of the [page:Ray]. This must be normalized (with [page:Vector3.normalize])
for the methods to operate properly. Default is a [page:Vector3] at (0, 0, 0).
</div>
<h2>Methods</h2>
<h3>[method:Ray applyMatrix4]( [page:Matrix4 matrix4] )</h3>
<div>
matrix4 -- [page:Matrix4] The [page:Matrix4] to transform this [page:Ray] by.
</div>
<div>
[page:Matrix4 matrix4] - the [page:Matrix4] to apply to this [page:Ray].<br /><br />
Transform this [page:Ray] by the [page:Matrix4].
</div>
<h3>[method:Vector3 at]( [page:Float t], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
<div>
t -- [page:Float] The distance along the [page:Ray] to retrieve a position for.<br />
optionalTarget -- [page:Vector3] Receives the position along the [page:Ray] if passed; otherwise a new [page:Vector3] is created.
</div>
<h3>[method:Vector3 at]( [page:Float t], [page:Vector3 optionalTarget] ) </h3>
<div>
[page:Float t] - the distance along the [page:Ray] to retrieve a position for.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
Get a [page:Vector3] that is a given distance along this [page:Ray].
</div>
<h3>[method:Ray clone]()</h3>
<div>
Create a clone of this [page:Ray].
Creates a new Ray with identical [page:.origin origin] and [page:.direction direction] to this one.
</div>
<h3>[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<div>
point -- [page:Vector3] The point to get the closest approach to. <br />
optionalTarget -- [page:Vector3] Receives the return value if passed; otherwise a new [page:Vector3] is created.
</div>
<div>
[page:Vector3 point] - the point to get the closest approach to. <br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
Get the point along this [page:Ray] that is closest to the [page:Vector3] provided.
</div>
<h3>[method:Ray copy]( [page:Ray ray] )</h3>
<div>
ray -- [page:Ray] The [page:Ray] to copy values from.
</div>
<div>
Copy the properties of the provided [page:Ray], then return this [page:Ray].
Copies the [page:.origin origin] and [page:.direction direction] properties
of [page:Ray ray] into this ray.
</div>
<h3>[method:Float distanceSqToSegment]( [page:Vector3 v0], [page:Vector3 v1], [page:Vector3 optionalPointOnRay] = null, [page:Vector3 optionalPointOnSegment] = null ) [page:Float]</h3>
<h3>[method:Float distanceSqToPoint]( [page:Vector3 point] )</h3>
<div>
v0 -- [page:Vector3] The start of the line segment.
v1 -- [page:Vector3] The end of the line segment.
optionalPointOnRay -- [page:Vector3] If this is provided, it receives the point on this [page:Ray] that is closest to the segment.
optionalPointOnSegment -- [page:Vector3] If this is provided, it receives the point on the line segment that is closest to this [page:Ray].
[page:Vector3 point] - the [page:Vector3] to compute a distance to.<br /><br />
Get the squared distance of the closest approach between the [page:Ray] and the [page:Vector3].
</div>
<h3>[method:Float distanceSqToSegment]( [page:Vector3 v0], [page:Vector3 v1], [page:Vector3 optionalPointOnRay], [page:Vector3 optionalPointOnSegment] )</h3>
<div>
[page:Vector3 v0] - the start of the line segment.<br />
[page:Vector3 v1] - the end of the line segment.<br />
optionalPointOnRay - (optional) if this is provided, it receives the point on this
[page:Ray] that is closest to the segment.<br />
optionalPointOnSegment - (optional) if this is provided, it receives the point
on the line segment that is closest to this [page:Ray].<br /><br />
Get the squared distance between this [page:Ray] and a line segment.
</div>
<h3>[method:Float distanceToPlane]( [page:Plane plane] )</h3>
<div>
plane -- [page:Plane] The [page:Plane] to get the distance to.
</div>
<div>
Get the distance from the origin to the [page:Plane], or *null* if the [page:Ray] doesn't intersect the [page:Plane].
[page:Plane plane] - the [page:Plane] to get the distance to.<br /><br />
Get the distance from [page:.origin origin] to the [page:Plane], or *null* if the [page:Ray] doesn't intersect the [page:Plane].
</div>
<h3>[method:Float distanceToPoint]( [page:Vector3 point] )</h3>
<div>
point -- [page:Vector3] The [page:Vector3] to compute a distance to.
</div>
<div>
Get the distance of the closest approach between the [page:Ray] and the [page:Vector3].
</div>
[page:Vector3 point] - [page:Vector3] The [page:Vector3] to compute a distance to.<br /><br />
<h3>[method:Float distanceSqToPoint]( [page:Vector3 point] )</h3>
<div>
point -- [page:Vector3] The [page:Vector3] to compute a distance to.
</div>
<div>
Get the squared distance of the closest approach between the [page:Ray] and the [page:Vector3].
Get the distance of the closest approach between the [page:Ray] and the [page:Vector3 point].
</div>
<h3>[method:Boolean equals]( [page:Ray ray] )</h3>
<div>
ray -- [page:Ray] The [page:Ray] to compare to.
</div>
<div>
Return whether this and the other [page:Ray] have equal offsets and directions.
</div>
[page:Ray ray] - the [page:Ray] to compare to.<br /><br />
<h3>[method:Vector3 intersectBox]( [page:Box3 box], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
<div>
box -- [page:Box3] The [page:Box3] to intersect with.<br />
optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
</div>
<div>
Intersect this [page:Ray] with a [page:Box3], returning the intersection point or *null* if there is no intersection.
Returns true if this and the other [page:Ray ray] have equal [page:.offset offset]
and [page:.direction direction].
</div>
<h3>[method:Vector3 intersectPlane]( [page:Plane plane], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
<h3>[method:Vector3 intersectBox]( [page:Box3 box], [page:Vector3 optionalTarget] )</h3>
<div>
plane -- [page:Plane] The [page:Plane] to intersect with.<br />
optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
</div>
<div>
Intersect this [page:Ray] with a [page:Plane], returning the intersection point or *null* if there is no intersection.
</div>
[page:Box3 box] - the [page:Box3] to intersect with.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
<h3>[method:Vector3 intersectSphere]( [page:Sphere sphere], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
<div>
sphere -- [page:Sphere] The [page:Sphere] to intersect with.<br />
optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
Intersect this [page:Ray] with a [page:Box3], returning the intersection point or
*null* if there is no intersection.
</div>
<h3>[method:Vector3 intersectPlane]( [page:Plane plane], [page:Vector3 optionalTarget] )</h3>
<div>
Intersect this [page:Ray] with a [page:Sphere], returning the intersection point or *null* if there is no intersection.
[page:Plane plane] - the [page:Plane] to intersect with.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
Intersect this [page:Ray] with a [page:Plane], returning the intersection point or
*null* if there is no intersection.
</div>
<h3>[method:Vector3 intersectTriangle]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c], [page:Boolean backfaceCulling], [page:Vector3 optionalTarget] = null ) [page:Vector3]</h3>
<h3>[method:Vector3 intersectSphere]( [page:Sphere sphere], [page:Vector3 optionalTarget] )</h3>
<div>
a, b, c -- [page:Vector3] The [page:Vector3] points on the triangle.<br />
backfaceCulling -- [page:Boolean] Whether to use backface culling.<br />
optionalTarget -- [page:Vector3] The [page:Vector3] to store the result in, or *null* to create a new [page:Vector3].
[page:Sphere sphere] - the [page:Sphere] to intersect with.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
Intersect this [page:Ray] with a [page:Sphere], returning the intersection point or
*null* if there is no intersection.
</div>
<h3>[method:Vector3 intersectTriangle]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c], [page:Boolean backfaceCulling], [page:Vector3 optionalTarget] )</h3>
<div>
Intersect this [page:Ray] with a triangle, returning the intersection point or *null* if there is no intersection.
[page:Vector3 a], [page:Vector3 b], [page:Vector3 c] - The [page:Vector3] points making up the triangle.<br />
[page:Boolean backfaceCulling] - whether to use backface culling.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
Intersect this [page:Ray] with a triangle, returning the intersection point or *null*
if there is no intersection.
</div>
<h3>[method:Boolean intersectsBox]( [page:Box3 box] )</h3>
<div>
box -- [page:Box3] The [page:Box3] to intersect with.
</div>
<div>
Return whether or not this [page:Ray] intersects with the [page:Box3].
[page:Box3 box] - the [page:Box3] to intersect with.<br /><br />
Return true if this [page:Ray] intersects with the [page:Box3].
</div>
<h3>[method:Boolean intersectsPlane]( [page:Plane plane] )</h3>
<div>
plane -- [page:Plane] The [page:Plane] to intersect with.
</div>
<div>
Return whether or not this [page:Ray] intersects with the [page:Plane].
[page:Plane plane] - the [page:Plane] to intersect with.<br /><br />
Return true if this [page:Ray] intersects with the [page:Plane].
</div>
<h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] )</h3>
<div>
sphere -- [page:Sphere] The [page:Sphere] to intersect with.
[page:Sphere sphere] - the [page:Sphere] to intersect with.<br /><br />
Return true if this [page:Ray] intersects with the [page:Sphere].
</div>
<h3>[method:Ray lookAt]( [page:Vector3 v] )</h3>
<div>
Return whether or not this [page:Ray] intersects with the [page:Sphere].
[page:Vector3 v] - The [page:Vector3] to look at.<br /><br />
Adjusts the direction of the ray to point at the vector in world coordinates.
</div>
<h3>[method:Ray recast]( [page:Float t] )</h3>
<div>
t -- The distance along the [page:Ray] to interpolate.
</div>
<div>
[page:Float t] - The distance along the [page:Ray] to interpolate.<br /><br />
Shift the origin of this [page:Ray] along its direction by the distance given.
</div>
<h3>[method:Ray set]( [page:Vector3 origin], [page:Vector3 direction] )</h3>
<div>
origin -- [page:Vector3] The origin of the [page:Ray].<br />
direction -- [page:Vector3] The direction of the [page:Ray]. This must be normalized (with [page:Vector3].normalize) for the methods to operate properly.
</div>
<div>
Copy the parameters to the origin and direction properties.
</div>
[page:Vector3 origin] - the [page:.origin origin] of the [page:Ray].<br />
[page:Vector3 origin] - the [page:.direction direction] of the [page:Ray].
This must be normalized (with [page:Vector3.normalize]) for the methods to operate
properly.<br /><br />
<h3>[method:Ray lookAt]( [page:Vector3 v] )</h3>
<div>
v -- [page:Vector3] The vector to look at.
</div>
<div>
Adjusts the direction of the ray to point at the vector in world coordinates.
Copy the parameters to the [page:.origin origin] and [page:.direction direction] properties
of this ray.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -10,16 +10,16 @@
<body>
<h1>[name]</h1>
<div class="desc">A geometric sphere defined by a center position and radius.</div>
<div class="desc">A sphere defined by a center and radius.</div>
<h2>Constructor</h2>
<h3>[name]( [page:Vector3 center], [page:Float radius] )</h3>
<div>
center -- [page:Vector3] <br />
radius -- [page:Float]
[page:Vector3 center] - center of the sphere. Default is a [page:Vector3] at (0, 0, 0). <br />
[page:Float radius] - radius of the sphere. Default is 0.<br /><br />
Creates a new [name].
</div>
......@@ -27,129 +27,109 @@
<h3>[property:Vector3 center]</h3>
<div>A [page:Vector3] defining the center of the sphere. Default is (0, 0, 0).</div>
<h3>[property:Float radius]</h3>
<div>The radius of the sphere. Default is 0.</div>
<h2>Methods</h2>
<h3>[method:Sphere set]( [page:Vector3 center], [page:Float radius] ) [page:Sphere this]</h3>
<h3>[method:Sphere applyMatrix4]( [page:Matrix4 matrix] )</h3>
<div>
center -- [page:Vector3] <br />
radius -- [page:Float]
</div>
<div>
Sets the center and radius.
</div>
[page:Matrix4 matrix] - the [Page:Matrix4] to apply <br /><br />
<h3>[method:Sphere applyMatrix4]( [page:Matrix4 matrix] ) [page:Sphere this]</h3>
<div>
matrix -- [page:Matrix4]
</div>
<div>
Transforms this sphere with the provided [page:Matrix4].
Transforms this sphere with the provided [page:Matrix4].
</div>
<h3>[method:Vector3 clampPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<div>
point -- [page:Vector3] The point to clamp <br />
optionalTarget -- [page:Vector3] The optional target point to return
</div>
<div>
Clamps a point within the sphere. If the point is is outside the sphere, it will clamp it to the closets point on the edge of the sphere.
</div>
[page:Vector3 point] - [page:Vector3] The point to clamp.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
<h3>[method:Sphere translate]( [page:Vector3 offset] ) [page:Sphere this]</h3>
<div>
offset -- [page:Vector3]
</div>
<div>
Translate the sphere's center by the provided offset vector.
Clamps a point within the sphere. If the point is is outside the sphere, it will clamp it to the
closets point on the edge of the sphere. Points already inside the sphere will not be affected.
</div>
<h3>[method:Sphere clone]()</h3>
<div>
Provides a new copy of the sphere.
</div>
<div>Returns a new sphere with the same [page:.center center] and [page:.radius radius] as this one.</div>
<h3>[method:Boolean equals]( [page:Sphere sphere] )</h3>
<div>
sphere -- [page:Sphere]
</div>
<h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
<div>
Checks to see if the two spheres' centers and radii are equal.
</div>
[page:Vector3 point] - the [page:Vector3] to be checked<br /><br />
<h3>[method:Sphere setFromPoints]( [page:Array points], [page:Vector3 optionalCenter] ) [page:Sphere this]</h3>
<div>
points -- [page:Array] of [page:Vector3] positions.<br />
optionalCenter -- Optional [page:Vector3] position for the sphere's center.<br />
Checks to see if the sphere contains the provided [page:Vector3 point] inclusive of the
surface of the sphere.
</div>
<h3>[method:Sphere copy]( [page:Sphere sphere] )</h3>
<div>
Computes the minimum bounding sphere for *points*. If *optionalCenter* is given, it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing *points* is calculated.
Copies the values of the passed sphere's [page:.center center] and [page:.radius radius]
properties to this sphere.
</div>
<h3>[method:Float distanceToPoint]( [page:Vector3 point] )</h3>
<div>
point -- [page:Vector3]
</div>
<div>
Returns the closest distance from the boundary of the sphere to the point. If the sphere contains the point, the distance will be negative.
Returns the closest distance from the boundary of the sphere to the [page:Vector3 point]. If the sphere contains the point,
the distance will be negative.
</div>
<h3>[method:Box3 getBoundingBox]( [page:Box optionalTarget] )</h3>
<div>
optionalTarget -- [page:Box]
</div>
<div>
Returns a bounding box for the sphere, optionally setting a provided box target.
</div>
<h3>[method:Boolean empty]()</h3>
<div>Checks to see if the sphere is empty (the radius set to 0).</div>
<h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
<h3>[method:Boolean equals]( [page:Sphere sphere] )</h3>
<div>
point -- [page:Vector3]
Checks to see if the two spheres' centers and radii are equal.
</div>
<h3>[method:Box3 getBoundingBox]( [page:Box3 optionalTarget] )</h3>
<div>
Checks to see if the sphere contains the provided point inclusive of the edge of the sphere.
[page:Box3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Box3] will be created.<br /><br />
Returns a[link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Box] for the sphere.
</div>
<h3>[method:Sphere copy]( [page:Sphere sphere] )</h3>
<h3>[method:Boolean intersectsBox]( [page:Box3 box] )</h3>
<div>
sphere -- [page:Sphere] to copy
[page:Box3 box] - [page:Box3] to check for intersection against.<br /><br />
Determines whether or not this sphere intersects a given [page:Box3 box].
</div>
<h3>[method:Boolean intersectsPlane]( [page:Plane plane] )</h3>
<div>
Copies the values of the passed sphere to this sphere.
[page:Plane plane] - Plane to check for intersection against.<br /><br />
Determines whether or not this sphere intersects a given [page:Plane plane].
</div>
<h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] )</h3>
<div>
sphere -- [page:Sphere]
</div>
<div>
[page:Sphere sphere] - Sphere to check for intersection against.<br /><br />
Checks to see if two spheres intersect.
</div>
<h3>[method:Boolean intersectsBox]( [page:Box3 box] ) [page:Sphere this]</h3>
<div>
box -- Box to check for intersection against.
</div>
<h3>[method:Sphere set]( [page:Vector3 center], [page:Float radius] )</h3>
<div>
Determines whether or not this sphere intersects *box*.
</div>
[page:Vector3 center] - center of the sphere.<br />
[page:Float radius] - radius of the sphere.<br /><br />
<h3>[method:Boolean intersectsPlane]( [page:Plane plane] ) [page:Sphere this]</h3>
<div>
plane -- Plane to check for intersection against.
Sets the [page:.center center] and [page:.radius radius] properties of this sphere.
</div>
<h3>[method:Sphere setFromPoints]( [page:Array points], [page:Vector3 optionalCenter] )</h3>
<div>
Determines whether or not this sphere intersects *plane*.
[page:Array points] - an [page:Array] of [page:Vector3] positions.<br />
[page:Vector3 optionalCenter] - Optional [page:Vector3] position for the sphere's center.<br /><br />
Computes the minimum bounding sphere for an array of [page:Array points]. If [page:Vector3 optionalCenter]is given,
it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing
[page:Array points] is calculated.
</div>
<h3>[method:Boolean empty]()</h3>
<div>
Checks to see if the sphere is empty (the radius set to 0).
<h3>[method:Sphere translate]( [page:Vector3 offset] )</h3>
Translate the sphere's center by the provided offset [page:Vector3].
</div>
<h2>Source</h2>
......
......@@ -10,7 +10,7 @@
<body>
<h1>[name]</h1>
<div class="desc">A point's spherical coordinates.</div>
<div class="desc">A point's [link:https://en.wikipedia.org/wiki/Spherical_coordinate_system spherical coordinates].</div>
<h2>Constructor</h2>
......@@ -18,11 +18,11 @@
<h3>[name]( [page:Float radius], [page:Float phi], [page:Float theta] )</h3>
<div>
radius -- [page:Float] the radius<br />
phi -- [page:Float] polar angle from the y (up) axis<br />
theta -- [page:Float] equator angle around the y (up) axis
</div>
<div>
[page:Float radius] - the radius, or the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance]
(straight-line distance) from the point to the origin. Default is *1.0*.<br />
[page:Float phi] - polar angle from the y (up) axis. Default is *0*.<br />
[page:Float theta] - equator angle around the y (up) axis. Default is *0*.<br /><br />
The poles (phi) are at the positive and negative y axis. The equator (theta) starts at positive z.
</div>
......@@ -38,29 +38,34 @@
<h2>Methods</h2>
<h3>[method:Spherical set]( [page:Float radius], [page:Float phi], [page:Float theta] ) [page:Spherical this]</h3>
<h3>[method:Spherical clone]()</h3>
<div>
Sets values of this spherical's component coordinates.
Returns a new plane with the same [page:.radius radius], [page:.phi phi]
and [page:.theta theta] properties as this one.
</div>
<h3>[method:Spherical copy]( [page:Spherical s] ) [page:Spherical this]</h3>
<h3>[method:Spherical copy]( [page:Spherical s] )</h3>
<div>
Copies value of *s* to this spherical.
Copies the values of the passed Spherical's [page:.radius radius], [page:.phi phi]
and [page:.theta theta] properties to this spherical.
</div>
<h3>[method:Spherical clone]() [page:Spherical this]</h3>
<h3>[method:Spherical makeSafe]()</h3>
<div>
Clones this spherical.
Restricts the polar angle page:.phi phi] to be between 0.000001 and pi - 0.000001.
</div>
<h3>[method:Spherical makeSafe]() [page:Spherical this]</h3>
<div>
Restricts the polar angle phi to be between 0.000001 and pi - 0.000001.
</div>
<h3>[method:Spherical set]( [page:Float radius], [page:Float phi], [page:Float theta] )</h3>
<div>Sets values of this spherical's [page:.radius radius], [page:.phi phi]
and [page:.theta theta] properties.</div>
<h3>[method:Spherical setFromVector3]( [page:Vector3 v] ) [page:Spherical this]</h3>
<h3>[method:Spherical setFromVector3]( [page:Vector3 vec3] )</h3>
<div>
Sets this object from the vector *v*.
Sets values of this spherical's [page:.radius radius], [page:.phi phi]
and [page:.theta theta] properties from the [page:Vector3 Vector3].<br /><br />
The [page:.radius radius] is set the vector's [page:Vector3.length], while the
[page:.phi phi] and [page:.theta theta] properties are set from its direction.
</div>
<h2>Source</h2>
......
......@@ -10,15 +10,27 @@
<body>
<h1>[name]</h1>
<div class="desc">Represents a spline.</div>
<div class="desc">
Class representing a [link:https://en.wikipedia.org/wiki/Spline_(mathematics) spline].<br /><br />
</div>
<h2>Examples</h2>
<div>
[example:webgl_lines_splines WebGL / lines / splines]<br />
[example:webgl_lines_dashed WebGL / lines / dashed]<br />
[example:software_sandbox Software / sandbox]<br />
[example:canvas_lines_dashed Canvas / lines / dashed]
</div>
<h2>Constructor</h2>
<h3>[name]( [page:Array points] )</h3>
<div>Initialises the spline with *points*, which are the places through which the spline will go.</div>
<div>
Initialises the spline with [page:Array points], which are the [page:Vector3 Vector3s]
through which the spline will pass.
</div>
<h2>Properties</h2>
......@@ -28,39 +40,59 @@
<h2>Methods</h2>
<h3>[method:null initFromArray]( [page:Array a] )</h3>
<h3>[method:Array getControlPointsArray]( )</h3>
<div>
a — array of triplets containing x, y, z coordinates<br />
</div>
<div>Initialises using the data in the array as a series of points. Each value in *a* must be another array with three values, where a[n] is v, the value for the *nth* point, and v[0], v[1] and v[2] are the x, y and z coordinates of that point n, respectively.
Returns an array with triplets of [ x, y, z ] coordinates that correspond to the
current control points.
</div>
<h3>[method:Vector3 getPoint]( [page:Integer k] )</h3>
<div>
k — point index
</div>
<div>Return the interpolated point at *k*.</div>
[page:Integer k] — point index<br /><br />
<h3>[method:Array getControlPointsArray]( )</h3>
<div>Returns an array with triplets of x, y, z coordinates that correspond to the current control points.
Return the interpolated point at [page:Integer k].
</div>
<h3>[method:Object getLength]( [page:Integer nSubDivisions] )</h3>
<div>
nSubDivisions — number of subdivisions between control points. Default is *100*.
[page:Integer nSubDivisions] — number of subdivisions between control points. Default is *100*.<br /><br />
Returns an object with the two properties. The property <strong>[page:Number total]</strong> contains
the length of the spline when using [page:Integer nSubDivisions]. The property [page:Array chunkLength]
contains an array with the total length from the beginning of the spline to the end of that chunk.
</div>
<h3>[method:null initFromArray]( [page:Array a] )</h3>
<div>
Returns an object with the two properties. The property .<strong>[page:Number total]</strong> contains
the length of the spline when using nSubDivisions. The property .[page:Array chunkLength]
contains an array with the total length from the beginning of the spline to the end of that chunk.
[page:Array a] — array of the form
<code>
var a = [ [x1, y1, z1], [x2, y2, z2], ... ];
</code>
from which to initialise the points array.<br /><br />
Initialises using the data in the array as a series of points. Each value in *a* must
be another array with three values, where a[n] is v, the value for the *nth* point,
and v[0], v[1] and v[2] are the x, y and z coordinates of that point n, respectively.
</div>
<h3>[method:Vector3 interpolate]( p0, p1, p2, p3, t, t2, t3 )</h3>
<div>
</div>
<h3>[method:null reparametrizeByArcLength]( [page:Float samplingCoef] )</h3>
<div>
samplingCoef — how many intermediate values to use between spline points
[page:Float samplingCoef] — how many intermediate values to use between spline points<br /><br />
Modifies the spline so that it looks similar to the original but has its points distributed
in such way that moving along the spline it's done at a more or less constant speed.
The points should also appear more uniformly spread along the curve.
This is done by resampling the original spline, with the density of sampling controlled by [page:Float samplingCoef].
Here it's interesting to note that denser sampling is not necessarily better:
if sampling is too high, you may get weird kinks in curvature.
</div>
<div>Modifies the spline so that it looks similar to the original but has its points distributed in such way that moving along the spline it's done at a more or less constant speed. The points should also appear more uniformly spread along the curve.</div>
<div>This is done by resampling the original spline, with the density of sampling controlled by *samplingCoef*. Here it's interesting to note that denser sampling is not necessarily better: if sampling is too high, you may get weird kinks in curvature.</div>
<h2>Source</h2>
......
......@@ -10,7 +10,10 @@
<body>
<h1>[name]</h1>
<div class="desc">A geometric triangle as defined by three vectors.</div>
<div class="desc">
A geometric triangle as defined by three [page:Vector3 Vector3s] representing its
three corners.
</div>
<h2>Constructor</h2>
......@@ -18,134 +21,112 @@
<h3>[name]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] )</h3>
<div>
a -- [page:Vector3] <br />
b -- [page:Vector3] <br />
c -- [page:Vector3]
</div>
<div>
Sets the triangle's vectors to the passed vectors.
[page:Vector3 a] - the first corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).<br />
[page:Vector3 b] - the second corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).<br />
[page:Vector3 c] - the final corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).<br /><br />
Creates a new [name].
</div>
<h2>Properties</h2>
<h3>[property:Vector3 a]</h3>
<div>
The first [page:Vector3] of the triangle.
The first corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).
</div>
<h3>[property:Vector3 b]</h3>
<div>
The second [page:Vector3] of the triangle.
The second corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).
</div>
<h3>[property:Vector3 c]</h3>
<div>
The third [page:Vector3] of the triangle.
the final corner of the triangle. Default is a [page:Vector3] at (0, 0, 0)
</div>
<h2>Methods</h2>
<h3>[method:Float area]()</h3>
<div>Return the area of the triangle.</div>
<h3>[method:Triangle setFromPointsAndIndices]( [page:Array points], [page:Integer i0], [page:Integer i1], [page:Integer i2] ) [page:Triangle this]</h3>
<div>
points -- [page:Array] of [page:Vector3]s <br />
i0 -- [page:Integer] index <br />
i1 -- [page:Integer] index <br />
i2 -- [page:Integer] index
</div>
<h3>[method:Vector3 barycoordFromPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<div>
Sets the triangle's vectors to the vectors in the array.
</div>
[page:Vector3 point] - [page:Vector3] <br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
<h3>[method:Triangle set]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] ) [page:Triangle this]</h3>
<div>
a -- [page:Vector3] <br />
b -- [page:Vector3] <br />
c -- [page:Vector3]
</div>
<div>
Sets the triangle's vectors to the passed vectors.
</div>
Return a [link:https://en.wikipedia.org/wiki/Barycentric_coordinate_system barycentric coordinate]
from the given vector. <br/><br/>
<h3>[method:Vector3 normal]( [page:Vector3 optionalTarget] )</h3>
<div>
optionalTarget -- Optional [page:Vector3] target to set the result.
</div>
[link:http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png Picture of barycentric coordinates]
</div>
<h3>[method:Triangle clone]()</h3>
<div>
Return the calculated normal of the triangle.
Returns a new triangle with the same [page:.a a], [page:.b b] and [page:.c c] properties as this one.
</div>
<h3>[method:Vector3 barycoordFromPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<h3>[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<div>
point -- [page:Vector3] <br />
optionalTarget -- Optional [page:Vector3] target to set the result.
point - [page:Vector3] <br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
Returns the closest point on the triangle to [page:Vector3 point].
</div>
<h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
<div>
Return a barycentric coordinate from the given vector. <br/><br/>
[link:http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png](Picture of barycentric coordinates)
[page:Vector3 point] - [page:Vector3] to check.<br /><br />
Returns true if the passed vector is within the triangle.
</div>
<h3>[method:Triangle clone]()</h3>
<h3>[method:Triangle copy]( [page:Triangle triangle] )</h3>
<div>
Return a new copy of this triangle.
Copies the values of the passed triangles's [page:.a a], [page:.b b] and [page:.c c]
properties to this triangle.
</div>
<h3>[method:Float area]()</h3>
<h3>[method:Boolean equals]( [page:Triangle triangle] )</h3>
<div>
Return the area of the triangle.
Returns true if the two triangles have identical [page:.a a], [page:.b b] and [page:.c c] properties.
</div>
<h3>[method:Vector3 midpoint]( [page:Vector3 optionalTarget] )</h3>
<div>
optionalTarget -- Optional [page:Vector3] target to set the result.
</div>
<div>
Return the midpoint of the triangle. Optionally sets a target vector.
</div>
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
<h3>[method:Boolean equals]( [page:Triangle triangle] )</h3>
<div>
triangle -- [page:Triangle]
Calculate the midpoint of the triangle.
</div>
<h3>[method:Vector3 normal]( [page:Vector3 optionalTarget] )</h3>
<div>
Checks to see if two triangles are equal (share the same vectors).
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
Calculate the [link:https://en.wikipedia.org/wiki/Normal_(geometry) normal vector] of the triangle.
</div>
<h3>[method:Plane plane]( [page:Plane optionalTarget] )</h3>
<div>
optionalTarget -- Optional [page:Plane] target to set the result.
</div>
<div>
Return a [page:Plane plane] based on the triangle. Optionally sets a target plane.
</div>
[page:Plane optionalTarget] - (optional) if specified, the result will be copied into this [page:Plane], otherwise a new [page:Plane] will be created.<br /><br />
<h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
<div>
point -- [page:Vector3]
</div>
<div>
Checks to see if the passed vector is within the triangle.
Create a [page:Plane plane] based on the triangle. .
</div>
<h3>[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<div>
point -- [page:Vector3] <br />
optionalTarget -- Optional [page:Vector3] target to set the result.
</div>
<h3>[method:Triangle set]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] ) [page:Triangle this]</h3>
<div>
Returns the closest point on the triangle.
Sets the triangle's [page:.a a], [page:.b b] and [page:.c c] properties to the passed [page:vector3 vector3s].
</div>
<h3>[method:Triangle copy]( [page:Triangle triangle] )</h3>
<div>
triangle -- [page:Triangle]
</div>
<h3>[method:Triangle setFromPointsAndIndices]( [page:Array points], [page:Integer i0], [page:Integer i1], [page:Integer i2] ) [page:Triangle this]</h3>
<div>
Copies the values of the vertices of the passed triangle to this triangle.
points - [page:Array] of [page:Vector3]s <br />
i0 - [page:Integer] index <br />
i1 - [page:Integer] index <br />
i2 - [page:Integer] index<br /><br />
Sets the triangle's vectors to the vectors in the array.
</div>
<h2>Source</h2>
......
......@@ -10,12 +10,38 @@
<body>
<h1>[name]</h1>
<div class="desc">2D vector.</div>
<div class="desc">
Class representing a 2D [link:https://en.wikipedia.org/wiki/Vector_space vector].
A 2D vector is an ordered pair of numbers (labeled x and y), which can be used to
represent a number of things, such as:
<ul>
<li>
A point in 2D space (i.e. a position on a plane).
</li>
<li>
A direction and length across a plane. In Three the length will always be the
[link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance]
(straight-line distance) from (0, 0) to (x, y) and the direction is also
measured from (0, 0) towards (x, y).
</li>
<li>
Any arbitrary ordered pair of numbers.
</li>
</ul>
There are other things a 2D vector can be used to represent, such as momentum
vectors, complex numbers and so on, however these are the most common uses in Three.
</div>
<h2>Example</h2>
<code>var a = new THREE.Vector2( 0, 1 );
var b = new THREE.Vector2( 1, 0 );
<code>
var a = new THREE.Vector2( 0, 1 );
//no arguments; will be initialised to (0, 0)
var b = new THREE.Vector2( );
var d = a.distanceTo( b );
</code>
......@@ -23,18 +49,29 @@
<h2>Constructor</h2>
<h3>[name]( [page:Float x], [page:Float y] )</h3>
<div>
x -- [page:Float] representing the x value of the vector <br />
y -- [page:Float] representing the y value of the vector
[page:Float x] - the x value of the vector. Default is *0*.<br />
[page:Float y] - the y value of the vector. Default is *0*.<br /><br />
Created a new [name].
</div>
<h2>Properties</h2>
<h3>[property:Boolean isVector2]</h3>
<div>
A vector in 2 dimensional space
Used to check whether this or derived classes are Vector2s. Default is *true*.<br /><br />
You should not change this, as it used internally for optimisation.
</div>
<h3>[property:Float height]</h3>
<div>Alias for [page:.y y].</div>
<h2>Properties</h2>
<h3>[property:Float width]</h3>
<div>Alias for [page:.x x].</div>
<h3>[property:Float x]</h3>
......@@ -43,270 +80,252 @@
<h2>Methods</h2>
<h3>[method:Vector2 set]( [page:Float x], [page:Float y] ) [page:Vector2 this]</h3>
<div>
Sets value of this vector.
</div>
<h3>[method:Vector2 add]( [page:Vector2 v] )</h3>
<div>Adds [page:Vector2 v] to this vector.</div>
<h3>[method:Vector2 setX]( [page:Float x] ) [page:Vector2 this]</h3>
<div>
x -- [page:Float]
</div>
<div>
replace this vector's x value with x.
</div>
<h3>[method:Vector2 addScalar]( [page:Float s] )</h3>
<div>Add the scalar value s to this vector's [page:.x x] and [page:.y y] values.</div>
<h3>[method:Vector2 setY]( [page:Float y] ) [page:Vector2 this]</h3>
<div>
y -- [page:Float]
</div>
<div>
replace this vector's y value with y.
</div>
<h3>[method:Vector2 addScaledVector]( [page:Vector2 v], [page:Float s] )</h3>
<div>Adds the multiple of [page:Vector2 v] and [page:Float s] to this vector.</div>
<h3>[method:Vector2 setScalar]( [page:Float scalar] ) [page:Vector2 this]</h3>
<div>
scalar -- [page:Float]
</div>
<div>
set all component values of this vector to *scalar*.
</div>
<h3>[method:Vector2 addVectors]( [page:Vector2 a], [page:Vector2 b] )</h3>
<div>Sets this vector to [page:Vector2 a] + [page:Vector2 b].</div>
<h3>[method:Vector2 copy]( [page:Vector2 v] ) [page:Vector2 this]</h3>
<h3>[method:Float angle]()</h3>
<div>
Copies value of *v* to this vector.
Computes the angle in radians of this vector with respect to the positive x-axis.
</div>
<h3>[method:Vector2 fromArray]( [page:Array array], [page:Integer offset] ) [page:Vector2 this]</h3>
<div>
array -- The source array of length 2 <br />
offset -- An optional offset into the array.
</div>
<h3>[method:Vector2 ceil]()</h3>
<div>
Sets this vector's x value to be array[0] and y value to be array[1].
The [page:.x x] and [page:.y y] components of the vector are rounded up to the nearest integer value.
</div>
<h3>[method:Vector2 add]( [page:Vector2 v] ) [page:Vector2 this]</h3>
<h3>[method:Vector2 clamp]( [page:Vector2 min], [page:Vector2 max] )</h3>
<div>
Adds *v* to this vector.
</div>
[page:Vector2 min] - the minimum x and y values.<br />
[page:Vector2 max] - the maximum x and y values in the desired range<br /><br />
<h3>[method:Vector2 addVectors]( [page:Vector2 a], [page:Vector2 b] ) [page:Vector2 this]</h3>
<div>
Sets this vector to *a + b*.
If this vector's x or y value is greater than the max vector's x or y value, it is replaced by the corresponding value. <br /><br />
If this vector's x or y value is less than the min vector's x or y value, it is replaced by the corresponding value.
</div>
<h3>[method:Vector2 addScaledVector]( [page:Vector2 v], [page:Float s] ) [page:Vector2 this]</h3>
<h3>[method:Vector2 clampLength]( [page:Float min], [page:Float max] )</h3>
<div>
Adds the multiple of v and s to this vector.
</div>
[page:Float min] - the minimum value the length will be clamped to <br />
[page:Float max] - the maximum value the length will be clamped to<br /><br />
<h3>[method:Vector2 sub]( [page:Vector2 v] ) [page:Vector2 this]</h3>
<div>
Subtracts *v* from this vector.
If this vector's length is greater than the max value, it is replaced by the max value. <br /><br />
If this vector's length is less than the min value, it is replaced by the min value.
</div>
<h3>[method:Vector2 subVectors]( [page:Vector2 a], [page:Vector2 b] ) [page:Vector2 this]</h3>
<h3>[method:Vector2 clampScalar]( [page:Float min], [page:Float max] )</h3>
<div>
Sets this vector to *a - b*.
</div>
[page:Float min] - the minimum value the components will be clamped to <br />
[page:Float max] - the maximum value the components will be clamped to<br /><br />
<h3>[method:Vector2 multiplyScalar]( [page:Float s] ) [page:Vector2 this]</h3>
<div>
Multiplies this vector by scalar *s*.
If this vector's x or y values are greater than the max value, they are replaced by the max value. <br /><br />
If this vector's x or y values are less than the min value, they are replaced by the min value.
</div>
<h3>[method:Vector2 divideScalar]( [page:Float s] ) [page:Vector2 this]</h3>
<h3>[method:Vector2 clone]()</h3>
<div>
Divides this vector by scalar *s*.<br />
Set vector to *( 0, 0 )* if *s == 0*.
Returns a new vector2 with the same [page:.x x] and [page:.y y] values as this one.
</div>
<h3>[method:Vector2 negate]() [page:Vector2 this]</h3>
<h3>[method:Vector2 copy]( [page:Vector2 v] )</h3>
<div>
Inverts this vector.
Copies the values of the passed vector2's [page:.x x] and [page:.y y]
properties to this vector2.
</div>
<h3>[method:Float dot]( [page:Vector2 v] ) [page:Vector2 this]</h3>
<div>
Computes dot product of this vector and *v*.
</div>
<h3>[method:Float distanceTo]( [page:Vector2 v] )</h3>
<div>Computes the distance from this vector to [page:Vector2 v].</div>
<h3>[method:Float lengthSq]() [page:Vector2 this]</h3>
<h3>[method:Float distanceToManhattan]( [page:Vector2 v] )</h3>
<div>
Computes the squared length of this vector.
Computes the [link:https://en.wikipedia.org/wiki/Taxicab_geometry Manhattan distance] from this vector to [page:Vector2 v].
</div>
<h3>[method:Float length]() [page:Vector2 this]</h3>
<h3>[method:Float distanceToSquared]( [page:Vector2 v] )</h3>
<div>
Computes the length of this vector.
Computes the squared distance from this vector to [page:Vector2 v]. If you are just
comparing the distance with another distance, you should compare the distance squared instead
as it is slightly more efficient to calculate.
</div>
<h3>[method:Float lengthManhattan]() [page:Vector2 this]</h3>
<div>
Computes the Manhattan length of this vector.<br />
[link:http://en.wikipedia.org/wiki/Taxicab_geometry]
</div>
<h3>[method:Vector2 divide]( [page:Vector2 v] )</h3>
<div>Divides this vector by [page:Vector2 v].</div>
<h3>[method:Vector2 normalize]() [page:Vector2 this]</h3>
<h3>[method:Vector2 divideScalar]( [page:Float s] )</h3>
<div>
Normalizes this vector.
Divides this vector by scalar [page:Float s].<br />
Sets vector to *( 0, 0 )* if [page:Float s] = 0.
</div>
<h3>[method:Float angle]() [page:Vector2 this]</h3>
<h3>[method:Float dot]( [page:Vector2 v] )</h3>
<div>
Computes the angle in radians of this vector with respect to the positive x-axis.
Calculate the [link:https://en.wikipedia.org/wiki/Dot_product dot product] of this
vector and [page:Vector2 v].
</div>
<h3>[method:Float distanceTo]( [page:Vector2 v] )</h3>
<div>
Computes the distance from this vector to *v*.
</div>
<h3>[method:Boolean equals]( [page:Vector2 v] )</h3>
<div>Checks for strict equality of this vector and [page:Vector2 v].</div>
<h3>[method:Float distanceToSquared]( [page:Vector2 v] )</h3>
<div>
Computes the squared distance from this vector to *v*.
</div>
<h3>[method:Vector2 floor]()</h3>
<div>The components of the vector are rounded down to the nearest integer value.</div>
<h3>[method:Float distanceToManhattan]( [page:Vector2 v] )</h3>
<h3>[method:Vector2 fromArray]( [page:Array array], [page:Integer offset] )</h3>
<div>
Computes the Manhattan distance from this vector to *v*.
[page:Array array] - the source array.<br />
[page:Integer offset] - ( optional) offset into the array. Default is 0.<br /><br />
Sets this vector's [page:.x x] value to be array[0] and [page:.y y] value to be array[1].
</div>
<h3>[method:Vector2 setLength]( [page:Float l] ) [page:Vector2 this]</h3>
<h3>[method:Vector2 fromAttribute]( [page:BufferAttribute attribute], [page:Integer index], [page:Integer offset] )</h3>
<div>
Normalizes this vector and multiplies it by *l*.
[page:BufferAttribute attribute] - the source attribute.<br />
[page:Integer index] - index in the attribute.<br /><br />
[page:Integer offset] - (optional) offset into the attribute. Default is 0.<br /><br />
Sets this vector's [page:.x x] and [page:.y y] values from the [page:BufferAttribute attribute].
</div>
<h3>[method:Vector2 clamp]( [page:Vector2 min], [page:Vector2 max] ) [page:Vector2 this]</h3>
<h3>[method:Float getComponent]( [page:Integer index] )</h3>
<div>
min -- [page:Vector2] containing the min x and y values in the desired range <br />
max -- [page:Vector2] containing the max x and y values in the desired range
[page:Integer index] - 0 or 1.<br /><br />
If index equals 0 returns the [page:.x x] value. <br />
If index equals 1 returns the [page:.y y] value.
</div>
<h3>[method:Float length]()</h3>
<div>Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
(straight-line length) from (0, 0) to (x, y).</div>
<h3>[method:Float lengthManhattan]()</h3>
<div>
If this vector's x or y value is greater than the max vector's x or y value, it is replaced by the corresponding value. <br /><br />
If this vector's x or y value is less than the min vector's x or y value, it is replaced by the corresponding value.
Computes the [link:http://en.wikipedia.org/wiki/Taxicab_geometry Manhattan length] of this vector.
</div>
<h3>[method:Vector2 clampScalar]( [page:Float min], [page:Float max] ) [page:Vector2 this]</h3>
<h3>[method:Float lengthSq]()</h3>
<div>
min -- [page:Float] the minimum value the components will be clamped to <br />
max -- [page:Float] the maximum value the components will be clamped to
Computes the square of the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
(straight-line length) from (0, 0) to (x, y). If you are comparing the lengths of
vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
</div>
<h3>[method:Vector2 lerp]( [page:Vector2 v], [page:Float alpha] )</h3>
<div>
If this vector's x or y values are greater than the max value, they are replaced by the max value. <br /><br />
If this vector's x or y values are less than the min value, they are replaced by the min value.
[page:Vector2 v] - [page:Vector2] to interpolate towards.<br />
alpha - interpolation factor in the closed interval [0, 1].<br /><br />
Linearly interpolate between this vector and [page:Vector2 v], where alpha is the
distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector2 v].
</div>
<h3>[method:Vector2 clampLength]( [page:Float min], [page:Float max] ) [page:Vector2 this]</h3>
<h3>[method:Vector2 lerpVectors]( [page:Vector2 v1], [page:Vector2 v2], [page:Float alpha] )</h3>
<div>
min -- [page:Float] the minimum value the length will be clamped to <br />
max -- [page:Float] the maximum value the length will be clamped to
[page:Vector2 v1] - the starting [page:Vector2].<br />
[page:Vector2 v2] - [page:Vector2] to interpolate towards.<br />
[page:Float alpha] - interpolation factor in the closed interval [0, 1].<br /><br />
Sets this vector to be the vector linearly interpolated between [page:Vector2 v1] and
[page:Vector2 v2] where alpha is the distance along the line connecting the two vectors
- alpha = 0 will be [page:Vector2 v1], and alpha = 1 will be [page:Vector2 v2].
</div>
<h3>[method:Vector2 negate]()</h3>
<div>Inverts this vector - i.e. sets x = -x and y = -y.</div>
<h3>[method:Vector2 normalize]()</h3>
<div>
If this vector's length is greater than the max value, it is replaced by the max value. <br /><br />
If this vector's length is less than the min value, it is replaced by the min value.
Convert this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction
as this one, but [page:.length length] 1.
</div>
<h3>[method:Vector2 floor]() [page:Vector2 this]</h3>
<h3>[method:Vector2 max]( [page:Vector2 v] )</h3>
<div>
The components of the vector are rounded downwards (towards negative infinity) to an integer value.
If this vector's x or y value is less than [page:Vector2 v's] x or y value, replace
that value with the corresponding max value.
</div>
<h3>[method:Vector2 ceil]() [page:Vector2 this]</h3>
<h3>[method:Vector2 min]( [page:Vector2 v] )</h3>
<div>
The components of the vector are rounded upwards (towards positive infinity) to an integer value.
If this vector's x or y value is greater than [page:Vector2 v's] x or y value, replace
that value with the corresponding min value.
</div>
<h3>[method:Vector2 round]() [page:Vector2 this]</h3>
<h3>[method:Vector2 multiply]( [page:Vector2 v] )</h3>
<div>Multiplies this vector by [page:Vector2 v].</div>
<h3>[method:Vector2 multiplyScalar]( [page:Float s] )</h3>
<div>Multiplies this vector by scalar [page:Float s].</div>
<h3>[method:Vector2 rotateAround]( [page:Vector2 center], [page:float angle] )</h3>
<div>
The components of the vector are rounded towards the nearest integer value.
[page:Vector2 center] - the point around which to rotate.<br />
[page:float angle] - the angle to rotate, in radians.<br /><br />
Rotate the vector arounf [page:Vector2 center] by [page:float angle] radians.
</div>
<h3>[method:Vector2 roundToZero]() [page:Vector2 this]</h3>
<h3>[method:Vector2 round]()</h3>
<div>The components of the vector are rounded to the nearest integer value.</div>
<h3>[method:Vector2 roundToZero]()</h3>
<div>
The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
</div>
<h3>[method:Vector2 lerp]( [page:Vector2 v], [page:Float alpha] ) [page:Vector2 this]</h3>
<div>
v -- [page:Vector2] <br />
alpha -- [page:Float] between 0 and 1;
</div>
<div>
Linear interpolation between this vector and v, where alpha is the percent along the line.
</div>
<h3>[method:Vector2 set]( [page:Float x], [page:Float y] )</h3>
<div>Sets the [page:.x x] and [page:.y y] components of this vector.</div>
<h3>[method:Vector2 lerpVectors]( [page:Vector2 v1], [page:Vector2 v2], [page:Float alpha] ) [page:Vector2 this]</h3>
<h3>[method:null setComponent]( [page:Integer index], [page:Float value] )</h3>
<div>
v1 -- [page:Vector2] <br />
v2 -- [page:Vector2] <br />
alpha -- [page:Float] between 0 and 1.
</div>
<div>
Sets this vector to be the vector linearly interpolated between *v1* and *v2* with *alpha* factor.
</div>
[page:Integer index] - 0 or 1.<br />
[page:Float value] - [page:Float]<br /><br />
<h3>[method:null setComponent]( [page:Integer index], [page:Float value] ) [page:Vector2 this]</h3>
<div>
index -- 0 or 1 <br />
value -- [page:Float]
</div>
<div>
if index equals 0 method replaces this.x with value. <br />
if index equals 1 method replaces this.y with value.
If index equals 0 set [page:.x x] to [page:Float value]. <br />
If index equals 1 set [page:.y y] to [page:Float value]
</div>
<h3>[method:Vector2 addScalar]( [page:Float s] ) [page:Vector2 this]</h3>
<h3>[method:Vector2 setLength]( [page:Float l] )</h3>
<div>
s -- [page:Float]
</div>
<div>
Add the scalar value s to this vector's x and y values.
Set this vector to the vector with the same direction as this one, but [page:.length length]
[page:Float l].
</div>
<h3>[method:Float getComponent]( [page:Integer index] ) [page:Vector2 this]</h3>
<div>
index -- 0 or 1
</div>
<h3>[method:Vector2 setScalar]( [page:Float scalar] )</h3>
<div>
if index equals 0 returns the x value. <br />
if index equals 1 returns the y value.
Set the [page:.x x] and [page:.y y] values of this vector both equal to [page:Float scalar].
</div>
<h3>[method:Vector2 min]( [page:Vector2 v] ) [page:Vector2 this]</h3>
<div>
v -- [page:Vector2]
</div>
<div>
If this vector's x or y value is greater than v's x or y value, replace that value with the corresponding min value.
</div>
<h3>[method:Vector2 setX]( [page:Float x] )</h3>
<div>Replace this vector's [page:.x x] value with [page:Float x].</div>
<h3>[method:Vector2 max]( [page:Vector2 v] ) [page:Vector2 this]</h3>
<div>
v -- [page:Vector2]
</div>
<div>
If this vector's x or y value is less than v's x or y value, replace that value with the corresponding max value.
</div>
<h3>[method:Vector2 setY]( [page:Float y] )</h3>
<div>Replace this vector's [page:.y y] value with [page:Float y].</div>
<h3>[method:Boolean equals]( [page:Vector2 v] ) [page:Vector2 this]</h3>
<div>
Checks for strict equality of this vector and *v*.
</div>
<h3>[method:Vector2 sub]( [page:Vector2 v] )</h3>
<div>Subtracts [page:Vector2 v] from this vector.</div>
<h3>[method:Vector2 clone]() [page:Vector2 this]</h3>
<div>
Clones this vector.
</div>
<h3>[method:Vector2 subScalar]( [page:Float s] )</h3>
<div>Subtracts [page:Float s] from this vector's [page:.x x] and [page:.y y] compnents.</div>
<h3>[method:Array toArray]( [page:Array array], [page:Integer offset] ) [page:Vector2 this]</h3>
<div>
array -- An optional array to store the vector to. <br />
offset -- An optional offset into the array.
</div>
<h3>[method:Vector2 subVectors]( [page:Vector2 a], [page:Vector2 b] )</h3>
<div>Sets this vector to [page:Vector2 a] - [page:Vector2 b].</div>
<h3>[method:Array toArray]( [page:Array array], [page:Integer offset] )</h3>
<div>
Returns an array [x, y].
[page:Array array] - (optional) array to store the vector to. If this is not provided
a new array will be created.<br />
[page:Integer offset] - (optional) optional offset into the array.<br /><br />
Returns an array [x, y], or copies x and y into the provided [page:Array array].
</div>
<h2>Source</h2>
......
此差异已折叠。
此差异已折叠。
......@@ -2130,9 +2130,11 @@ SEA3D.Material = function ( name, data, sea3d ) {
if ( this.attrib & 128 )
this.animations = data.readAnimationList( sea3d );
this.depthMask = ( this.attrib & 256 ) == 0;
this.depthWrite = ( this.attrib & 256 ) == 0;
this.depthTest = ( this.attrib & 512 ) == 0;
this.premultipliedAlpha = ( this.attrib & 1024 ) != 0;
var count = data.readUByte();
for ( var i = 0; i < count; ++ i ) {
......
......@@ -168,6 +168,12 @@ SEA3D.Physics = function ( name, data, sea3d ) {
if ( this.attrib & 1 ) this.target = sea3d.getObject( data.readUInt() );
else this.transform = data.readMatrix();
if ( this.attrib & 2 ) this.offset = data.readMatrix();
if ( this.attrib & 4 ) this.scripts = data.readScriptList( sea3d );
if ( this.attrib & 16 ) this.attributes = sea3d.getObject( data.readUInt() );
};
SEA3D.Physics.prototype.readTag = function ( kind, data, size ) {
......@@ -257,11 +263,21 @@ SEA3D.CarController.Wheel = function ( data, sea3d ) {
this.data = data;
this.sea3d = sea3d;
var attrib = data.readUShort();
this.attrib = data.readUShort();
this.isFront = ( this.attrib & 1 ) != 0;
if ( this.attrib & 2 ) {
this.isFront = ( attrib & 1 ) != 0,
this.target = sea3d.getObject( data.readUInt() );
this.target = sea3d.getObject( data.readUInt() );
}
if ( this.attrib & 4 ) {
this.offset = data.readMatrix();
}
this.pos = data.readVector3();
this.dir = data.readVector3();
......
......@@ -107,7 +107,7 @@
};
// Open3DGC - Export by SEA3D Studio
loader.load( './models/sea3d/robot.o3dgc.tjs.sea' );
loader.load( './models/sea3d/robot.tjs.sea' );
//
......
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - sea3d / skin</title>
<title>three.js webgl - sea3d / skinning</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册