Holomatix

Log In / Register


Purchase
Vector3d.normalize()

Usage

myVec3d.normalize() : Void

Parameters

None.

Returns

Nothing.

Description

Method; sets the x, y and z properties of myVec3d such that its direction is the same and its length is 1. This is equivalent to

myVec3d.x = myVec3d.x/myVec3d.length();
myVec3d.y = myVec3d.y/myVec3d.length();
myVec3d.z = myVec3d.z/myVec3d.length();

Example

var vec1 = new Vector3d(4, 5, 6);
vec1.normalize();
trace(vec1+" : length "+vec1.length());
                         //displays (0.455842, 0.569803, 0.683763) : length 1
 
< Prev   Next >


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