Gorilla.Utils.Math
Unit Gorilla.Utils.Math.pasConstants
- const GORILLA_SINGLE_EPSILON : Double = 1e-07;
- const GORILLA_DOUBLE_EPSILON : Double = 1e-12;
- const GORILLA_FLOAT_EPSILON : Double = 1e-07;
- const GORILLA_SINGLE_MIN : Double = 1.18e-38;
- const GORILLA_SINGLE_MAX : Double = 3.4e+38;
- const GORILLA_SINGLE_INF : Double = 3.49e+38;
Mics. types
- type TMatrix3DArray = array [0..15] of Single;
Functions / Procedures
- public function SingleEquals ( const AVal1 : Single; const AVal2 : Single ) : Boolean ;
- public function DoubleEquals ( const AVal1 : Double; const AVal2 : Double ) : Boolean ;
- public function QuaternionToEuler ( Q : TVector3D ) : TPoint3D ; overload;
- public function QuaternionToEuler ( Q : TQuaternion3D ) : TPoint3D ; overload;
- public function QuaternionToRotationMatrix ( const AQuat : TVector3D ) : TMatrix3D ; overload;
- public function QuaternionToRotationMatrix ( const X : Single; const Y : Single; const Z : Single; const W : Single ) : TMatrix3D ; overload;
- public function RotationMatrixToEulerAngles ( const AMatrix : TMatrix3D ) : TPoint3D ; overload;
- public function RotationMatrixToEulerAngles ( const AMatrix : TMatrix ) : TPoint3D ; overload;
- public function RotationMatrixToQuaternion ( const AMatrix : TMatrix3D ) : TVector3D ;
- public function GetTranslationFromMatrix ( const AMatrix : TMatrix3D ) : TPoint3D ;
- public function GetRotationFromMatrix ( const AMatrix : TMatrix3D ) : TVector3D ;
- public function GetRotationMatrix3DFromMatrix ( const AMatrix : TMatrix3D ) : TMatrix3D ;
- public function GetRotationMatrixFromMatrix ( const AMatrix : TMatrix3D ) : TMatrix ;
- public function GetScalingFromMatrix ( const AMatrix : TMatrix3D ) : TPoint3D ;
- public function Matrix3DToMatrix ( const AMatrix : TMatrix3D ) : TMatrix ;
- public function MatrixToMatrix3D ( const AMatrix : TMatrix ) : TMatrix3D ;
- public procedure Vector3DToEulerianAngles ( const q : TVector3D; out roll : Single; out pitch : Single; out yaw : Single ) ;
- public function EulerianAnglesToVector3D ( const roll : Single; const pitch : Single; const yaw : Single ) : TVector3D ;
- public function RotationBetweenVectors ( const APoint : TPoint3D; const ADir : TPoint3D ) : TQuaternion3D ;
- public function RotatePointAroundAxisRad ( Angle : Single; const Point : TPoint3D; const Axis : TPoint3D ) : TPoint3D ;
- public function Matrix3DToDoubleArray ( const AMatrix : TMatrix3D ) : TDoubleDynArray ;
- public function Matrix3DToSingleArray ( const AMatrix : TMatrix3D ) : TSingleDynArray ;
- public function Lerp ( const A : Single; const V1 : Single; const V2 : Single ) : Single ; overload;
- public function Lerp ( const A : Single; const V1 : TPointF; const V2 : TPointF ) : TPointF ; overload;
- public function Lerp ( const A : Single; const V1 : TPoint3D; const V2 : TPoint3D ) : TPoint3D ; overload;
- public function Lerp ( const A : Single; const V1 : TVector3D; const V2 : TVector3D ) : TVector3D ; overload;
- public function SCurve ( const A : Single ) : Single ;
- public function RandomFloatRange ( const A : Single; const B : Single ) : Single ;
- public function Zero ( const f1 : Single ) : Boolean ; overload;
- public function Zero ( const f1 : Double ) : Boolean ; overload;
- public function Zero ( const f1 : Single; const EqEpsilon : Single ) : Boolean ; overload;
- public function Zero ( const f1 : Double; const EqEpsilon : Double ) : Boolean ; overload;
- public function IsZero ( const v1 : TPoint3D ) : Boolean ; overload;
- public function IsZero ( const v1 : TVector3D ) : Boolean ; overload;
- public function IsZero ( const c : TAlphaColorF; const ACheckAlpha : Boolean = True ) : Boolean ; overload;
- public function Clamped ( const a : Int64; const vBegin : Int64; const vEnd : Int64 ) : Int64 ; overload;
- public function Clamped ( const a : UInt64; const vBegin : UInt64; const vEnd : UInt64 ) : UInt64 ; overload;
- public function Clamped ( const a : Integer; const vBegin : Integer; const vEnd : Integer ) : Integer ; overload;
- public function Clamped ( const a : Cardinal; const vBegin : Cardinal; const vEnd : Cardinal ) : Cardinal ; overload;
- public function Clamped ( const a : Single; const vBegin : Single; const vEnd : Single ) : Single ; overload;
- public function Clamped ( const a : Double; const vBegin : Double; const vEnd : Double ) : Double ; overload;
- public function Clamp ( const AValue : Integer; const AMinVal : Integer; const AMaxVal : Integer ) : Integer ; overload;
- public function Clamp ( const AValue : Single; const AMinVal : Single; const AMaxVal : Single ) : Single ; overload;
- public function Clamp ( const AValue : TPointF; const AMinVal : TPointF; const AMaxVal : TPointF ) : TPointF ; overload;
- public function Clamp ( const AValue : TPoint3D; const AMinVal : TPoint3D; const AMaxVal : TPoint3D ) : TPoint3D ; overload;
- public function Clamp ( const AValue : TVector3D; const AMinVal : TVector3D; const AMaxVal : TVector3D ) : TVector3D ; overload;
- public function SmoothStep ( const AEdge0 : Single; const AEdge1 : Single; const AX : Single ) : Single ; overload;
- public function SmoothStep ( const AEdge0 : TPointF; const AEdge1 : TPointF; const AX : TPointF ) : TPointF ; overload;
- public function SmoothStep ( const AEdge0 : TPoint3D; const AEdge1 : TPoint3D; const AX : TPoint3D ) : TPoint3D ; overload;
- public function SmoothStep ( const AEdge0 : TVector3D; const AEdge1 : TVector3D; const AX : TVector3D ) : TVector3D ; overload;
- public function SmoothStep ( const AEdge0 : TQuaternion3D; const AEdge1 : TQuaternion3D; const AX : TQuaternion3D ) : TQuaternion3D ; overload;
- public function SingleCut ( const v : TPoint3D ) : TPointF ; overload;
- public function SingleCut ( const v : TVector3D ) : TPoint3D ; overload;
- public function OuterProduct ( const U : TPoint3D; const V : TPoint3D ) : TMatrix ; overload;
- public function OuterProduct ( const U : TVector3D; const V : TVector3D ) : TMatrix3D ; overload;
- public function MatrixAdd ( const M1 : TMatrix3D; const M2 : TMatrix3D ) : TMatrix3D ; overload;
- public function MatrixAdd ( const M1 : TMatrix; const M2 : TMatrix ) : TMatrix ; overload;
- public function MatrixSubtract ( const M1 : TMatrix3D; const M2 : TMatrix3D ) : TMatrix3D ; overload;
- public function MatrixSubtract ( const M1 : TMatrix; const M2 : TMatrix ) : TMatrix ; overload;
- public function MatrixMultiply ( const AMatrix : TMatrix3D; const AFactor : Single ) : TMatrix3D ; overload;
- public function MatrixMultiply ( const AMatrix : TMatrix; const AFactor : Single ) : TMatrix ; overload;
- public function MatrixTranspose ( const AMatrix : TMatrix3D ) : TMatrix3D ; overload;
- public function MatrixTranspose ( const AMatrix : TMatrix ) : TMatrix ; overload;
- public function MatrixRow ( const AMatrix : TMatrix; const ARow : Byte ) : TPoint3D ;
- public function MatrixRowVector ( const AMatrix : TMatrix; const ARow : Byte ) : TVector ;
- public function MatrixCol ( const AMatrix : TMatrix; const ACol : Byte ) : TPoint3D ;
- public function CreateMatrixDiagonal ( const AVector : TPoint3D ) : TMatrix ; overload;
- public function CreateMatrixDiagonal ( const AVector : TVector3D ) : TMatrix3D ; overload;
- public function CreateMatrixFromRows ( const AVec1 : TPoint3D; const AVec2 : TPoint3D; const AVec3 : TPoint3D ) : TMatrix ;
- public function Point3DSquare ( const APoint : TPoint3D ) : Single ;
- public function Point3DMinIndex ( const APoint : TPoint3D ) : Integer ;
- public function Point3DInverse ( const APoint : TPoint3D ) : TPoint3D ;
- public function Point3DNormalizeAndReturnNormal ( var APoint : TPoint3D ) : Single ;
- public function MatrixIsIdentity ( const AMatrix : TMatrix3D ) : Boolean ;
- public function MatrixIsNull ( const AMatrix : TMatrix3D ) : Boolean ;
- public procedure CameraVectorsFromViewMatrix ( AMatrix : TMatrix3D; out APosition : TPoint3D; out ADirection : TPoint3D; out AUp : TPoint3D; out ARight : TPoint3D ) ;
- public function GetViewDirectionFromViewMatrix ( AMatrix : TMatrix3D ) : TPoint3D ;
- public function Magnitude
(
const
AVector :
TPoint3D
)
: Double
;
overload;
Returns the length of this vector (Read Only). The length of the vector is square root of (x*x+y*y). If you only need to compare magnitudes of some vectors, you can compare squared magnitudes of them using sqrMagnitude (computing squared magnitudes is faster).
- public function Magnitude ( const AVector : TVector3D ) : Double ; overload;
- public function SquareMagnitude
(
const
AVector :
TPoint3D
)
: Double
;
overload;
Returns the squared length of this vector (Read Only). The magnitude of a vector v is calculated as Mathf.Sqrt(Vector3.Dot(v, v)). However, the Sqrt calculation is quite complicated and takes longer to execute than the normal arithmetic operations. Calculating the squared magnitude instead of using the magnitude property is much faster - the calculation is basically the same only without the slow Sqrt call. If you are using magnitudes simply to compare distances, then you can just as well compare squared magnitudes against the squares of distances since the comparison will give the same result.
- public function SquareMagnitude ( const AVector : TVector3D ) : Double ; overload;
- public function BoundingBoxRayCastIntersect
(
const
ABox :
TBoundingBox; const
ARayPos :
TVector3D; const
ARayDir :
TVector3D
)
: Single
;
Checks a ray and a boundingbox for intersection.