|
UGDK
0.4.1
|
#include <ugdk/math/integer2D.h>
Public Member Functions | |
| Integer2D () | |
| Initializes both fields with 0. | |
| Integer2D (int val) | |
| Initializes both fields with val. | |
| Integer2D (int _x, int _y) | |
| Initializes both fields with given values. | |
| Integer2D (const ugdk::Vector2D &vec2d) | |
| Copy constructor from Vector2D. | |
| ~Integer2D () | |
| int | get_x () const |
| int | get_y () const |
| void | set_x (int x_) |
| void | set_y (int y_) |
| int | NormOne () const |
| Returns the norm-1 of this integer. | |
| double | Length () const |
| Returns the norm-2 of this integer. | |
| double | LengthSquared () const |
| Returns the norm-2 squared. | |
| double | Angle () const |
| Returns the angle (in radians) of this integer. | |
| void | Rotate (RotDeg rotdeg) |
| Returns a new integer equal to this integer rotated by "angle" (in radians) counter-clockwise. | |
| void | Rotate (RotDeg rotdeg, const Integer2D ¢er) |
| Returns a new integer equal to this integer rotated by "angle" (in radians) counter-clockwise. | |
| Integer2D | Rotated (RotDeg rotdeg) const |
| Returns a new integer equal to this integer rotated by "angle" (in radians) counter-clockwise. | |
| Integer2D | Rotated (RotDeg rotdeg, const Integer2D ¢er) const |
| Returns a new integer equal to this integer rotated by "angle" (in radians) counter-clockwise. | |
| void | Mirror (const ugdk::enums::mirroraxis::MirrorAxis mirror) |
| Mirrors this Integer2D (in-place) by the "axis" axis. Include types.h and use "using namespace ugdk::enums". | |
| Integer2D | Mirrored (const ugdk::enums::mirroraxis::MirrorAxis mirror) const |
| Returns a new Integer2D, mirrored by the "axis" axis. Include types.h and use "using namespace ugdk::enums". | |
| void | Multiply (const Integer2D &multiplier) |
| In-place integer multiplication, coordinate by coordinate. | |
| Integer2D | Multiplied (const Integer2D &multiplier) const |
| Returns a new Integer2D equal to this multiplied coordinate by coordinate by "multiplier". | |
| void | Divide (const Integer2D ÷r) |
| In-place integer division, coordinate by coordinate. | |
| Integer2D | Divided (const Integer2D ÷r) const |
| Returns a new Integer2D equal to this divided coordinate by coordinate by "multiplier". | |
| void | Scale (const Integer2D &multiplier, const Integer2D &divisor) |
| Multiplies in-place by "multiplier", and then divides by "divisor". | |
| Integer2D | Scaled (const Integer2D &multiplier, const Integer2D &divisor) const |
| Returns a new Integer2D, multiplied by "multiplier", and divided by "divisor". | |
| void | Mod (const Integer2D &divisor) |
| In-place remainder (coordinate by coordinate) of integer division by "divisor". | |
| Integer2D | Remainder (const Integer2D &divisor) const |
| Returns a new Integer2D that is equal to the remainder of the integer division by "divisor". | |
| Integer2D & | operator+= (const Integer2D &other) |
| Integer2D & | operator-= (const Integer2D &other) |
| Integer2D & | operator*= (int scalar) |
| Integer2D & | operator/= (int scalar) |
| Integer2D & | operator%= (int scalar) |
| Integer2D | operator+ (const Integer2D &right) const |
| Method that returns a integer equal to the sum of two others. | |
| Integer2D | operator- () const |
| Method that returns a integer equal to the oposite of another. | |
| Integer2D | operator- (const Integer2D &right) const |
| Method that returns a integer equal to the subtraction of two others. | |
| Integer2D | operator* (int scalar) const |
| Method that returns a integer equal to the a integer multiplied by a scalar. | |
| Integer2D | operator/ (int scalar) const |
| Method that returns a integer equal to the a integer multiplied by the inverse of a scalar. | |
| Integer2D | operator% (int scalar) const |
| Remainder of integer division by "scalar" in each coordinate. | |
| int | operator* (const Integer2D &right) const |
| Method that returns a scalar equal to the inner product of two vectors. | |
| Integer2D | operator% (const Integer2D &right) const |
| Remainder of integer division by "scalar" coordinate by coordinate. | |
Public Attributes | |
| union { | |
| struct { | |
| int x | |
| int y | |
| } | |
| struct { | |
| int val [2] | |
| } | |
| }; | |
|
inline |
Initializes both fields with 0.
Create the integer (x,y) with x = 0 and y =0
|
inlineexplicit |
Initializes both fields with val.
Create the integer (x,y) with x = val and y = val being val a constant
| val | is a constant |
|
inline |
Initializes both fields with given values.
Create the integer (x,y) with x = x-value and y = y-value
| x | is the x-value argument |
| y | is the y-value argument |
| ugdk::math::Integer2D::Integer2D | ( | const ugdk::Vector2D & | vec2d | ) |
Copy constructor from Vector2D.
|
inline |
| double ugdk::math::Integer2D::Angle | ( | ) | const |
Returns the angle (in radians) of this integer.
Return the angle (in radians) associated to this integer
| void ugdk::math::Integer2D::Divide | ( | const Integer2D & | divider | ) |
|
inline |
|
inline |
| double ugdk::math::Integer2D::Length | ( | ) | const |
Returns the norm-2 of this integer.
The norm-2 of a integer (x,y) is sqrt( x^2 + y^2 )
|
inline |
Returns the norm-2 squared.
The norm-2 squared of a integer (x,y) is (x^2 + y^2)
| void ugdk::math::Integer2D::Mirror | ( | const ugdk::enums::mirroraxis::MirrorAxis | mirror | ) |
| Integer2D ugdk::math::Integer2D::Mirrored | ( | const ugdk::enums::mirroraxis::MirrorAxis | mirror | ) | const |
| void ugdk::math::Integer2D::Mod | ( | const Integer2D & | divisor | ) |
In-place remainder (coordinate by coordinate) of integer division by "divisor".
| void ugdk::math::Integer2D::Multiply | ( | const Integer2D & | multiplier | ) |
In-place integer multiplication, coordinate by coordinate.
| int ugdk::math::Integer2D::NormOne | ( | ) | const |
Returns the norm-1 of this integer.
The norm-1 of a integer (x,y) is |x| + |y|.
| Integer2D ugdk::math::Integer2D::operator% | ( | int | scalar | ) | const |
Remainder of integer division by "scalar" in each coordinate.
Remainder of integer division by "scalar" coordinate by coordinate.
| Integer2D & ugdk::math::Integer2D::operator%= | ( | int | scalar | ) |
| Integer2D ugdk::math::Integer2D::operator* | ( | int | scalar | ) | const |
Method that returns a integer equal to the a integer multiplied by a scalar.
A integer (x,y) multiplied by a scalar a is equal to the integer (x * scalar, y*scalar)
| int ugdk::math::Integer2D::operator* | ( | const Integer2D & | right | ) | const |
Method that returns a scalar equal to the inner product of two vectors.
By definition the inner product of two vectors (x,y) (w,z) is equal to (x*w) + (y*z)
| Integer2D & ugdk::math::Integer2D::operator*= | ( | int | scalar | ) |
Method that returns a integer equal to the sum of two others.
The sum of two vectors (x,y) (w,z) is igual to the integer (x+w, y+z)
| Integer2D ugdk::math::Integer2D::operator- | ( | ) | const |
Method that returns a integer equal to the oposite of another.
The oposite of a integer (x,y) is equal to the integer (-x,-y) in this order
Method that returns a integer equal to the subtraction of two others.
The subtraction of two vectors (x,y) (z,w) is equal to the integer (x-z,y-w) in this order
| Integer2D ugdk::math::Integer2D::operator/ | ( | int | scalar | ) | const |
Method that returns a integer equal to the a integer multiplied by the inverse of a scalar.
A integer (x,y) multiplied by the inverse of a scalar is equal to the integer (x * 1/scalar, y * 1/scalar)
| Integer2D & ugdk::math::Integer2D::operator/= | ( | int | scalar | ) |
| void ugdk::math::Integer2D::Rotate | ( | RotDeg | rotdeg | ) |
Returns a new integer equal to this integer rotated by "angle" (in radians) counter-clockwise.
The integer rotated of a integer (x,y) is (x * cos(angle) - y * sin(angle) , x * sin(angle) + y * cos(angle)); angle in radians
Returns a new integer equal to this integer rotated by "angle" (in radians) counter-clockwise.
The integer rotated of a integer (x,y) is (x * cos(angle) - y * sin(angle) , x * sin(angle) + y * cos(angle)); angle in radians
Returns a new integer equal to this integer rotated by "angle" (in radians) counter-clockwise.
The integer rotated of a integer (x,y) is (x * cos(angle) - y * sin(angle) , x * sin(angle) + y * cos(angle)); angle in radians
Returns a new integer equal to this integer rotated by "angle" (in radians) counter-clockwise.
The integer rotated of a integer (x,y) is (x * cos(angle) - y * sin(angle) , x * sin(angle) + y * cos(angle)); angle in radians
|
inline |
|
inline |
| union { ... } |
| int ugdk::math::Integer2D::val[2] |
| int ugdk::math::Integer2D::x |
| int ugdk::math::Integer2D::y |