ActionScript 3.0 Language and Components Reference | All Packages | All Classes | Language Elements | Index | Appendixes | Conventions | Frames No Frames |
Utils3D

Package | flash.geom
Class | public class Utils3D
Inheritance | Utils3D Object

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

The Utils3D class contains static methods that simplify the implementation of certain three-dimensional matrix operations.

See also

flash.geom.Matrix3D
flash.geom.Vector3D
flash.geom.Transform
flash.geom.PerspectiveProjection
flash.display.Graphics
flash.display.GraphicsTrianglePath
Vector

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | prototype : Object [static] A reference to the prototype object of a class or function object. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | pointTowards(percent:Number, mat:Matrix3D, pos:Vector3D, at:Vector3D = null, up:Vector3D = null):Matrix3D [static] Interpolates the orientation of an object toward a position. | Utils3D
|  | projectVector(m:Matrix3D, v:Vector3D):Vector3D [static] Using a projection Matrix3D object, projects a Vector3D object from one space coordinate to another. | Utils3D
|  | projectVectors(m:Matrix3D, verts:Vector, projectedVerts:Vector, uvts:Vector):void [static] Using a projection Matrix3D object, projects a Vector of three-dimensional space coordinates (verts) to a Vector of two-dimensional space coordinates (projectedVerts). | Utils3D
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Method Detail

pointTowards | () | method

`public static function pointTowards(percent:Number, mat:Matrix3D, pos:Vector3D, at:Vector3D = null, up:Vector3D = null):Matrix3D`

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

Interpolates the orientation of an object toward a position. The `pointTowards()` method combines the functionality of the `Matrix3D.pointAt()` and `Matrix3D.interpolateTo()` methods.

The `pointTowards()` method allows for in-place modification to the orientation. It decomposes the Matrix3D of the display object and replaces the rotation elements by ones that make a percent turn toward the position of the target. The object can make an incremental turn toward the target while still moving in its own direction. The consecutive calls to the `pointTowards()` followed by a translation method can produce the animation of an object chasing or following a moving target. First point the object a percent point toward the target, then incrementally move the object along an axis.

Parameters

| `percent:Number` — A Number between 0 and 1 that incrementally turns the object toward the target.
| `mat:Matrix3D` — The Matrix3D property of the object that is transformed.
| `pos:Vector3D` — The world-relative position of the target object. World-relative defines the transformation of the object relative to the world space and coordinates, where all objects are positioned.
| `at:Vector3D` (default = `null`)`` — The object-relative vector that defines where the display object is pointing. Object-relative defines the transformation of the object relative to the object space, the object's own frame of reference and coordinate system. Default value is (0,0,-1).
| `up:Vector3D` (default = `null`)`` — The object-relative vector that defines "up" for the display object. If the object is drawn looking down from the above, the +z axis is its "up" vector. Object-relative defines the transformation of the object relative to the object space, the object's own frame of reference and coordinate system. Default value is (0,-1,0).

Returns

| `Matrix3D` — A modified version of the Matrix3D object specified in the second parameter. To transform the display object using the `pointTowards()` method, set the Matrix3D property of the display object to the returned Matrix3D object.

See also

flash.geom.Matrix3D.pointAt()
flash.geom.Matrix3D.interpolateTo()
flash.geom.Matrix3D.interpolate()

projectVector | () | method |

`public static function projectVector(m:Matrix3D, v:Vector3D):Vector3D`

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

Using a projection Matrix3D object, projects a Vector3D object from one space coordinate to another. The `projectVector()` method is like the `Matrix3D.transformVector()` method except that the `projectVector()` method divides the x, y, and z elements of the original Vector3D object by the projection depth value. The depth value is the distance from the eye to the Vector3D object in view or eye space. The default value for this distance is the value of the z element.

Parameters

| `m:Matrix3D` — A projection Matrix3D object that implements the projection transformation. If a display object has a PerspectiveProjection object, you can use the `perspectiveProjection.toMatrix()` method to produce a projection Matrix3D object that applies to the children of the display object. For more advance projections, use the `matrix3D.rawData` property to create a custom projection matrix. There is no built-in Matrix3D method for creating a projection Matrix3D object.
| `v:Vector3D` — The Vector3D object that is projected to a new space coordinate.

Returns

| `Vector3D` — A new Vector3D with a transformed space coordinate.

See also

flash.geom.Matrix3D.transformVector()
projectVectors()

projectVectors | () | method |

`public static function projectVectors(m:Matrix3D, verts:Vector, projectedVerts:Vector, uvts:Vector):void`

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

Using a projection Matrix3D object, projects a Vector of three-dimensional space coordinates (verts) to a Vector of two-dimensional space coordinates (`projectedVerts`). The projected Vector object should be pre-allocated before it is used as a parameter.

The `projectVectors()` method also sets the t value of the uvt data. You should pre-allocate a Vector that can hold the uvts data for each projected Vector set of coordinates. Also specify the u and v values of the uvt data. The uvt data is a Vector of normalized coordinates used for texture mapping. In UV coordinates, (0,0) is the upper left of the bitmap, and (1,1) is the lower right of the bitmap.

This method can be used in conjunction with the `Graphics.drawTriangles()` method and the `GraphicsTrianglePath` class.

Parameters

| `m:Matrix3D` — A projection Matrix3D object that implements the projection transformation. You can produce a projection Matrix3D object using the `Matrix3D.rawData` property.
| `verts:Vector` — A Vector of Numbers, where every three Numbers represent the x, y, and z coordinates of a three-dimensional space, like `Vector3D(x,y,z)`.
| `projectedVerts:Vector` — A vector of Numbers, where every two Numbers represent a projected two-dimensional coordinate, like `Point(x,y)`. You should pre-allocate the Vector. The `projectVectors()` method fills the values for each projected point.
| `uvts:Vector` — A vector of Numbers, where every three Numbers represent the u, v, and t elements of the `uvt` data. The u and v are the texture coordinate for each projected point. The t value is the projection depth value, the distance from the eye to the Vector3D object in the view or eye space. You should pre-allocate the Vector and specify the u and v values. The `projectVectors` method fills the t value for each projected point.

See also

flash.display.Graphics.drawTriangles()
flash.display.GraphicsTrianglePath
flash.geom.Matrix3D
projectVector()
Vector

Submit Feedback on LiveDocs
© 2004-2008 Adobe Systems Incorporated. All rights reserved.
Tue May 20 2008, 04:02 AM -07:00