com.altair.hwm.beans.utils
Class HWMVector

java.lang.Object
  extended by com.altair.hwm.beans.utils.HWMVector
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class HWMVector
extends java.lang.Object
implements java.io.Externalizable

Title: HWMVector

Description: This is a utility class that will perform Vector functions. A vector is the math entity denoted as ai + bj +ck , where a, b and c are the i,j and k components of the vector

Company: Altair Engineering, Inc.

See Also:
Serialized Form

Constructor Summary
HWMVector()
          Constructor
HWMVector(double dIComp, double dJComp, double dKComp)
          Constructor -- creates a vector with the specified coefficients for the i,j and k components
HWMVector(HWMPoint hwmPoint)
          Constructor -- creates the position vector for the specifeid point in space
HWMVector(HWMPoint hwmPoint1, HWMPoint hwmPoint2)
          Constructor -- creates the vector between the specifeid two points in space
 
Method Summary
 HWMVector Add(HWMVector hwmVector)
          Add this vector to another vector
 double[] GetComponents()
          Get the components of the vector
 HWMVector GetCrossProduct(HWMVector hwmVector)
          Get the cross product between this vector and another vector
 double GetDotProduct(HWMVector hwmVector)
          Get the dot product between this vector and another vector
 double GetMagnitude()
          Get the magnitude of the vector
 HWMVector GetUnitVector()
          Create a unit vector along the same direction represented by this vector.
 void Normalize()
          Normalize this vector, so that the magnitude of the vector becomes unit In other words, this vector gets converted into a unit vector
 void readExternal(java.io.ObjectInput objInput)
          Loads the version and then calls the appropriate read function for the version
 HWMVector Scale(double dFactor)
          Scale the vector by a scalar quantity
 void SetComponents(double[] arrdComponents)
          Set the components of the vector
 HWMVector Subtract(HWMVector hwmVector)
          Subtract a second vector from this vector
 void writeExternal(java.io.ObjectOutput objOutput)
          Save the persistent properties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HWMVector

public HWMVector()
Constructor


HWMVector

public HWMVector(double dIComp,
                 double dJComp,
                 double dKComp)
Constructor -- creates a vector with the specified coefficients for the i,j and k components

Parameters:
dIComp - The i-component of the vector
dJComp - The j-component of the vector
dKComp - The k-component of the vector

HWMVector

public HWMVector(HWMPoint hwmPoint)
Constructor -- creates the position vector for the specifeid point in space

Parameters:
hwmPoint - The point whose position vector will be created

HWMVector

public HWMVector(HWMPoint hwmPoint1,
                 HWMPoint hwmPoint2)
Constructor -- creates the vector between the specifeid two points in space

Parameters:
The - two points used in creating the vector
Method Detail

SetComponents

public void SetComponents(double[] arrdComponents)
                   throws java.lang.ArrayIndexOutOfBoundsException
Set the components of the vector

Parameters:
arrdComponents - The i,j,k components of the vector
Throws:
java.lang.ArrayIndexOutOfBoundsException

GetComponents

public double[] GetComponents()
Get the components of the vector

Returns:
double[3] The i,j,k components of the vector

GetMagnitude

public double GetMagnitude()
Get the magnitude of the vector

Returns:
double The magnitude of the vector

Normalize

public void Normalize()
Normalize this vector, so that the magnitude of the vector becomes unit In other words, this vector gets converted into a unit vector


GetUnitVector

public HWMVector GetUnitVector()
Create a unit vector along the same direction represented by this vector.

Returns:
HWMVector The unit vector that represents this vector

GetDotProduct

public double GetDotProduct(HWMVector hwmVector)
Get the dot product between this vector and another vector

Parameters:
hwmVector - The vector with which to evaluate the dot product
Returns:
double The dot product

GetCrossProduct

public HWMVector GetCrossProduct(HWMVector hwmVector)
Get the cross product between this vector and another vector

Parameters:
hwmVector - The vector with which to evaluate the cross product
Returns:
HWMVector The cross product between the two vectors

Add

public HWMVector Add(HWMVector hwmVector)
Add this vector to another vector

Parameters:
hwmVector - The vector with which to add
Returns:
HWMVector The sum of the two vectors

Subtract

public HWMVector Subtract(HWMVector hwmVector)
Subtract a second vector from this vector

Parameters:
hwmVector - The vector to subtract
Returns:
HWMVector The difference between the two vectors

Scale

public HWMVector Scale(double dFactor)
Scale the vector by a scalar quantity

Parameters:
dFactor - The factor to scale the vector by
Returns:
HWMVector The scaled vector

writeExternal

public void writeExternal(java.io.ObjectOutput objOutput)
                   throws java.io.IOException
Save the persistent properties

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
objOutput - The stream to which data will be written
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput objInput)
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException
Loads the version and then calls the appropriate read function for the version

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
objInput - The stream from which data will be read
Throws:
IOException, - ClassNotFoundException
java.lang.ClassNotFoundException
java.io.IOException