Common data types, including points, rectangles and colors.
More...
#include <algorithm>
#include <cmath>
#include <cstdint>
Go to the source code of this file.
|
typedef Point2D | sc2::Vector2D |
|
typedef Point3D | sc2::Vector3D |
|
|
Point3D | sc2::operator+ (const Point3D &lhs, const Point3D &rhs) |
|
Point3D | sc2::operator- (const Point3D &lhs, const Point3D &rhs) |
|
Point3D | sc2::operator* (const Point3D &lhs, float rhs) |
|
Point3D | sc2::operator* (float lhs, const Point3D &rhs) |
|
Point3D | sc2::operator/ (const Point3D &lhs, float rhs) |
|
Point3D | sc2::operator/ (float lhs, const Point3D &rhs) |
|
Point2D | sc2::operator+ (const Point2D &lhs, const Point2D &rhs) |
|
Point2D | sc2::operator- (const Point2D &lhs, const Point2D &rhs) |
|
Point2D | sc2::operator* (const Point2D &lhs, float rhs) |
|
Point2D | sc2::operator* (float lhs, const Point2D &rhs) |
|
Point2D | sc2::operator/ (const Point2D &lhs, float rhs) |
|
Point2D | sc2::operator/ (float lhs, const Point2D &rhs) |
|
float | sc2::GetRandomScalar () |
|
float | sc2::GetRandomFraction () |
|
int | sc2::GetRandomInteger (int min, int max) |
|
template<typename Container > |
Container::value_type & | sc2::GetRandomEntry (Container &container) |
|
float | sc2::Distance2D (const Point2D &a, const Point2D &b) |
|
float | sc2::DistanceSquared2D (const Point2D &a, const Point2D &b) |
|
void | sc2::Normalize2D (Point2D &a) |
|
float | sc2::Dot2D (const Point2D &a, const Point2D &b) |
|
float | sc2::Distance3D (const Point3D &a, const Point3D &b) |
|
float | sc2::DistanceSquared3D (const Point3D &a, const Point3D &b) |
|
void | sc2::Normalize3D (Point3D &a) |
|
float | sc2::Dot3D (const Point3D &a, const Point3D &b) |
|
Common data types, including points, rectangles and colors.
The distance between two 2D points.
- Parameters
-
a | First point. |
b | Second point. |
- Returns
- Distance.
The distance between two 3D points.
- Parameters
-
a | First point. |
b | Second point. |
- Returns
- Distance.
The distance squared between two 2D points, faster than Distance2D.
- Parameters
-
a | First point. |
b | Second point. |
- Returns
- Distance^2.
The distance squared between two 3D points, faster than Distance3D.
- Parameters
-
a | First point. |
b | Second point. |
- Returns
- Distance^2.
The dot product of two 2D vectors.
- Parameters
-
a | First vector. |
b | Second vector. |
- Returns
- Dot product.
The dot product of two 3D vectors.
- Parameters
-
a | First vector. |
b | Second vector. |
- Returns
- Dot product.
template<typename Container >
Container::value_type& sc2::GetRandomEntry |
( |
Container & |
container | ) |
|
Gets a random entry from the container.
- Parameters
-
container | Array, list or whatever container. |
- Returns
- A random entry.
float sc2::GetRandomFraction |
( |
| ) |
|
Gets a random floating-point number between 0.0 and 1.0.
- Returns
- Random floating-point number between 0.0 and 1.0.
int sc2::GetRandomInteger |
( |
int |
min, |
|
|
int |
max |
|
) |
| |
Gets a random integer between min and max inclusive.
- Parameters
-
min | Smallest value a random number could be. |
max | Largest value a random number could be. |
- Returns
- Random integer between min and max.
float sc2::GetRandomScalar |
( |
| ) |
|
Gets a random floating-point number between -1.0 and 1.0.
- Returns
- Random floating-point number between -1.0 and 1.0.
void sc2::Normalize2D |
( |
Point2D & |
a | ) |
|
Normalize a 2D point.
- Parameters
-
void sc2::Normalize3D |
( |
Point3D & |
a | ) |
|
Normalize a 3D point.
- Parameters
-