ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Hide Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes

Language Reference only
Filters: AIR 32.0 and earlier, Flash Player 32.0 and earlier, Flash Lite 4
Flex 4.6 and earlier, Flash Pro CS6 and earlier
Hide Filters
flash.geom 

Vector3D  - AS3

Packagesx

Top Level
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

Language Elements

Global Constants
Global Functions
Operators
Statements, Keywords & Directives
Special Types

Appendixes

What's New
Compiler Errors
Compiler Warnings
Run-Time Errors
Migrating to ActionScript 3
Supported Character Sets
MXML Only Tags
Motion XML Elements
Timed Text Tags
List of deprecated elements
Accessibility Implementation Constants
How to Use ActionScript Examples
Legal notices
Packageflash.geom
Classpublic class Vector3D
InheritanceVector3D Inheritance Object

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The Vector3D class represents a point or a location in the three-dimensional space using the Cartesian coordinates x, y, and z. As in a two-dimensional space, the x property represents the horizontal axis and the y property represents the vertical axis. In three-dimensional space, the z property represents depth. The value of the x property increases as the object moves to the right. The value of the y property increases as the object moves down. The z property increases as the object moves farther from the point of view. Using perspective projection and scaling, the object is seen to be bigger when near and smaller when farther away from the screen. As in a right-handed three-dimensional coordinate system, the positive z-axis points away from the viewer and the value of the z property increases as the object moves away from the viewer's eye. The origin point (0,0,0) of the global space is the upper-left corner of the stage.

X, Y, Z Axes

The Vector3D class can also represent a direction, an arrow pointing from the origin of the coordinates, such as (0,0,0), to an endpoint; or a floating-point component of an RGB (Red, Green, Blue) color model.

Quaternion notation introduces a fourth element, the w property, which provides additional orientation information. For example, the w property can define an angle of rotation of a Vector3D object. The combination of the angle of rotation and the coordinates x, y, and z can determine the display object's orientation. Here is a representation of Vector3D elements in matrix notation:

Vector3D elements

Related API Elements



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  length : Number
[read-only] The length, magnitude, of the current Vector3D object from the origin (0,0,0) to the object's x, y, and z coordinates.
Vector3D
  lengthSquared : Number
[read-only] The square of the length of the current Vector3D object, calculated using the x, y, and z properties.
Vector3D
  w : Number
The fourth element of a Vector3D object (in addition to the x, y, and z properties) can hold data such as the angle of rotation.
Vector3D
  x : Number
The first element of a Vector3D object, such as the x coordinate of a point in the three-dimensional space.
Vector3D
  y : Number
The second element of a Vector3D object, such as the y coordinate of a point in the three-dimensional space.
Vector3D
  z : Number
The third element of a Vector3D object, such as the z coordinate of a point in three-dimensional space.
Vector3D
Public Methods
 MethodDefined By
  
Vector3D(x:Number = 0., y:Number = 0., z:Number = 0., w:Number = 0.)
Creates an instance of a Vector3D object.
Vector3D
  
Adds the value of the x, y, and z elements of the current Vector3D object to the values of the x, y, and z elements of another Vector3D object.
Vector3D
  
[static] Returns the angle in radians between two vectors.
Vector3D
  
Returns a new Vector3D object that is an exact copy of the current Vector3D object.
Vector3D
  
copyFrom(sourceVector3D:Vector3D):void
Copies all of vector data from the source Vector3D object into the calling Vector3D object.
Vector3D
  
Returns a new Vector3D object that is perpendicular (at a right angle) to the current Vector3D and another Vector3D object.
Vector3D
  
Decrements the value of the x, y, and z elements of the current Vector3D object by the values of the x, y, and z elements of specified Vector3D object.
Vector3D
  
[static] Returns the distance between two Vector3D objects.
Vector3D
  
If the current Vector3D object and the one specified as the parameter are unit vertices, this method returns the cosine of the angle between the two vertices.
Vector3D
  
equals(toCompare:Vector3D, allFour:Boolean = false):Boolean
Determines whether two Vector3D objects are equal by comparing the x, y, and z elements of the current Vector3D object with a specified Vector3D object.
Vector3D
 Inherited
Indicates whether an object has a specified property defined.
Object
  
Increments the value of the x, y, and z elements of the current Vector3D object by the values of the x, y, and z elements of a specified Vector3D object.
Vector3D
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
nearEquals(toCompare:Vector3D, tolerance:Number, allFour:Boolean = false):Boolean
Compares the elements of the current Vector3D object with the elements of a specified Vector3D object to determine whether they are nearly equal.
Vector3D
  
Sets the current Vector3D object to its inverse.
Vector3D
  
Converts a Vector3D object to a unit vector by dividing the first three elements (x, y, z) by the length of the vector.
Vector3D
  
Divides the value of the x, y, and z properties of the current Vector3D object by the value of its w property.
Vector3D
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
Scales the current Vector3D object by a scalar, a magnitude.
Vector3D
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
  
Sets the members of Vector3D to the specified values
Vector3D
  
Subtracts the value of the x, y, and z elements of the current Vector3D object from the values of the x, y, and z elements of another Vector3D object.
Vector3D
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
  
Returns a string representation of the current Vector3D object.
Vector3D
 Inherited
Returns the primitive value of the specified object.
Object
Public Constants
 ConstantDefined By
  X_AXIS : Vector3D
[static] The x axis defined as a Vector3D object with coordinates (1,0,0).
Vector3D
  Y_AXIS : Vector3D
[static] The y axis defined as a Vector3D object with coordinates (0,1,0).
Vector3D
  Z_AXIS : Vector3D
[static] The z axis defined as a Vector3D object with coordinates (0,0,1).
Vector3D
Property Detail

length

property
length:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The length, magnitude, of the current Vector3D object from the origin (0,0,0) to the object's x, y, and z coordinates. The w property is ignored. A unit vector has a length or magnitude of one.



Implementation
    public function get length():Number

Related API Elements

lengthSquared

property 
lengthSquared:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The square of the length of the current Vector3D object, calculated using the x, y, and z properties. The w property is ignored. Use the lengthSquared() method whenever possible instead of the slower Math.sqrt() method call of the Vector3D.length() method.



Implementation
    public function get lengthSquared():Number

Related API Elements

w

property 
public var w:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The fourth element of a Vector3D object (in addition to the x, y, and z properties) can hold data such as the angle of rotation. The default value is 0.

Quaternion notation employs an angle as the fourth element in its calculation of three-dimensional rotation. The w property can be used to define the angle of rotation about the Vector3D object. The combination of the rotation angle and the coordinates (x,y,z) determines the display object's orientation.

In addition, the w property can be used as a perspective warp factor for a projected three-dimensional position or as a projection transform value in representing a three-dimensional coordinate projected into the two-dimensional space. For example, you can create a projection matrix using the Matrix3D.rawData property, that, when applied to a Vector3D object, produces a transform value in the Vector3D object's fourth element (the w property). Dividing the Vector3D object's other elements by the transform value then produces a projected Vector3D object. You can use the Vector3D.project() method to divide the first three elements of a Vector3D object by its fourth element.

Related API Elements

x

property 
public var x:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The first element of a Vector3D object, such as the x coordinate of a point in the three-dimensional space. The default value is 0.

y

property 
public var y:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The second element of a Vector3D object, such as the y coordinate of a point in the three-dimensional space. The default value is 0.

z

property 
public var z:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The third element of a Vector3D object, such as the z coordinate of a point in three-dimensional space. The default value is 0.

Constructor Detail

Vector3D

()Constructor
public function Vector3D(x:Number = 0., y:Number = 0., z:Number = 0., w:Number = 0.)

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Creates an instance of a Vector3D object. If you do not specify a parameter for the constructor, a Vector3D object is created with the elements (0,0,0,0).

Parameters
x:Number (default = 0.) — The first element, such as the x coordinate.
 
y:Number (default = 0.) — The second element, such as the y coordinate.
 
z:Number (default = 0.) — The third element, such as the z coordinate.
 
w:Number (default = 0.) — An optional element for additional data such as the angle of rotation.
Method Detail

add

()method
public function add(a:Vector3D):Vector3D

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Adds the value of the x, y, and z elements of the current Vector3D object to the values of the x, y, and z elements of another Vector3D object. The add() method does not change the current Vector3D object. Instead, it returns a new Vector3D object with the new values.

The result of adding two vectors together is a resultant vector. One way to visualize the result is by drawing a vector from the origin or tail of the first vector to the end or head of the second vector. The resultant vector is the distance between the origin point of the first vector and the end point of the second vector.

Resultant Vector3D

Parameters

a:Vector3D — A Vector3D object to be added to the current Vector3D object.

Returns
Vector3D — A Vector3D object that is the result of adding the current Vector3D object to another Vector3D object.

Related API Elements

angleBetween

()method 
public static function angleBetween(a:Vector3D, b:Vector3D):Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Returns the angle in radians between two vectors. The returned angle is the smallest radian the first Vector3D object rotates until it aligns with the second Vector3D object.

The angleBetween() method is a static method. You can use it directly as a method of the Vector3D class.

To convert a degree to a radian, you can use the following formula:

radian = Math.PI/180 * degree

Parameters

a:Vector3D — The first Vector3D object.
 
b:Vector3D — The second Vector3D object.

Returns
Number — The angle between two Vector3D objects.

clone

()method 
public function clone():Vector3D

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Returns a new Vector3D object that is an exact copy of the current Vector3D object.

Returns
Vector3D — A new Vector3D object that is a copy of the current Vector3D object.

copyFrom

()method 
public function copyFrom(sourceVector3D:Vector3D):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 11, AIR 3.0, Flash Lite 4

Copies all of vector data from the source Vector3D object into the calling Vector3D object.

Parameters

sourceVector3D:Vector3D — The Vector3D object from which to copy the data.

crossProduct

()method 
public function crossProduct(a:Vector3D):Vector3D

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Returns a new Vector3D object that is perpendicular (at a right angle) to the current Vector3D and another Vector3D object. If the returned Vector3D object's coordinates are (0,0,0), then the two Vector3D objects are parallel to each other.

Cross Product

You can use the normalized cross product of two vertices of a polygon surface with the normalized vector of the camera or eye viewpoint to get a dot product. The value of the dot product can identify whether a surface of a three-dimensional object is hidden from the viewpoint.

Parameters

a:Vector3D — A second Vector3D object.

Returns
Vector3D — A new Vector3D object that is perpendicular to the current Vector3D object and the Vector3D object specified as the parameter.

Related API Elements

decrementBy

()method 
public function decrementBy(a:Vector3D):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Decrements the value of the x, y, and z elements of the current Vector3D object by the values of the x, y, and z elements of specified Vector3D object. Unlike the Vector3D.subtract() method, the decrementBy() method changes the current Vector3D object and does not return a new Vector3D object.

Parameters

a:Vector3D — The Vector3D object containing the values to subtract from the current Vector3D object.

Related API Elements

distance

()method 
public static function distance(pt1:Vector3D, pt2:Vector3D):Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Returns the distance between two Vector3D objects. The distance() method is a static method. You can use it directly as a method of the Vector3D class to get the Euclidean distance between two three-dimensional points.

Parameters

pt1:Vector3D — A Vector3D object as the first three-dimensional point.
 
pt2:Vector3D — A Vector3D object as the second three-dimensional point.

Returns
Number — The distance between two Vector3D objects.

dotProduct

()method 
public function dotProduct(a:Vector3D):Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

If the current Vector3D object and the one specified as the parameter are unit vertices, this method returns the cosine of the angle between the two vertices. Unit vertices are vertices that point to the same direction but their length is one. They remove the length of the vector as a factor in the result. You can use the normalize() method to convert a vector to a unit vector.

The dotProduct() method finds the angle between two vertices. It is also used in backface culling or lighting calculations. Backface culling is a procedure for determining which surfaces are hidden from the viewpoint. You can use the normalized vertices from the camera, or eye, viewpoint and the cross product of the vertices of a polygon surface to get the dot product. If the dot product is less than zero, then the surface is facing the camera or the viewer. If the two unit vertices are perpendicular to each other, they are orthogonal and the dot product is zero. If the two vertices are parallel to each other, the dot product is one.

Parameters

a:Vector3D — The second Vector3D object.

Returns
Number — A scalar which is the dot product of the current Vector3D object and the specified Vector3D object.

Related API Elements

equals

()method 
public function equals(toCompare:Vector3D, allFour:Boolean = false):Boolean

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Determines whether two Vector3D objects are equal by comparing the x, y, and z elements of the current Vector3D object with a specified Vector3D object. If the values of these elements are the same, the two Vector3D objects are equal. If the second optional parameter is set to true, all four elements of the Vector3D objects, including the w property, are compared.

Parameters

toCompare:Vector3D — The Vector3D object to be compared with the current Vector3D object.
 
allFour:Boolean (default = false) — An optional parameter that specifies whether the w property of the Vector3D objects is used in the comparison.

Returns
Boolean — A value of true if the specified Vector3D object is equal to the current Vector3D object; false if it is not equal.

Related API Elements

incrementBy

()method 
public function incrementBy(a:Vector3D):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Increments the value of the x, y, and z elements of the current Vector3D object by the values of the x, y, and z elements of a specified Vector3D object. Unlike the Vector3D.add() method, the incrementBy() method changes the current Vector3D object and does not return a new Vector3D object.

Parameters

a:Vector3D — The Vector3D object to be added to the current Vector3D object.

Related API Elements

nearEquals

()method 
public function nearEquals(toCompare:Vector3D, tolerance:Number, allFour:Boolean = false):Boolean

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Compares the elements of the current Vector3D object with the elements of a specified Vector3D object to determine whether they are nearly equal. The two Vector3D objects are nearly equal if the value of all the elements of the two vertices are equal, or the result of the comparison is within the tolerance range. The difference between two elements must be less than the number specified as the tolerance parameter. If the third optional parameter is set to true, all four elements of the Vector3D objects, including the w property, are compared. Otherwise, only the x, y, and z elements are included in the comparison.

Parameters

toCompare:Vector3D — The Vector3D object to be compared with the current Vector3D object.
 
tolerance:Number — A number determining the tolerance factor. If the difference between the values of the Vector3D element specified in the toCompare parameter and the current Vector3D element is less than the tolerance number, the two values are considered nearly equal.
 
allFour:Boolean (default = false) — An optional parameter that specifies whether the w property of the Vector3D objects is used in the comparison.

Returns
Boolean — A value of true if the specified Vector3D object is nearly equal to the current Vector3D object; false if it is not equal.

Related API Elements

negate

()method 
public function negate():void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Sets the current Vector3D object to its inverse. The inverse object is also considered the opposite of the original object. The value of the x, y, and z properties of the current Vector3D object is changed to -x, -y, and -z.

normalize

()method 
public function normalize():Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Converts a Vector3D object to a unit vector by dividing the first three elements (x, y, z) by the length of the vector. Unit vertices are vertices that have a direction but their length is one. They simplify vector calculations by removing length as a factor.

Returns
Number — The length of the current Vector3D object.

project

()method 
public function project():void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Divides the value of the x, y, and z properties of the current Vector3D object by the value of its w property.

If the current Vector3D object is the result of multiplying a Vector3D object by a projection Matrix3D object, the w property can hold the transform value. The project() method then can complete the projection by dividing the elements by the w property. Use the Matrix3D.rawData property to create a projection Matrix3D object.

scaleBy

()method 
public function scaleBy(s:Number):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Scales the current Vector3D object by a scalar, a magnitude. The Vector3D object's x, y, and z elements are multiplied by the scalar number specified in the parameter. For example, if the vector is scaled by ten, the result is a vector that is ten times longer. The scalar can also change the direction of the vector. Multiplying the vector by a negative number reverses its direction.

Parameters

s:Number — A multiplier (scalar) used to scale a Vector3D object.

setTo

()method 
public function setTo(xa:Number, ya:Number, za:Number):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 11, AIR 3.0, Flash Lite 4

Sets the members of Vector3D to the specified values

Parameters

xa:Number — the values to set the vector to.
 
ya:Number
 
za:Number

subtract

()method 
public function subtract(a:Vector3D):Vector3D

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Subtracts the value of the x, y, and z elements of the current Vector3D object from the values of the x, y, and z elements of another Vector3D object. The subtract() method does not change the current Vector3D object. Instead, this method returns a new Vector3D object with the new values.

Parameters

a:Vector3D — The Vector3D object to be subtracted from the current Vector3D object.

Returns
Vector3D — A new Vector3D object that is the difference between the current Vector3D and the specified Vector3D object.

Related API Elements

toString

()method 
public function toString():String

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Returns a string representation of the current Vector3D object. The string contains the values of the x, y, and z properties.

Returns
String — A string containing the values of the x, y, and z properties.
Constant Detail

X_AXIS

Constant
public static const X_AXIS:Vector3D

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The x axis defined as a Vector3D object with coordinates (1,0,0).

Y_AXIS

Constant 
public static const Y_AXIS:Vector3D

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The y axis defined as a Vector3D object with coordinates (0,1,0).

Z_AXIS

Constant 
public static const Z_AXIS:Vector3D

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The z axis defined as a Vector3D object with coordinates (0,0,1).