Holomatix

Log In / Register


Purchase
Vector3d class

Description

The Vector3d class lets you manipulate three dimensional vectors. A 3d vector is a triplet of numbers that can be imagined to be coordinates or displacements along the x, y, z axes of 3d space.

Method summary for the Vector3d class

Method

Description

Vector3d.add()Adds a 3d vector to a Vector3d.
Vector3d.cross()Returns the cross product of a Vector3d with another Vector3d.
Vector3d.dot()Returns the dot product of a Vector3d with another Vector3d.
Vector3d.length()Returns the Euclidean length of a Vector3d.
Vector3d.normalize()Sets the x, y, z properties of a Vector3d so that its length is 1.
Vector3d.subtract()Subtracts a 3d vector from a Vector3d.

 

 

 

 

 

Property summary for the Vector3d class

PropertyDescription
Vector3d.xThe coordinate or displacement along the x-axis of 3d space.
Vector3d.yThe coordinate or displacement along the y-axis of 3d space.
Vector3d.zThe coordinate or displacement along the z-axis of 3d space.

 

 

 

Constructor for the Vector3d class

Usage

new Vector3d(x:Number, y:Number, z:Number) : Vector3d
new Vector3d([vec3d:Vector3d]) : Vector3d

Parameters

  • x A number to be assigned to the Vector3d.x property.
  • y A number to be assigned to the Vector3d.y property.
  • z A number to be assigned to the Vector3d.z property.
  • vec3d An optional Vector3d that will be copied into a new Vector3d. Defaults to the zero vector.

Returns

A reference to a Vector3d object.

Description

Constructor; constructs a new Vector3d object from the specified parameters.

Example

var newVec = new Vector3d(1, 2, 3);
trace(newVec); //displays (1, 2, 3); 
 
< Prev   Next >


© Copyright 2000-2011 Holomatix Ltd. All rights reserved.