DesignForms
TMath Class Reference

Class MATH contains mathematic functions and constants More...

Public Member Functions

bool LineIntersection (object A1, object A2, object B1, object B2, out object Intersection)
 Calculates intersection of two lines More...
 
double GetAreaOfPolygon (IList Points)
 Calculates area of non-self-intersecting closed polygon More...
 
PointD GetCenterOfGravityOfPolygon (IList Points)
 Get center of gravity of the non-self-intersecting closed polygon More...
 
TStructure GetMOIOfPolygon (IList Points)
 Calculates main moments of innertia (Iy, Iz, Iyz) of the non-self-intersecting closed polygon. Moments are relative to the horizontal (Y) and vertical (Z) axis, with origin in center of gravity More...
 
TStructure GetMOIOfPolygon (IList Points, double Origin_Y, double Origin_Z)
 Calculates main moments of innertia (Iy, Iz, Iyz) of the non-self-intersecting closed polygon. Moments are relative to the horizontal (Y) and vertical (Z) axis, with origin in given coordinates More...
 
List< object > GetPolynomRoots (IList Coefficients)
 Calculate real roots of given polynomial More...
 
List< Complex > GetPolynomComplexRoots (IList Coefficients)
 Calculate complex roots of given polynomial More...
 
List< object > GetPolynomRoots0 (IList Coefficients)
 Calculate real roots of given polynomial More...
 
List< Complex > GetPolynomComplexRoots0 (IList Coefficients)
 Calculate complex roots of given polynomial More...
 
List< object > GetPolynomRoots (double X0, double X1, double X2, double X3, double X4, double X5, double X6)
 Calculate real roots of given polynomial More...
 
List< Complex > GetPolynomComplexRoots (double X0, double X1, double X2, double X3, double X4, double X5, double X6)
 Calculate complext roots of given polynomial More...
 
TStructure SolveQuadraticEquation (double A, double B, double C)
 Solve quadratic equation More...
 
TStructure SolveCubicEquation (double A, double B, double C, double D)
 Solve cubic equation More...
 
TMatrix GetTransformationMatrix3D (TVector3D Axis, double Angle)
 
TMatrix GetIsometryMatrix3D (double Alpha, double Beta)
 Return isometry transformation matrix More...
 
double Dist (double X1, double Y1, double X2, double Y2)
 Calculate distance of two 2D points More...
 
double Dist (object P1, object P2)
 Calculate distance of two 2D points More...
 

Public Attributes

double PI = Math.PI
 π = 3.14159265359 More...
 
double E = Math.E
 Euler's constant e = 2.71828182846 More...
 
double NaN = double.NaN
 NotAnyNumber More...
 

Detailed Description

Class MATH contains mathematic functions and constants

Member Function Documentation

double Dist ( double  X1,
double  Y1,
double  X2,
double  Y2 
)

Calculate distance of two 2D points

Parameters
X1X coordinate of first point
Y1Y coordinate of first point
X2X coordinate of second point
Y2Y coordinate of second point
Returns
Distance of points
double Dist ( object  P1,
object  P2 
)

Calculate distance of two 2D points

Parameters
P1First point
P2Second point
Returns
Distance of points
double GetAreaOfPolygon ( IList  Points)

Calculates area of non-self-intersecting closed polygon

Parameters
PointsPoints defining non-self-intersecting closed polygon
Returns
Area of the polygon
PointD GetCenterOfGravityOfPolygon ( IList  Points)

Get center of gravity of the non-self-intersecting closed polygon

Parameters
PointsPoints defining non-self-intersecting closed polygon
Returns
Point [X, Y] in center of gravity
TMatrix GetIsometryMatrix3D ( double  Alpha,
double  Beta 
)

Return isometry transformation matrix

Parameters
AlphaRotation around X-axis
BetaRotation around Y-axis
Returns
Transformation matrix
TStructure GetMOIOfPolygon ( IList  Points)

Calculates main moments of innertia (Iy, Iz, Iyz) of the non-self-intersecting closed polygon. Moments are relative to the horizontal (Y) and vertical (Z) axis, with origin in center of gravity

Parameters
PointsPoints defining non-self-intersecting closed polygon
Returns
  • "Iy" - Moment of innertia to the axis y-y
  • "Iz" - Moment of innertia to the axis z-z
  • "Iyz" - Moment of innertia to the axis y-z
TStructure GetMOIOfPolygon ( IList  Points,
double  Origin_Y,
double  Origin_Z 
)

Calculates main moments of innertia (Iy, Iz, Iyz) of the non-self-intersecting closed polygon. Moments are relative to the horizontal (Y) and vertical (Z) axis, with origin in given coordinates

Parameters
PointsPoints defining non-self-intersecting closed polygon
Origin_YY-coordinate of the origin of coordination system
Origin_ZZ-coordinate of the origin of coordination system
Returns
  • "Iy" - Moment of innertia to the axis y-y
  • "Iz" - Moment of innertia to the axis z-z
  • "Iyz" - Moment of innertia to the axis y-z
List<Complex> GetPolynomComplexRoots ( IList  Coefficients)

Calculate complex roots of given polynomial

Parameters
CoefficientsList of polynom coefficients sorted from highest grade to the lowest (Xn, ... X2, X1, X0)
Returns
Complex roots of the polynom
List<Complex> GetPolynomComplexRoots ( double  X0,
double  X1,
double  X2,
double  X3,
double  X4,
double  X5,
double  X6 
)

Calculate complext roots of given polynomial

Parameters
X0Coefficient of X^0
X1Coefficient of X^1
X2Coefficient of X^2
X3Coefficient of X^3
X4Coefficient of X^4
X5Coefficient of X^5
X6Coefficient of X^6
Returns
Complext roots of the polynom
List<Complex> GetPolynomComplexRoots0 ( IList  Coefficients)

Calculate complex roots of given polynomial

Parameters
CoefficientsList of polynom coefficients sorted from 0 to N (X0, X1, X2 ... Xn)
Returns
Complex roots of the polynom
List<object> GetPolynomRoots ( IList  Coefficients)

Calculate real roots of given polynomial

Parameters
CoefficientsList of polynom coefficients sorted from highest grade to the lowest (Xn, ... X2, X1, X0)
Returns
Real roots of the polynom
List<object> GetPolynomRoots ( double  X0,
double  X1,
double  X2,
double  X3,
double  X4,
double  X5,
double  X6 
)

Calculate real roots of given polynomial

Parameters
X0Coefficient of X^0
X1Coefficient of X^1
X2Coefficient of X^2
X3Coefficient of X^3
X4Coefficient of X^4
X5Coefficient of X^5
X6Coefficient of X^6
Returns
Real roots of the polynom
List<object> GetPolynomRoots0 ( IList  Coefficients)

Calculate real roots of given polynomial

Parameters
CoefficientsList of polynom coefficients sorted from 0 to N (X0, X1, X2 ... Xn)
Returns
Real roots of the polynom
TMatrix GetTransformationMatrix3D ( TVector3D  Axis,
double  Angle 
)

Parameters
Axis
Angle
Returns
bool LineIntersection ( object  A1,
object  A2,
object  B1,
object  B2,
out object  Intersection 
)

Calculates intersection of two lines

Parameters
A1First point of the first line
A2Second point of the first line
B1First point of the second line
B2Second point of the second line
IntersectionOut parameter - intersection point
Returns
TRUE, if intersection is found AND intersection is inside both lines; otherwise false
TStructure SolveCubicEquation ( double  A,
double  B,
double  C,
double  D 
)

Solve cubic equation

Parameters
ACoefficient of X3
BCoefficient of X2
CCoefficient of X1
DCoefficient of X0
Returns
Structure with roots and/or additional message (one/two roots, no real roots, ...)
TStructure SolveQuadraticEquation ( double  A,
double  B,
double  C 
)

Solve quadratic equation

Parameters
ACoefficient of X2
BCoefficient of X1
CCoefficient of X0
Returns
Structure with roots and/or additional message (one root, no real roots)

Member Data Documentation

double E = Math.E

Euler's constant e = 2.71828182846

double NaN = double.NaN

NotAnyNumber

double PI = Math.PI

π = 3.14159265359