Python Script Engine  7.2
GL Studio Editor Python Script API
Vector Class Reference
+ Inheritance diagram for Vector:

Public Member Functions

 Vector ()
 
 Vector (float _x, float _y, float _z)
 
 Vector (Vector &w)
 
 ~Vector ()
 
bool operator!= (Vector &arg)
 
Vector operator- (Vector &arg)
 
Vector operator-= (Vector &arg)
 
Vector operator+ (Vector &arg)
 
Vector operator+= (Vector &arg)
 
Vector operator* (float s)
 
Vectoroperator*= (float s)
 
Vector operator/ (float s)
 
Vectoroperator/= (float s)
 
float Distance3 (Vector &v)
 
float Distance3Squared (Vector &v)
 
float DistanceFromLineSquared (float startx, float starty, float startz, Vector &direction)
 
float Distance2Squared (Vector &v)
 
float Distance2 (Vector &v)
 
Vector Rotate (float angle)
 
Vector Rotate (Vector &orig, float angle)
 
Vector Rotate (Vector &orig, float angle, Vector &r)
 
void Normalize (void)
 
float Magnitude ()
 
float MagnitudeSquared ()
 
Vector CrossProduct (Vector &w)
 
float DotProduct (Vector &w)
 
float AngleToVector (Vector &arg)
 
bool PointInTriangle (Vector &a, Vector &b, Vector &c)
 
bool CloseTo (Vector &arg, float tolerance=0.0001f)
 
float DistanceFromLine (Vector &start, Vector &direction)
 
Vector ProjectPointToLine (Vector &origin, Vector &direction)
 

Public Attributes

float x
 
float y
 
float z
 

Detailed Description

GL Studio Vector.

Constructor & Destructor Documentation

Vector::Vector ( )

Default constructor.

Ensures all values are initialized

Vector::Vector ( float  _x,
float  _y,
float  _z 
)
Vector::Vector ( Vector w)
Vector::~Vector ( )

Member Function Documentation

float Vector::AngleToVector ( Vector arg)

Returns the angle (in radians) between this vector and the argument vect.

Parameters
argSecond vector
Returns
The resulting angle (in radians)
bool Vector::CloseTo ( Vector arg,
float  tolerance = 0.0001f 
)

Returns true if this vector is within the radius specified by tolerance.

Parameters
argvector to compare with
tolerancethe tolerance value
Returns
true if this point within the tolerance
Vector Vector::CrossProduct ( Vector w)

Returns the vector cross-product of this vector with the argument vector HS Algebra review: vector cross-product is the vector that is perpendicular to the two given vectors.

Parameters
wSecond vector
Returns
The resulting cross-product (vector)
float Vector::Distance2 ( Vector v)

Compute cartesian distance between this point and another one, in 2D.

Parameters
vThe Vector to compute distance to
Returns
The distance between the two points
float Vector::Distance2Squared ( Vector v)

Compute the square of the cartesian distance between this point and another one, in 2D.

Parameters
vThe vector to compute distance squared to
Returns
The square of the distance between the two points
float Vector::Distance3 ( Vector v)

Compute the square between this point and another one, in 3D.

Parameters
vThe point to compute distance to.
Returns
The distance between the two points
float Vector::Distance3Squared ( Vector v)

Compute cartesian distance between this point and another one, in 3D.

Parameters
vThe point to compute distance to.
Returns
The distance between the two points
float Vector::DistanceFromLine ( Vector start,
Vector direction 
)

Returns the distance of this point from the line defined by start and direction.

Parameters
startStarting point of the line
directionNormalized direction vector for the line
float Vector::DistanceFromLineSquared ( float  startx,
float  starty,
float  startz,
Vector direction 
)

Returns the squared distance of this point from the line defined by start and direction, in 3D.

Parameters
startxstarting x coordinate of the line.
startystarting y coordinate of the line.
startzstarting z coordinate of the line.
directionNormalized direction vector for the line.
Returns
the distance from this point.
float Vector::DotProduct ( Vector w)

Returns the vector dot-product of this vector with the argument vector.

Parameters
wSecond vector
Returns
The resulting dot-product (scalar)
float Vector::Magnitude ( )

Returns the magnitude of the vector.

Returns
The resulting scalar
float Vector::MagnitudeSquared ( )

Returns the magnitude of the vector squared.

Returns
The resulting scalar
void Vector::Normalize ( void  )

Normalizes the vector into a unit vector.

bool Vector::operator!= ( Vector arg)
Vector Vector::operator* ( float  s)
Vector& Vector::operator*= ( float  s)
Vector Vector::operator+ ( Vector arg)
Vector Vector::operator+= ( Vector arg)
Vector Vector::operator- ( Vector arg)
Vector Vector::operator-= ( Vector arg)
Vector Vector::operator/ ( float  s)
Vector& Vector::operator/= ( float  s)
bool Vector::PointInTriangle ( Vector a,
Vector b,
Vector c 
)

Returns true if this vector is in the given triangle specified by abc.

Parameters
aFirst triangle vector
bSecond triangle vector
cThird triangle vector
Returns
true if this point is inside the triangle, false otherwise
Vector Vector::ProjectPointToLine ( Vector origin,
Vector direction 
)

Returns the projection of this point onto the line defined by origin and direction.

Parameters
originStarting point of the line
directionNormalized direction vector for the line
Vector Vector::Rotate ( float  angle)

Rotate this point in 2D clockwise around the z axis.

Parameters
angleThe angle to rotate around, in degrees.
Returns
The rotated vector
Vector Vector::Rotate ( Vector orig,
float  angle 
)

Rotate this point around a different point in 2D counter-clockwise around the z axis.

Parameters
origThe rotation origin to rotate around.
angleThe angle to rotate around, in degrees.
Returns
The rotated vector
Vector Vector::Rotate ( Vector orig,
float  angle,
Vector r 
)

Rotate this vector by angle theta counter-clockwise around an arbitrary axis r.

Parameters
origThe rotation origin to rotate around.
angleThe angle to rotate around, in degrees.
rThe axis to rotate around.
Returns
The rotated vector

Member Data Documentation

float Vector::x
float Vector::y
float Vector::z

The documentation for this class was generated from the following file: