| Python Script Engine 8.3 GL Studio Editor Python Script API

Public Member Functions | Public Attributes | List of all members
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)
Vector & | operator*= (float s)
Vector | operator/ (float s)
Vector & | operator/= (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 ()
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() [1/3]

Vector::Vector | ( |  | ) |

Default constructor.

Ensures all values are initialized

## ◆ Vector() [2/3]

Vector::Vector | ( | float | _x,
|  | float | _y,
|  | float | _z
| ) |  |

## ◆ Vector() [3/3]

Vector::Vector | ( | Vector & | w | ) |

## ◆ ~Vector()

Vector::~Vector | ( |  | ) |

## Member Function Documentation

## ◆ AngleToVector()

float Vector::AngleToVector | ( | Vector & | arg | ) |

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

Parameters

  arg | Second vector

Returns
  The resulting angle (in radians)

## ◆ CloseTo()

bool Vector::CloseTo | ( | Vector & | arg,
|  | float | tolerance = `0.0001f`
| ) |  |

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

Parameters

  arg | vector to compare with
  tolerance | the tolerance value

Returns
  true if this point within the tolerance

## ◆ CrossProduct()

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

  w | Second vector

Returns
  The resulting cross-product (vector)

## ◆ Distance2()

float Vector::Distance2 | ( | Vector & | v | ) |

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

Parameters

  v | The Vector to compute distance to

Returns
  The distance between the two points

## ◆ Distance2Squared()

float Vector::Distance2Squared | ( | Vector & | v | ) |

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

Parameters

  v | The vector to compute distance squared to

Returns
  The square of the distance between the two points

## ◆ Distance3()

float Vector::Distance3 | ( | Vector & | v | ) |

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

Parameters

  v | The point to compute distance to.

Returns
  The distance between the two points

## ◆ Distance3Squared()

float Vector::Distance3Squared | ( | Vector & | v | ) |

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

Parameters

  v | The point to compute distance to.

Returns
  The distance between the two points

## ◆ DistanceFromLine()

float Vector::DistanceFromLine | ( | Vector & | start,
|  | Vector & | direction
| ) |  |

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

Parameters

  start | Starting point of the line
  direction | Normalized direction vector for the line

## ◆ DistanceFromLineSquared()

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

  startx | starting x coordinate of the line.
  starty | starting y coordinate of the line.
  startz | starting z coordinate of the line.
  direction | Normalized direction vector for the line.

Returns
  the distance from this point.

## ◆ DotProduct()

float Vector::DotProduct | ( | Vector & | w | ) |

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

Parameters

  w | Second vector

Returns
  The resulting dot-product (scalar)

## ◆ Magnitude()

float Vector::Magnitude | ( |  | ) |

Returns the magnitude of the vector.

Returns
  The resulting scalar

## ◆ MagnitudeSquared()

float Vector::MagnitudeSquared | ( |  | ) |

Returns the magnitude of the vector squared.

Returns
  The resulting scalar

## ◆ Normalize()

void Vector::Normalize | ( |  | ) |

Normalizes the vector into a unit vector.

## ◆ operator!=()

bool Vector::operator!= | ( | Vector & | arg | ) |

## ◆ operator*()

Vector Vector::operator* | ( | float | s | ) |

## ◆ operator*=()

Vector & Vector::operator*= | ( | float | s | ) |

## ◆ operator+()

Vector Vector::operator+ | ( | Vector & | arg | ) |

## ◆ operator+=()

Vector Vector::operator+= | ( | Vector & | arg | ) |

## ◆ operator-()

Vector Vector::operator- | ( | Vector & | arg | ) |

## ◆ operator-=()

Vector Vector::operator-= | ( | Vector & | arg | ) |

## ◆ operator/()

Vector Vector::operator/ | ( | float | s | ) |

## ◆ operator/=()

Vector & Vector::operator/= | ( | float | s | ) |

## ◆ PointInTriangle()

bool Vector::PointInTriangle | ( | Vector & | a,
|  | Vector & | b,
|  | Vector & | c
| ) |  |

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

Parameters

  a | First triangle vector
  b | Second triangle vector
  c | Third triangle vector

Returns
  true if this point is inside the triangle, false otherwise

## ◆ ProjectPointToLine()

Vector Vector::ProjectPointToLine | ( | Vector & | origin,
|  | Vector & | direction
| ) |  |

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

Parameters

  origin | Starting point of the line
  direction | Normalized direction vector for the line

## ◆ Rotate() [1/3]

Vector Vector::Rotate | ( | float | angle | ) |

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

Parameters

  angle | The angle to rotate around, in degrees.

Returns
  The rotated vector

## ◆ Rotate() [2/3]

Vector Vector::Rotate | ( | Vector & | orig,
|  | float | angle
| ) |  |

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

Parameters

  orig | The rotation origin to rotate around.
  angle | The angle to rotate around, in degrees.

Returns
  The rotated vector

## ◆ Rotate() [3/3]

Vector Vector::Rotate | ( | Vector & | orig,
|  | float | angle,
|  | Vector & | r
| ) |  |

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

Parameters

  orig | The rotation origin to rotate around.
  angle | The angle to rotate around, in degrees.
  r | The axis to rotate around.

Returns
  The rotated vector

## Member Data Documentation

## ◆ x

float Vector::x

## ◆ y

float Vector::y

## ◆ z

float Vector::z

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

- Vector.i