SPAvector
List of: Classes
Subjects: Mathematics
Contents: Base

Purpose: Represents a displacement vector in 3D Cartesian space.

Derivation: SPAvector : -

Filename: base/baseutil/vector/vector.hxx

Description: This class represents a displacement vector in 3D Cartesian space.

References: by BASE SPAtransf

Constructor: public: SPAvector::SPAvector ();


C++ allocation constructor requests memory for this object but does not populate it.






public: SPAvector::SPAvector (


double v[ 3 ] // array of 3 doubles


);


C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.


Creates a SPAvector from an array of three doubles representing the x, y, and z coordinate values.






public: SPAvector::SPAvector (


double x, // x-coordinate


double y, // y-coordinate


double z // z-coordinate


);


C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.


Creates a SPAvector from three doubles representing the x, y, and z coordinate values.






public: SPAvector::SPAvector (


SPAvector const& v // vector


);


C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.






public: void* operator SPAvector::new (


size_t alloc_size // size of requested




// memory block


);


C++ constructor.






public: void* operator SPAvector::new (


size_t alloc_size, // size of requested




// memory block


AcisMemType alloc_type, // eDefault, or




// eSession, or




// eDocument, or




// eTemporary


const char* alloc_file, // name of file in




// which new occurred


int alloc_line, // line of file in




// which new occurred


int* alloc_file_index // must always be




// &alloc_file_index


) ;


New operator for single instances on older compilers where overloading of new and delete are not permitted, and the MMGR_FREELIST compiler flag is given.






public: void* operator new SPAvector::[] (


size_t alloc_size // size of requested




// memory block


);


New operator for arrays of instances on older compilers where overloading of new and delete are not permitted, and the MMGR_FREELIST compiler flag is given.




Destructor: public: void operator SPAvector::delete (


void* alloc_ptr // pointer to memory




// block to delete


);


Delete operator for single instances on older compilers where overloading of new and delete are not permitted, and the MMGR_FREELIST compiler flag is given.






public: void operator delete SPAvector::[] (


void* alloc_ptr // pointer to memory




// block to delete


);


Delete operator for arrays of instances.



Methods: public: double& SPAvector::component (


int i // ith component


);


Extracts the ith component of a vector and allows it to be modified.






public: double SPAvector::component (


int i // ith component


) const;


Accesses the ith component. i must equal 0, 1, or 2.






public: void SPAvector::debug (


FILE* // file pointer



= debug_file_ptr


) const;


Outputs debug information to the screen or to the specified file.






public: void SPAvector::debug_str (


char* str // string


) const;


Concatenates the debug information to the passed string.






public: logical SPAvector::is_zero (


const double tol // zero tolerance



= SPAresabs


) const;


Returns TRUE if a radius function is zero everywhere, to within a given tolerance; otherwise, it returns FALSE.






public: double SPAvector::len () const;


Returns the length of a vector.






public: double SPAvector::len_sq () const;


Returns the square of the length of the vector.






public: SPAvector SPAvector::make_ortho ();


Multiplies a vector by a scalar value.






public: double SPAvector::max_norm (


int& i // max component


) const;


This gets the maximum of the fabs of each component, and which component was the maximum. In case of a "tie" the index i will default to the larger index. For example, for the vector (1,1,1), i = 2.






public: void* operator SPAvector::new [](


size_t alloc_size, // size of requested




// memory block


AcisMemType alloc_type, // eDefault, or




// eSession, or




// eDocument, or




// eTemporary


const char* alloc_file, // name of file in




// which new occurred


int alloc_line, // line of file in




// which new occurred


int* alloc_file_index // must always be




// &alloc_file_index


);


New operator for arrays of instances, with decorations to keep track of the file and line where the new was issued. This version is available only on newer compilers that permit overloading of new and delete, and when the MMGR_ENABLED compiler flag is given.






public: double SPAvector::numerically_stable_len () const;


This method is more expensive than len(), but (theoretically) gives the same value and is stable for very small (those for which v%v would be lost in numerical noise) or very large norms (those for which v%v would give overflow). Not appropriate for general use.






public: SPAvector const& SPAvector::operator*= (


double // scalar value


);


Multiplication of a vector by a scalar.






public: SPAvector const& SPAvector::operator*= (


SPAmatrix const& // 3 x 3 matrix


);


Transforms a vector by a 3 X 3 matrix.






public: SPAvector const& SPAvector::operator*= (


SPAtransf const& // transform


);


Transforms a vector by an affine transformation.






public: SPAvector const& SPAvector::operator+= (


SPAvector const& // vector


);


Adds two vectors.






public: SPAvector const& SPAvector::operator-= (


SPAvector const& // vector


);


Binary minus operation.






public: SPAvector const& SPAvector::operator/ = (


double // scalar value


);


Divides a vector by a scalar value.






public: SPAunit_vector SPAvector::orthogonal () const;


This returns some SPAunit_vector which is orthogonal to the given one. If the given vector is less than SPAresmch in length, it returns the unit vector (0,0,1).






public: void SPAvector::set_component (


int i, // ith component


double new_c // new value


);


Sets the value of ith component of a vector.






public: void SPAvector::set_x (


double new_x // x-coordinate


);


Sets the x-coordinate of a vector.






public: void SPAvector::set_y (


double new_y // y-coordinate


);


Sets the y-coordinate of a vector.






public: void SPAvector::set_z (


double new_z // z-coordinate


);


Sets the z-coordinate of a vector.






public: double& SPAvector::x ();


Extracts the x-component of a vector for an update and allows it to be modified.






public: double SPAvector::x () const;


Extracts the x-component of a vector in 3D Cartesian space.






public: double& SPAvector::y ();


Extracts the y-component of a vector for an update and allows it to be modified.






public: double SPAvector::y () const;


Extracts the y-component of a vector.






public: double& SPAvector::z ();


Extracts the z-component of a vector for an update and allows it to be modified.






public: double SPAvector::z () const;


Extracts the z-component of a vector.




Related Fncs: antiparallel, biparallel, normalise, parallel, perpendicular, same_vector






friend: double operator% (


SPAposition const&, // position


SPAvector const& // vector


);


Scalar product of a position and a vector.






friend: double operator% (


SPAvector const&, // vector


SPAposition const& // position


);


Scalar product of a position and a vector.






friend: double operator% (


SPAvector const&, // first vector


SPAvector const& // second vector


);


Scalar product of two vectors.






friend: SPAvector operator* (


double, // scalar value


SPAvector const& // vector


);


Multiplies a vector by a scalar value.






friend: SPAvector operator* (


SPAmatrix const&, // 3 x 3 matrix


SPAvector const& // vector


);


Transforms a vector by a 3 X 3 matrix.






friend: SPAvector operator* (


SPAvector const&, // vector


double // scalar value


);


Multiplies a vector by a scalar value.






friend: SPAvector operator* (


SPAvector const&, // vector


SPAmatrix const& // 3 x 3 matrix


);


Transforms a vector by a 3 X 3 matrix.






friend: SPAvector operator* (


SPAvector const&, // vector


SPAtransf const& // transform


);


Transforms a vector by an affine transformation.






friend: SPAvector operator* (


SPAvector const&, // vector


SPAtransf const* // transform


);


Transforms a vector by an affine transformation.






friend: SPAvector operator* (


SPAvector const&, // vector


SPAvector const& // vector


);


Cross product of two vectors. Also applies to unit vectors.






friend: SPAvector operator+ (


SPAvector const&, // first vector


SPAvector const& // second vector


);


Addition of two vectors.






friend: SPAvector operator- (


SPAvector const& // vector


);


Unary minus operation.






friend: SPAvector operator- (


SPAvector const&, // first vector


SPAvector const& // second vector


);


Binary minus operation.






friend: SPAvector operator/ (


SPAvector const&, // vector


double // scalar value


);


Division of a vector by a scalar.
PDF/BASE/03CL.PDF
HTM/DATA/BASE/BASE/03CL/0027.HTM