| GL Studio C++ Runtime API

Public Member Functions | Public Attributes | List of all members
VertexNoColor Class Reference

`#include <vertex.h>`

Inheritance diagram for VertexNoColor:

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

## Public Attributes
float | x
| The X component.
float | y
| The Y component.
float | z
| The Z component.

## Detailed Description

The Vertex class: Implements a 3D cartesian coordianate and operations for manipulating them.

## Constructor & Destructor Documentation

## ◆ VertexNoColor() [1/2]

VertexNoColor | ( |  | ) |
| inline

Simple constructor. Ensures all values are initialized

## ◆ VertexNoColor() [2/2]

VertexNoColor | ( | float | _x,
|  | float | _y,
|  | float | _z
| ) |  |
| inline

Position only constructor. Color values are set to defaults

Parameters

  _x | The X value of the vertex, in logical units
  _y | The Y value of the vertex, in logical units
  _z | The Z value of the vertex, in logical units

## Member Function Documentation

## ◆ AngleToVector()

float AngleToVector | ( | const VertexNoColor & | arg | ) | const

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

Parameters

  arg | Second vector

Returns
  The resulting angle (in radians)

## ◆ CloseTo()

bool CloseTo | ( | const VertexNoColor & | arg,
|  | float | tolerance = `0.0001f`
| ) |  | const

Returns true if this vertex is within the radius specified by tolerance

Parameters

  arg | vertex to compare with
  tolerance | the tolerance value

Returns
  true if this point within the tolerance

## ◆ CrossProduct()

VertexNoColor CrossProduct | ( | const VertexNoColor & | w | ) | const
| inline

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 Distance2 | ( | const VertexNoColor & | v | ) | const
| inline

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

Parameters

  v | The vertex to compute distance to

Returns
  The distance between the two points

## ◆ Distance2Squared()

float Distance2Squared | ( | const VertexNoColor & | v | ) | const
| inline

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

Parameters

  v | The vertex to compute distance squared to

Returns
  The square of the distance between the two points

## ◆ Distance3()

float Distance3 | ( | const VertexNoColor & | v | ) | const
| inline

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

Parameters

  v | The vertex to compute distance to.

Returns
  The distance between the two points

## ◆ Distance3Squared()

float Distance3Squared | ( | const VertexNoColor & | v | ) | const
| inline

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

Parameters

  v | The vertex to compute distance squared to

Returns
  The square of the distance between the two points

## ◆ DistanceFromLine()

float DistanceFromLine | ( | const VertexNoColor & | start,
|  | const VertexNoColor & | direction
| ) |  | const

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 DistanceFromLineSquared | ( | const float | startx,
|  | const float | starty,
|  | const float | startz,
|  | const VertexNoColor & | direction
| ) |  | const
| inline

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 DotProduct | ( | const VertexNoColor & | w | ) | const
| inline

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

Parameters

  w | Second vector

Returns
  The resulting dot-product (scalar)

## ◆ Magnitude()

float Magnitude | ( |  | ) | const
| inline

Returns the magnitude of the vector

Returns
  The resulting scalar

## ◆ MagnitudeSquared()

float MagnitudeSquared | ( |  | ) | const
| inline

Returns the magnitude of the vector squared

Returns
  The resulting scalar

## ◆ Normalize()

void Normalize | ( |  | ) |
| inline

Normalizes the vector into a unit vector

## ◆ operator!=()

bool operator!= | ( | const VertexNoColor & | arg | ) | const
| inline

Determines if the vertex is identical to the supplied vertex, ignoring color

Parameters

  arg | vertex to compare to

Returns
  TRUE if equal, else FALSE

## ◆ operator*() [1/2]

VertexNoColor operator* | ( | const float | s | ) | const
| inline

Compute the result of multiplying this point by a scalar

Parameters

  s | The Scalar to multiply by

Returns
  A new vertex V2 where V2 = this * s

## ◆ operator*() [2/2]

VertexNoColor operator* | ( | const VertexNoColor & | arg | ) | const
| inline

Computes the result of muliplying this point to another one.

Parameters

  arg | vertex to multiple with

Returns
  resulting vertex

## ◆ operator*=()

VertexNoColor & operator*= | ( | const float | s | ) |
| inline

Compute the result of multiplying this point by a scalar

Parameters

  s | The Scalar to multiply by

Returns
  V = V * s

## ◆ operator+()

VertexNoColor operator+ | ( | const VertexNoColor & | arg | ) | const
| inline

Compute the result of adding this point to another one, in 3D

Parameters

  arg | The vertex to add to this one

Returns
  A new vertex V2 where V2 = this + v

## ◆ operator+=()

VertexNoColor & operator+= | ( | const VertexNoColor & | arg | ) |
| inline

Compute the result of adding this point to another one, in 3D

Parameters

  arg | The vertex to add to this one

Returns
  V = V + arg

## ◆ operator-() [1/2]

VertexNoColor operator- | ( |  | ) | const
| inline

Negation operator.

Returns
  The negated object, all members multiplied by -1.

## ◆ operator-() [2/2]

VertexNoColor operator- | ( | const VertexNoColor & | arg | ) | const
| inline

Compute the result of subtracting this point from another one, in 3D

Parameters

  arg | The vertex to subtract from this one

Returns
  A new vertex V2 where V2 = this - v

## ◆ operator-=()

VertexNoColor & operator-= | ( | const VertexNoColor & | arg | ) |
| inline

Compute the result of subtracting this point from another one, in 3D

Parameters

  arg | The vertex to subtract from this one

Returns
  V = V - arg

## ◆ operator/()

VertexNoColor operator/ | ( | const float | s | ) | const
| inline

Compute the result of dividing this point by a scalar

Parameters

  s | The Scalar to divide by

Returns
  A new vertex V2 where V2 = this / s

## ◆ operator/=()

VertexNoColor & operator/= | ( | const float | s | ) |
| inline

Compute the result of dividing this point by a scalar

Parameters

  s | The Scalar to divide by

Returns
  V = V / s

## ◆ operator==()

bool operator== | ( | const VertexNoColor & | arg | ) | const
| inline

Determines if the vertex is identical to the supplied vertex, ignoring color

Parameters

  arg | vertex to compare to

Returns
  TRUE if equal, else FALSE

## ◆ PointInTriangle()

bool PointInTriangle | ( | const VertexNoColor & | a,
|  | const VertexNoColor & | b,
|  | const VertexNoColor & | c
| ) |  | const
| inline

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

Parameters

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

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

## ◆ ProjectPointToLine()

VertexNoColor ProjectPointToLine | ( | const VertexNoColor & | origin,
|  | const VertexNoColor & | direction
| ) |  | const

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/4]

VertexNoColor Rotate | ( | const float | angle | ) | const

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

Parameters

  angle | The angle to rotate around, in degrees.

Returns
  The rotated vertex

## ◆ Rotate() [2/4]

VertexNoColor Rotate | ( | const VertexNoColor & | orig,
|  | const float | angle
| ) |  | const

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 vertex

## ◆ Rotate() [3/4]

VertexNoColor Rotate | ( | const VertexNoColor & | orig,
|  | const float | angle,
|  | const int | axis
| ) |  | const

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

Parameters

  orig | The rotation origin to rotate around.
  angle | The angle to rotate around, in degrees.
  axis | The axis to rotate around. See RotationAxis enum.

Returns
  The rotated vertex

## ◆ Rotate() [4/4]

VertexNoColor Rotate | ( | const VertexNoColor & | orig,
|  | const float | angle,
|  | const Vector & | r
| ) |  | const

Rotate this vertex 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 vertex

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

- vertex.h