GL Studio C++ Runtime API
Vertex Class Reference

#include <vertex.h>

Inheritance diagram for Vertex:
VertexNoColor

Public Member Functions

 Vertex ()
 Simple constructor. Ensures all values are initialized.
 
 Vertex (const VertexNoColor &noColor)
 
 Vertex (const VertexNoColor &noColor, const GlsColor &_color)
 
 Vertex (float _x, float _y, float _z)
 
 Vertex (float _x, float _y, float _z, unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a)
 
 Vertex (float _x, float _y, float _z, const GlsColor &_color)
 
Vertex operator+ (const VertexNoColor &arg) const
 
Vertex operator* (const float s) const
 
Vertex Rotate (const float angle) const
 
Vertex Rotate (const VertexNoColor &orig, const float angle) const
 
Vertex Rotate (const VertexNoColor &orig, const float angle, const int axis) const
 
Vertex Rotate (const VertexNoColor &orig, const float theta, const Vector &r) const
 
Vertex operator- (const VertexNoColor &arg) const
 
Vertex operator- () const
 
Vertex operator* (const VertexNoColor &arg) const
 
Vertex CrossProduct (const VertexNoColor &w) const
 
- Public Member Functions inherited from VertexNoColor
 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
 
VertexNoColoroperator*= (const float s)
 
VertexNoColor operator/ (const float s) const
 
VertexNoColoroperator/= (const float s)
 
VertexNoColoroperator+= (const VertexNoColor &arg)
 
VertexNoColor operator- (const VertexNoColor &arg) const
 
VertexNoColoroperator-= (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

GlsColor color
 The RGBA color component.
 
- Public Attributes inherited from VertexNoColor
float x
 The X component.
 
float y
 The Y component.
 
float z
 The Z component.
 

Detailed Description

A 3D coordinate in space with an RGBA color value

Constructor & Destructor Documentation

◆ Vertex() [1/5]

Vertex ( const VertexNoColor noColor)
inline

Constructor, from VertexNoColor.

Parameters
noColorThe object to copy from.

◆ Vertex() [2/5]

Vertex ( const VertexNoColor noColor,
const GlsColor _color 
)
inline

Constructor, from VertexNoColor and a GlsColor.

Parameters
noColorThe object to copy from.
_colorThe color to use.

◆ Vertex() [3/5]

Vertex ( float  _x,
float  _y,
float  _z 
)
inline

Position only constructor. Color values are set to defaults

Parameters
_xThe X value of the vertex, in logical units
_yThe Y value of the vertex, in logical units
_zThe Z value of the vertex, in logical units

◆ Vertex() [4/5]

Vertex ( float  _x,
float  _y,
float  _z,
unsigned char  _r,
unsigned char  _g,
unsigned char  _b,
unsigned char  _a 
)
inline

Position only constructor. Color values are set to defaults

Parameters
_xThe X value of the vertex, in logical units
_yThe Y value of the vertex, in logical units
_zThe Z value of the vertex, in logical units
_rThe R value of the color of the vertex 0-255
_gThe G value of the color of the vertex 0-255
_bThe B value of the color of the vertex 0-255
_aThe A value of the color of the vertex 0-255

◆ Vertex() [5/5]

Vertex ( float  _x,
float  _y,
float  _z,
const GlsColor _color 
)
inline

Position only constructor. Color values are set to defaults

Parameters
_xThe X value of the vertex, in logical units
_yThe Y value of the vertex, in logical units
_zThe Z value of the vertex, in logical units
_colorThe value of the color of the vertex

Member Function Documentation

◆ CrossProduct()

Vertex 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
wSecond vector
Returns
The resulting cross-product (vector)

◆ operator*() [1/2]

Vertex operator* ( const float  s) const
inline

Compute the result of multiplying this point by a scalar

Parameters
sThe Scalar to multiply by
Returns
A new vertex V2 where V2 = this * s

◆ operator*() [2/2]

Vertex operator* ( const VertexNoColor arg) const
inline

Computes the result of muliplying this point to another one.

Parameters
argvertex to multiple with
Returns
resulting vertex

◆ operator+()

Vertex operator+ ( const VertexNoColor arg) const
inline

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

Parameters
argThe vertex to add to this one
Returns
A new vertex V2 where V2 = this + v

◆ operator-() [1/2]

Vertex operator- ( ) const
inline

Negation operator.

Returns
The negated vertex, all items multiplied by -1.

◆ operator-() [2/2]

Vertex operator- ( const VertexNoColor arg) const
inline

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

Parameters
argThe vertex to subtract from this one
Returns
A new vertex V2 where V2 = this - v

◆ Rotate() [1/4]

Vertex Rotate ( const float  angle) const

Rotate this point in 2D around the z axis

Parameters
angleThe angle to rotate around, in degrees.
Returns
The rotated vertex

◆ Rotate() [2/4]

Vertex Rotate ( const VertexNoColor orig,
const float  angle 
) const

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

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

◆ Rotate() [3/4]

Vertex Rotate ( const VertexNoColor orig,
const float  angle,
const int  axis 
) const

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

Parameters
origThe rotation origin to rotate around.
angleThe angle to rotate around, in degrees.
axisThe axis to rotate 180 degrees around. x = 1, y = 2, z = 3.
Returns
The rotated vertex.

◆ Rotate() [4/4]

Vertex Rotate ( const VertexNoColor orig,
const float  theta,
const Vector r 
) const

Rotate this vertex by angle theta around an arbitrary axis r. Positive angles are anticlockwise looking down the axis towards the origin.

Parameters
origThe rotation origin to rotate around.
thetaThe angle to rotate by, in degrees.
rThe arbitrary axis to rotate around.
Returns
The rotated point.

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