UGDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes
ugdk::math::Integer2D Class Reference

#include <integer2D.h>

List of all members.

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 &center)
 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 &center) 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 &divider)
 In-place integer division, coordinate by coordinate.
Integer2D Divided (const Integer2D &divider) 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".
Integer2Doperator+= (const Integer2D &other)
Integer2Doperator-= (const Integer2D &other)
Integer2Doperator*= (int scalar)
Integer2Doperator/= (int scalar)
Integer2Doperator%= (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]
   } 
}; 

Constructor & Destructor Documentation

Initializes both fields with 0.

Create the integer (x,y) with x = 0 and y =0

ugdk::math::Integer2D::Integer2D ( int  val) [inline, explicit]

Initializes both fields with val.

Create the integer (x,y) with x = val and y = val being val a constant

Parameters:
valis a constant
ugdk::math::Integer2D::Integer2D ( int  _x,
int  _y 
) [inline]

Initializes both fields with given values.

Create the integer (x,y) with x = x-value and y = y-value

Parameters:
xis the x-value argument
yis the y-value argument

Copy constructor from Vector2D.


Member Function Documentation

double ugdk::math::Integer2D::Angle ( ) const

Returns the angle (in radians) of this integer.

Return the angle (in radians) associated to this integer

Returns:
Angle
void ugdk::math::Integer2D::Divide ( const Integer2D divider)

In-place integer division, coordinate by coordinate.

See also:
Divided
Scale

Returns a new Integer2D equal to this divided coordinate by coordinate by "multiplier".

See also:
Divide
Scale
int ugdk::math::Integer2D::get_x ( ) const [inline]
int ugdk::math::Integer2D::get_y ( ) const [inline]

Returns the norm-2 of this integer.

The norm-2 of a integer (x,y) is sqrt( x^2 + y^2 )

Returns:
Norm-2
See also:
NormOne()
LenghtSquared()
double ugdk::math::Integer2D::LengthSquared ( ) const [inline]

Returns the norm-2 squared.

The norm-2 squared of a integer (x,y) is (x^2 + y^2)

Returns:
Norm-2 Squared
See also:
NormOne()
Lenght()

Mirrors this Integer2D (in-place) by the "axis" axis. Include types.h and use "using namespace ugdk::enums".

Parameters:
axisEither mirroraxis::HORZ, mirroraxis::VERT, mirroraxis::DIAG_UP, or mirroraxis::DIAG_DOWN.
See also:
Mirrored

Returns a new Integer2D, mirrored by the "axis" axis. Include types.h and use "using namespace ugdk::enums".

Parameters:
axisEither mirroraxis::HORZ, mirroraxis::VERT, mirroraxis::DIAG_UP, or mirroraxis::DIAG_DOWN.
See also:
Mirror
void ugdk::math::Integer2D::Mod ( const Integer2D divisor)

In-place remainder (coordinate by coordinate) of integer division by "divisor".

See also:
Remainder
Integer2D ugdk::math::Integer2D::Multiplied ( const Integer2D multiplier) const

Returns a new Integer2D equal to this multiplied coordinate by coordinate by "multiplier".

See also:
Multiply
Scaled
void ugdk::math::Integer2D::Multiply ( const Integer2D multiplier)

In-place integer multiplication, coordinate by coordinate.

See also:
Multiplied
Scale

Returns the norm-1 of this integer.

The norm-1 of a integer (x,y) is |x| + |y|.

Returns:
Norm-1
See also:
Length()
Integer2D ugdk::math::Integer2D::operator% ( int  scalar) const

Remainder of integer division by "scalar" in each coordinate.

Integer2D ugdk::math::Integer2D::operator% ( const Integer2D right) const

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)

Returns:
Scalar Multiplied Integer
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)

Returns:
InnerProduct
Integer2D & ugdk::math::Integer2D::operator*= ( int  scalar)
Integer2D ugdk::math::Integer2D::operator+ ( const Integer2D right) const

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)

Returns:
Sum Integer
Integer2D & ugdk::math::Integer2D::operator+= ( const Integer2D other)
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

Returns:
Oposite Integer
Integer2D ugdk::math::Integer2D::operator- ( const Integer2D right) const

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

Returns:
Subtract Integer
Integer2D & ugdk::math::Integer2D::operator-= ( const Integer2D other)
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)

Returns:
Inverse Scalar Multiplied Integer
Integer2D & ugdk::math::Integer2D::operator/= ( int  scalar)

Returns a new Integer2D that is equal to the remainder of the integer division by "divisor".

See also:
Mod

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:
Rotated Integer
See also:
Angle
void ugdk::math::Integer2D::Rotate ( RotDeg  rotdeg,
const Integer2D center 
) [inline]

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:
Rotated Integer
See also:
Angle

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:
Rotated Integer
See also:
Angle
Integer2D ugdk::math::Integer2D::Rotated ( RotDeg  rotdeg,
const Integer2D center 
) const [inline]

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:
Rotated Integer
See also:
Angle
void ugdk::math::Integer2D::Scale ( const Integer2D multiplier,
const Integer2D divisor 
)

Multiplies in-place by "multiplier", and then divides by "divisor".

See also:
Scaled
Multiply
Divide
Integer2D ugdk::math::Integer2D::Scaled ( const Integer2D multiplier,
const Integer2D divisor 
) const

Returns a new Integer2D, multiplied by "multiplier", and divided by "divisor".

See also:
Scale
Multiply
Divide
void ugdk::math::Integer2D::set_x ( int  x_) [inline]
void ugdk::math::Integer2D::set_y ( int  y_) [inline]

Member Data Documentation

union { ... }

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines