mathTypes.cpp
Engine/source/math/mathTypes.cpp
Public Variables
ConsoleGetType (TypePoint2I)
Public Functions
ConsoleFunctionGroupEnd(MatrixMath )
ConsoleGetType(TypeAngAxisF )
ConsoleGetType(TypeBox3F )
ConsoleGetType(TypeEaseF )
ConsoleGetType(TypeMatrixF )
ConsoleGetType(TypePoint2F )
ConsoleGetType(TypePoint3F )
ConsoleGetType(TypePoint3I )
ConsoleGetType(TypePoint4F )
ConsoleGetType(TypeRectF )
ConsoleGetType(TypeRectI )
ConsoleGetType(TypeRotationF )
ConsoleGetType(TypeTransformF )
ConsoleMappedType(MatrixPosition , TypeMatrixPosition , Point3F , MatrixF , "" )
ConsoleMappedType(MatrixRotation , TypeMatrixRotation , AngAxisF , MatrixF , "" )
ConsoleSetType(TypeAngAxisF )
ConsoleSetType(TypeBox3F )
ConsoleSetType(TypeEaseF )
ConsoleSetType(TypeMatrixF )
ConsoleSetType(TypeMatrixPosition )
ConsoleSetType(TypeMatrixRotation )
ConsoleSetType(TypePoint2F )
ConsoleSetType(TypePoint2I )
ConsoleSetType(TypePoint3F )
ConsoleSetType(TypePoint3I )
ConsoleSetType(TypePoint4F )
ConsoleSetType(TypeRectF )
ConsoleSetType(TypeRectI )
ConsoleSetType(TypeRotationF )
ConsoleSetType(TypeTransformF )
ConsoleType(AngAxisF , TypeAngAxisF , AngAxisF , "" )
ConsoleType(Box3F , TypeBox3F , Box3F , "" )
ConsoleType(EaseF , TypeEaseF , EaseF , "" )
ConsoleType(MatrixF , TypeMatrixF , MatrixF , "" )
ConsoleType(Point2F , TypePoint2F , Point2F , "" )
ConsoleType(Point2I , TypePoint2I , Point2I , "" )
ConsoleType(Point3F , TypePoint3F , Point3F , "" )
ConsoleType(Point3I , TypePoint3I , Point3I , "" )
ConsoleType(Point4F , TypePoint4F , Point4F , "" )
ConsoleType(RectF , TypeRectF , RectF , "" )
ConsoleType(RectI , TypeRectI , RectI , "" )
ConsoleType(RotationF , TypeRotationF , RotationF , "" )
ConsoleType(TransformF , TypeTransformF , TransformF , "" )
DefineEngineFunction(getBoxCenter , Point3F , (Box3F box) , "Get the center point of an axis-aligned <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">box.\n\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> A Box3F, in string format using \"minExtentX minExtentY minExtentZ maxExtentX maxExtentY maxExtentZ\"\n" "@return Center of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">box.\n</a>" "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRandom , F32 , (S32 a, S32 b) , (S32_MAX, S32_MAX) , "( int <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, int <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> ) " "@brief Returns <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> random number based on parameters passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in..\n\n</a>" "If no parameters are passed in, getRandom() will return <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> float between 0.0 and 1.0. If one " "parameter is passed an integer between 0 and the passed in <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> will be returned. Two parameters will " "return an integer between the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">numbers.\n\n</a>" " @param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> If this is the only parameter, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> number between 0 and <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> is returned. Elsewise represents the lower <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">bound.\n</a>" " @param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> Upper bound on the random number. The random number will be<=@<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n</a>" " @return A pseudo-random integer between @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> and @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> b, between 0 and a, or <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> " "float between 0.0 and 1.1 depending on <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">usage.\n\n</a>" " @note All parameters are optional." " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setRandomSeed\n</a>" " @ingroup Random" )
DefineEngineFunction(getRandomSeed , S32 , () , "Get the current seed used by the random number <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">generator.\n</a>" "@return The current random number generator seed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@ingroup Random" )
DefineEngineFunction(MatrixCreate , TransformF , (VectorF position, AngAxisF orientation) , "Create <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> transform from the given translation and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">orientation.\n</a>" "@param position The translation vector <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" "@param orientation The axis and rotation that orients the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" "@return A transform based on the given position and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">orientation.\n</a>" "@ingroup Matrices" )
DefineEngineFunction(MatrixCreateFromEuler , TransformF , (Point3F angles) , "@Create <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> matrix from the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotations.\n\n</a>" "@param Vector3F X, Y , and Z rotation in *radians *.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @return A transform based on the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">orientation.\n</a>" " @ingroup Matrices" )
DefineEngineFunction(MatrixMulPoint , Point3F , (TransformF transform, Point3F point) )
DefineEngineFunction(MatrixMultiply , TransformF , (TransformF left, TransformF right) , "@brief Multiply the two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">matrices.\n\n</a>" "@param left First <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" "@param right Right <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" "@return Concatenation of the two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transforms.\n</a>" "@ingroup Matrices" )
DefineEngineFunction(MatrixMulVector , VectorF , (TransformF transform, VectorF vector) )
DefineEngineFunction(setRandomSeed , void , (S32 seed) , (-1) , "Set the current seed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the random number <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">generator.\n</a>" "Based on this seed, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> repeatable sequence of numbers will be produced by getRandom().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param seed The seed with which <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> initialize the randon number generator with. The same seed will always leed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a>" "the same sequence of pseudo-random <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">numbers.\n</a>" "If - 1, the current timestamp will be used as the seed which is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> good basis <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">randomization.\n</a>" " @ingroup Random" )
DefineEngineFunction(VectorAdd , VectorF , (VectorF a, VectorF b) , "Add two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> + @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorAdd( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The sum of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>+ b)
DefineEngineFunction(VectorCross , VectorF , (VectorF a, VectorF b) , "Calculcate the cross product of two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The cross product @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> x @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorCross( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The cross product of vector a, (ax, ay, az) , and vector b, (bx, by, bz) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> x b)
DefineEngineFunction(VectorDist , F32 , (VectorF a, VectorF b) , "Compute the distance between two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The length( @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> - @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> ).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorDist( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The distance between vector a, (ax, ay, az) , and vector b, (bx, by, bz) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> -> b)
DefineEngineFunction(VectorDiv , VectorF , (VectorF a, VectorF b) , "Divide two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> / @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorDiv( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The division of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * b)
DefineEngineFunction(VectorDot , F32 , (VectorF a, VectorF b) , "Compute the dot product of two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The dot product @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorDot( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The dot product between vector a, (ax, ay, az) , and vector b, (bx, by, bz) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> . b)
DefineEngineFunction(VectorLen , F32 , (VectorF v) , "Calculate the magnitude of the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param v A <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The length of vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">v.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorLen( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The length or magnitude of vector a, (ax, ay, az) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//||<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>|| )
DefineEngineFunction(VectorLerp , VectorF , (VectorF a, VectorF b, F32 t) , "Linearly interpolate between two vectors by @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">t.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classvector/">Vector</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start interpolation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> <a href="/coding/class/classvector/">Vector</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> interpolate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@param <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1aded116371789db1fd63c90ef00c95a3d">t</a> Interpolation factor (0-1). At zero, @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> is returned and at one, @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> is returned. In between, an interpolated vector " "between @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> and @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">returned.\n</a>" " @return An interpolated vector between @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> and @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//VectorLerp(%<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a>);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//The point between vector a, (ax, ay, az) , and vector b, (bx, by, bz) , which <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" "//weighted by the interpolation factor, <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1aded116371789db1fd63c90ef00c95a3d">t</a> , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// r)
DefineEngineFunction(VectorMidPoint , VectorF , (VectorF a, VectorF b) , "Gets the midpoint between the two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector (@<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> + @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a>) / 2.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorMidPoint( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The midpoint of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//(<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>+<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a>)/ 2, (az+bz)/ 2)
DefineEngineFunction(VectorMul , VectorF , (VectorF a, VectorF b) , "Multiplies two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorMul( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The multiplication of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * b)
DefineEngineFunction(VectorNormalize , VectorF , (VectorF v) , "Brings <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> vector into its unit form, i.e. such that it has the magnitute 1.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param v The vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">normalize.\n</a>" " @return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> v scaled <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> length 1.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//VectorNormalize(%<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//The normalized vector a, (ax, ay, az) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>^ )
DefineEngineFunction(VectorOrthoBasis , MatrixF , (AngAxisF aa) , "Create an orthogonal basis from the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param aaf The vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> create the orthogonal basis <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "@return A matrix representing the orthogonal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">basis.\n</a>" "@ingroup Vectors" )
DefineEngineFunction(VectorReflect , VectorF , (VectorF vec, VectorF normal) , "Compute the reflection of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> vector based on <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">normal.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">normal.\n</a>" "@return The reflected <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n\n</a>" "@ingroup Vectors" )
DefineEngineFunction(VectorRot , const char * , (Point3F v, F32 angle) , "(Vector3F, float) rotate <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> vector in 2d" )
DefineEngineFunction(VectorScale , VectorF , (VectorF a, F32 scalar) , "Scales <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> vector by <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scalar.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scale.\n</a>" "@param scalar The scale <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">factor.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scalar.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorScale( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %v );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// Scaling vector a, (ax, ay, az) , but the scalar, v , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * v)
DefineEngineFunction(VectorSub , VectorF , (VectorF a, VectorF b) , "Subtract two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> - @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorSub( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The difference of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> - b)
IMPLEMENT_SCOPE(MathTypes , Math , "" )
IMPLEMENT_STRUCT(MatrixF, MatrixF, MathTypes, "") MatrixFEngineExport
IMPLEMENT_STRUCT(AngAxisF , AngAxisF , MathTypes , "" )
IMPLEMENT_STRUCT(Box3F , Box3F , MathTypes , "" )
IMPLEMENT_STRUCT(EaseF , EaseF , MathTypes , "" )
IMPLEMENT_STRUCT(Point2F , Point2F , MathTypes , "" )
IMPLEMENT_STRUCT(Point2I , Point2I , MathTypes , "" )
IMPLEMENT_STRUCT(Point3F , Point3F , MathTypes , "" )
IMPLEMENT_STRUCT(Point3I , Point3I , MathTypes , "" )
IMPLEMENT_STRUCT(Point4F , Point4F , MathTypes , "" )
IMPLEMENT_STRUCT(RectF , RectF , MathTypes , "" )
IMPLEMENT_STRUCT(RectI , RectI , MathTypes , "" )
IMPLEMENT_STRUCT(RotationF , RotationF , MathTypes , "" )
IMPLEMENT_STRUCT(TransformF , TransformF , MathTypes , "" )
Detailed Description
Public Variables
Point2I ConsoleGetType (TypePoint2I)
Public Functions
ConsoleFunctionGroupEnd(MatrixMath )
ConsoleGetType(TypeAngAxisF )
ConsoleGetType(TypeBox3F )
ConsoleGetType(TypeEaseF )
ConsoleGetType(TypeMatrixF )
ConsoleGetType(TypePoint2F )
ConsoleGetType(TypePoint3F )
ConsoleGetType(TypePoint3I )
ConsoleGetType(TypePoint4F )
ConsoleGetType(TypeRectF )
ConsoleGetType(TypeRectI )
ConsoleGetType(TypeRotationF )
ConsoleGetType(TypeTransformF )
ConsoleMappedType(MatrixPosition , TypeMatrixPosition , Point3F , MatrixF , "" )
ConsoleMappedType(MatrixRotation , TypeMatrixRotation , AngAxisF , MatrixF , "" )
ConsoleSetType(TypeAngAxisF )
ConsoleSetType(TypeBox3F )
ConsoleSetType(TypeEaseF )
ConsoleSetType(TypeMatrixF )
ConsoleSetType(TypeMatrixPosition )
ConsoleSetType(TypeMatrixRotation )
ConsoleSetType(TypePoint2F )
ConsoleSetType(TypePoint2I )
ConsoleSetType(TypePoint3F )
ConsoleSetType(TypePoint3I )
ConsoleSetType(TypePoint4F )
ConsoleSetType(TypeRectF )
ConsoleSetType(TypeRectI )
ConsoleSetType(TypeRotationF )
ConsoleSetType(TypeTransformF )
ConsoleType(AngAxisF , TypeAngAxisF , AngAxisF , "" )
ConsoleType(Box3F , TypeBox3F , Box3F , "" )
ConsoleType(EaseF , TypeEaseF , EaseF , "" )
ConsoleType(MatrixF , TypeMatrixF , MatrixF , "" )
ConsoleType(Point2F , TypePoint2F , Point2F , "" )
ConsoleType(Point2I , TypePoint2I , Point2I , "" )
ConsoleType(Point3F , TypePoint3F , Point3F , "" )
ConsoleType(Point3I , TypePoint3I , Point3I , "" )
ConsoleType(Point4F , TypePoint4F , Point4F , "" )
ConsoleType(RectF , TypeRectF , RectF , "" )
ConsoleType(RectI , TypeRectI , RectI , "" )
ConsoleType(RotationF , TypeRotationF , RotationF , "" )
ConsoleType(TransformF , TypeTransformF , TransformF , "" )
DefineEngineFunction(getBoxCenter , Point3F , (Box3F box) , "Get the center point of an axis-aligned <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">box.\n\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> A Box3F, in string format using \"minExtentX minExtentY minExtentZ maxExtentX maxExtentY maxExtentZ\"\n" "@return Center of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">box.\n</a>" "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRandom , F32 , (S32 a, S32 b) , (S32_MAX, S32_MAX) , "( int <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, int <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> ) " "@brief Returns <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> random number based on parameters passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in..\n\n</a>" "If no parameters are passed in, getRandom() will return <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> float between 0.0 and 1.0. If one " "parameter is passed an integer between 0 and the passed in <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> will be returned. Two parameters will " "return an integer between the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">numbers.\n\n</a>" " @param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> If this is the only parameter, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> number between 0 and <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> is returned. Elsewise represents the lower <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">bound.\n</a>" " @param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> Upper bound on the random number. The random number will be<=@<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n</a>" " @return A pseudo-random integer between @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> and @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> b, between 0 and a, or <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> " "float between 0.0 and 1.1 depending on <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">usage.\n\n</a>" " @note All parameters are optional." " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setRandomSeed\n</a>" " @ingroup Random" )
DefineEngineFunction(getRandomSeed , S32 , () , "Get the current seed used by the random number <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">generator.\n</a>" "@return The current random number generator seed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" "@ingroup Random" )
DefineEngineFunction(MatrixCreate , TransformF , (VectorF position, AngAxisF orientation) , "Create <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> transform from the given translation and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">orientation.\n</a>" "@param position The translation vector <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" "@param orientation The axis and rotation that orients the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" "@return A transform based on the given position and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">orientation.\n</a>" "@ingroup Matrices" )
DefineEngineFunction(MatrixCreateFromEuler , TransformF , (Point3F angles) , "@Create <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> matrix from the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotations.\n\n</a>" "@param Vector3F X, Y , and Z rotation in *radians *.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @return A transform based on the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">orientation.\n</a>" " @ingroup Matrices" )
DefineEngineFunction(MatrixMulPoint , Point3F , (TransformF transform, Point3F point) )
DefineEngineFunction(MatrixMultiply , TransformF , (TransformF left, TransformF right) , "@brief Multiply the two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">matrices.\n\n</a>" "@param left First <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" "@param right Right <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" "@return Concatenation of the two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transforms.\n</a>" "@ingroup Matrices" )
DefineEngineFunction(MatrixMulVector , VectorF , (TransformF transform, VectorF vector) )
DefineEngineFunction(setRandomSeed , void , (S32 seed) , (-1) , "Set the current seed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the random number <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">generator.\n</a>" "Based on this seed, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> repeatable sequence of numbers will be produced by getRandom().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param seed The seed with which <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> initialize the randon number generator with. The same seed will always leed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a>" "the same sequence of pseudo-random <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">numbers.\n</a>" "If - 1, the current timestamp will be used as the seed which is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> good basis <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">randomization.\n</a>" " @ingroup Random" )
DefineEngineFunction(VectorAdd , VectorF , (VectorF a, VectorF b) , "Add two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> + @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorAdd( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The sum of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>+ b)
DefineEngineFunction(VectorCross , VectorF , (VectorF a, VectorF b) , "Calculcate the cross product of two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The cross product @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> x @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorCross( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The cross product of vector a, (ax, ay, az) , and vector b, (bx, by, bz) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> x b)
DefineEngineFunction(VectorDist , F32 , (VectorF a, VectorF b) , "Compute the distance between two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The length( @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> - @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> ).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorDist( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The distance between vector a, (ax, ay, az) , and vector b, (bx, by, bz) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> -> b)
DefineEngineFunction(VectorDiv , VectorF , (VectorF a, VectorF b) , "Divide two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> / @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorDiv( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The division of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * b)
DefineEngineFunction(VectorDot , F32 , (VectorF a, VectorF b) , "Compute the dot product of two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The dot product @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorDot( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The dot product between vector a, (ax, ay, az) , and vector b, (bx, by, bz) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> . b)
DefineEngineFunction(VectorLen , F32 , (VectorF v) , "Calculate the magnitude of the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param v A <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The length of vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">v.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorLen( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The length or magnitude of vector a, (ax, ay, az) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//||<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>|| )
DefineEngineFunction(VectorLerp , VectorF , (VectorF a, VectorF b, F32 t) , "Linearly interpolate between two vectors by @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">t.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classvector/">Vector</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start interpolation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> <a href="/coding/class/classvector/">Vector</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> interpolate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@param <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1aded116371789db1fd63c90ef00c95a3d">t</a> Interpolation factor (0-1). At zero, @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> is returned and at one, @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> is returned. In between, an interpolated vector " "between @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> and @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">returned.\n</a>" " @return An interpolated vector between @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> and @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//VectorLerp(%<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a>);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//The point between vector a, (ax, ay, az) , and vector b, (bx, by, bz) , which <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" "//weighted by the interpolation factor, <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1aded116371789db1fd63c90ef00c95a3d">t</a> , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// r)
DefineEngineFunction(VectorMidPoint , VectorF , (VectorF a, VectorF b) , "Gets the midpoint between the two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector (@<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> + @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a>) / 2.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorMidPoint( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The midpoint of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//(<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>+<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a>)/ 2, (az+bz)/ 2)
DefineEngineFunction(VectorMul , VectorF , (VectorF a, VectorF b) , "Multiplies two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorMul( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The multiplication of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * b)
DefineEngineFunction(VectorNormalize , VectorF , (VectorF v) , "Brings <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> vector into its unit form, i.e. such that it has the magnitute 1.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param v The vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">normalize.\n</a>" " @return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> v scaled <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> length 1.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//VectorNormalize(%<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//The normalized vector a, (ax, ay, az) , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>^ )
DefineEngineFunction(VectorOrthoBasis , MatrixF , (AngAxisF aa) , "Create an orthogonal basis from the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param aaf The vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> create the orthogonal basis <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "@return A matrix representing the orthogonal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">basis.\n</a>" "@ingroup Vectors" )
DefineEngineFunction(VectorReflect , VectorF , (VectorF vec, VectorF normal) , "Compute the reflection of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> vector based on <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">normal.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">normal.\n</a>" "@return The reflected <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n\n</a>" "@ingroup Vectors" )
DefineEngineFunction(VectorRot , const char * , (Point3F v, F32 angle) , "(Vector3F, float) rotate <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> vector in 2d" )
DefineEngineFunction(VectorScale , VectorF , (VectorF a, F32 scalar) , "Scales <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> vector by <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scalar.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scale.\n</a>" "@param scalar The scale <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">factor.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">scalar.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorScale( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %v );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// Scaling vector a, (ax, ay, az) , but the scalar, v , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> * v)
DefineEngineFunction(VectorSub , VectorF , (VectorF a, VectorF b) , "Subtract two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vectors.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> The first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> The second <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "@return The vector @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> - @<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">b.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//-----------------------------------------------------------------------------\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// VectorSub( %<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a>, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "// The difference of vector a, (ax, ay, az) , and vector b, (bx, by, bz) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">is:\n</a>" "//\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> - b)
IMPLEMENT_SCOPE(MathTypes , Math , "" )
IMPLEMENT_STRUCT(AngAxisF , AngAxisF , MathTypes , "" )
IMPLEMENT_STRUCT(Box3F , Box3F , MathTypes , "" )
IMPLEMENT_STRUCT(EaseF , EaseF , MathTypes , "" )
IMPLEMENT_STRUCT(Point2F , Point2F , MathTypes , "" )
IMPLEMENT_STRUCT(Point2I , Point2I , MathTypes , "" )
IMPLEMENT_STRUCT(Point3F , Point3F , MathTypes , "" )
IMPLEMENT_STRUCT(Point3I , Point3I , MathTypes , "" )
IMPLEMENT_STRUCT(Point4F , Point4F , MathTypes , "" )
IMPLEMENT_STRUCT(RectF , RectF , MathTypes , "" )
IMPLEMENT_STRUCT(RectI , RectI , MathTypes , "" )
IMPLEMENT_STRUCT(RotationF , RotationF , MathTypes , "" )
IMPLEMENT_STRUCT(TransformF , TransformF , MathTypes , "" )
mRandF()
mRandF(F32 f1, F32 f2)
mRandI(S32 i1, S32 i2)
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "core/strings/stringFunctions.h" 25#include "console/consoleTypes.h" 26#include "console/console.h" 27#include "console/engineAPI.h" 28#include "math/mPoint2.h" 29#include "math/mPoint3.h" 30#include "math/mMatrix.h" 31#include "math/mQuat.h" 32#include "math/mRect.h" 33#include "math/mBox.h" 34#include "math/mAngAxis.h" 35#include "math/mTransform.h" 36#include "math/mathTypes.h" 37#include "math/mRandom.h" 38#include "math/mEase.h" 39#include "math/mathUtils.h" 40#include "math/mRotation.h" 41#include "core/strings/stringUnit.h" 42 43IMPLEMENT_SCOPE( MathTypes, Math,, "" ); 44 45IMPLEMENT_STRUCT( Point2I, 46 Point2I, MathTypes, 47 "" ) 48 49 FIELD( x, x, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965dae8dfc01bae2100bf825946e9ab4aa0e3">X</a> coordinate." ) 50 FIELD( y, y, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da4b172ac256416a167161f9511017baae">Y</a> coordinate." ) 51 52END_IMPLEMENT_STRUCT; 53IMPLEMENT_STRUCT( Point2F, 54 Point2F, MathTypes, 55 "" ) 56 57 FIELD( x, x, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965dae8dfc01bae2100bf825946e9ab4aa0e3">X</a> coordinate." ) 58 FIELD( y, y, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da4b172ac256416a167161f9511017baae">Y</a> coordinate." ) 59 60END_IMPLEMENT_STRUCT; 61IMPLEMENT_STRUCT( Point3I, 62 Point3I, MathTypes, 63 "" ) 64 65 FIELD( x, x, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965dae8dfc01bae2100bf825946e9ab4aa0e3">X</a> coordinate." ) 66 FIELD( y, y, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da4b172ac256416a167161f9511017baae">Y</a> coordinate." ) 67 FIELD( z, z, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da6cb352937ac2ab0e3036d53e2639fd3d">Z</a> coordinate." ) 68 69END_IMPLEMENT_STRUCT; 70IMPLEMENT_STRUCT( Point3F, 71 Point3F, MathTypes, 72 "" ) 73 74 FIELD( x, x, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965dae8dfc01bae2100bf825946e9ab4aa0e3">X</a> coordinate." ) 75 FIELD( y, y, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da4b172ac256416a167161f9511017baae">Y</a> coordinate." ) 76 FIELD( z, z, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da6cb352937ac2ab0e3036d53e2639fd3d">Z</a> coordinate." ) 77 78END_IMPLEMENT_STRUCT; 79IMPLEMENT_STRUCT( Point4F, 80 Point4F, MathTypes, 81 "" ) 82 83 FIELD( x, x, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965dae8dfc01bae2100bf825946e9ab4aa0e3">X</a> coordinate." ) 84 FIELD( y, y, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da4b172ac256416a167161f9511017baae">Y</a> coordinate." ) 85 FIELD( z, z, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da6cb352937ac2ab0e3036d53e2639fd3d">Z</a> coordinate." ) 86 FIELD( w, w, 1, "W coordinate." ) 87 88END_IMPLEMENT_STRUCT; 89IMPLEMENT_STRUCT( RectI, 90 RectI, MathTypes, 91 "" ) 92 93 FIELD( point, point, 1, "The XY coordinate of the Rect." ) 94 FIELD( extent, extent, 1, "The width and height of the Rect." ) 95 96END_IMPLEMENT_STRUCT; 97IMPLEMENT_STRUCT( RectF, 98 RectF, MathTypes, 99 "" ) 100 101 FIELD( point, point, 1, "The XY coordinate of the Rect.") 102 FIELD( extent, extent, 1, "The width and height of the Rect.") 103 104END_IMPLEMENT_STRUCT; 105IMPLEMENT_STRUCT( MatrixF, 106 MatrixF, MathTypes, 107 "" ) 108 109 MatrixFEngineExport::getMatrixField(), 110 111END_IMPLEMENT_STRUCT; 112IMPLEMENT_STRUCT( AngAxisF, 113 AngAxisF, MathTypes, 114 "" ) 115 116 FIELD( axis, axis, 1, "") 117 FIELD( angle, angle, 1, "") 118 119END_IMPLEMENT_STRUCT; 120IMPLEMENT_STRUCT( TransformF, 121 TransformF, MathTypes, 122 "" ) 123 124 FIELD(mPosition, position, 1, "") 125 FIELD(mOrientation, orientation, 1, "") 126 FIELD(mHasRotation, hasRotation, 1, "") 127 128END_IMPLEMENT_STRUCT; 129IMPLEMENT_STRUCT( Box3F, 130 Box3F, MathTypes, 131 "" ) 132 133 FIELD(minExtents, minExtents, 1, "Minimum extents of box") 134 FIELD(maxExtents, maxExtents, 1, "Maximum extents of box") 135 136END_IMPLEMENT_STRUCT; 137IMPLEMENT_STRUCT( EaseF, 138 EaseF, MathTypes, 139 "" ) 140 141 FIELD(mDir, dir, 1, "inout, in, out") 142 FIELD(mType, type, 1, "linear, etc...") 143 FIELD_AS(F32, mParam, param, 2, "optional params") 144 145END_IMPLEMENT_STRUCT; 146IMPLEMENT_STRUCT(RotationF, 147 RotationF, MathTypes, 148 "") 149 FIELD(x, x, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965dae8dfc01bae2100bf825946e9ab4aa0e3">X</a> coordinate.") 150 FIELD(y, y, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da4b172ac256416a167161f9511017baae">Y</a> coordinate.") 151 FIELD(z, z, 1, "<a href="/coding/namespace/namespacerazerhydrautil/#namespacerazerhydrautil_1a11c85cfe8843637b62a763d17949965da6cb352937ac2ab0e3036d53e2639fd3d">Z</a> coordinate.") 152 FIELD(w, w, 1, "W coordinate.") 153END_IMPLEMENT_STRUCT; 154 155//----------------------------------------------------------------------------- 156// TypePoint2I 157//----------------------------------------------------------------------------- 158ConsoleType(Point2I, TypePoint2I, Point2I, "") 159ImplementConsoleTypeCasters( TypePoint2I, Point2I ) 160 161ConsoleGetType( TypePoint2I ) 162{ 163 Point2I *pt = (Point2I *) dptr; 164 static const U32 bufSize = 256; 165 char* returnBuffer = Con::getReturnBuffer(bufSize); 166 dSprintf(returnBuffer, bufSize, "%d %d", pt->x, pt->y); 167 return returnBuffer; 168} 169 170ConsoleSetType( TypePoint2I ) 171{ 172 if(argc == 1) 173 dSscanf(argv[0], "%d %d", &((Point2I *) dptr)->x, &((Point2I *) dptr)->y); 174 else if(argc == 2) 175 *((Point2I *) dptr) = Point2I(dAtoi(argv[0]), dAtoi(argv[1])); 176 else 177 Con::printf("Point2I must be set as { x, y } or \"x y\""); 178} 179 180//----------------------------------------------------------------------------- 181// TypePoint2F 182//----------------------------------------------------------------------------- 183ConsoleType(Point2F, TypePoint2F, Point2F, "") 184ImplementConsoleTypeCasters( TypePoint2F, Point2F ) 185 186ConsoleGetType( TypePoint2F ) 187{ 188 Point2F *pt = (Point2F *) dptr; 189 static const U32 bufSize = 256; 190 char* returnBuffer = Con::getReturnBuffer(bufSize); 191 dSprintf(returnBuffer, bufSize, "%g %g", pt->x, pt->y); 192 return returnBuffer; 193} 194 195ConsoleSetType( TypePoint2F ) 196{ 197 if(argc == 1) 198 dSscanf(argv[0], "%g %g", &((Point2F *) dptr)->x, &((Point2F *) dptr)->y); 199 else if(argc == 2) 200 *((Point2F *) dptr) = Point2F(dAtof(argv[0]), dAtof(argv[1])); 201 else 202 Con::printf("Point2F must be set as { x, y } or \"x y\""); 203} 204 205//----------------------------------------------------------------------------- 206// TypePoint3I 207//----------------------------------------------------------------------------- 208ConsoleType(Point3I, TypePoint3I, Point3I, "") 209ImplementConsoleTypeCasters(TypePoint3I, Point3I) 210 211ConsoleGetType( TypePoint3I ) 212{ 213 Point3I *pt = (Point3I *) dptr; 214 static const U32 bufSize = 256; 215 char* returnBuffer = Con::getReturnBuffer(bufSize); 216 dSprintf(returnBuffer, bufSize, "%d %d %d", pt->x, pt->y, pt->z); 217 return returnBuffer; 218} 219 220ConsoleSetType( TypePoint3I ) 221{ 222 if(argc == 1) 223 dSscanf(argv[0], "%d %d %d", &((Point3I *) dptr)->x, &((Point3I *) dptr)->y, &((Point3I *) dptr)->z); 224 else if(argc == 3) 225 *((Point3I *) dptr) = Point3I(dAtoi(argv[0]), dAtoi(argv[1]), dAtoi(argv[2])); 226 else 227 Con::printf("Point3I must be set as { x, y, z } or \"x y z\""); 228} 229 230//----------------------------------------------------------------------------- 231// TypePoint3F 232//----------------------------------------------------------------------------- 233ConsoleType(Point3F, TypePoint3F, Point3F, "") 234ImplementConsoleTypeCasters(TypePoint3F, Point3F) 235 236ConsoleGetType( TypePoint3F ) 237{ 238 Point3F *pt = (Point3F *) dptr; 239 static const U32 bufSize = 256; 240 char* returnBuffer = Con::getReturnBuffer(bufSize); 241 dSprintf(returnBuffer, bufSize, "%g %g %g", pt->x, pt->y, pt->z); 242 return returnBuffer; 243} 244 245ConsoleSetType( TypePoint3F ) 246{ 247 if(argc == 1) 248 dSscanf(argv[0], "%g %g %g", &((Point3F *) dptr)->x, &((Point3F *) dptr)->y, &((Point3F *) dptr)->z); 249 else if(argc == 3) 250 *((Point3F *) dptr) = Point3F(dAtof(argv[0]), dAtof(argv[1]), dAtof(argv[2])); 251 else 252 Con::printf("Point3F must be set as { x, y, z } or \"x y z\""); 253} 254 255//----------------------------------------------------------------------------- 256// TypePoint4F 257//----------------------------------------------------------------------------- 258ConsoleType(Point4F, TypePoint4F, Point4F, "") 259ImplementConsoleTypeCasters( TypePoint4F, Point4F ) 260 261ConsoleGetType( TypePoint4F ) 262{ 263 Point4F *pt = (Point4F *) dptr; 264 static const U32 bufSize = 256; 265 char* returnBuffer = Con::getReturnBuffer(bufSize); 266 dSprintf(returnBuffer, bufSize, "%g %g %g %g", pt->x, pt->y, pt->z, pt->w); 267 return returnBuffer; 268} 269 270ConsoleSetType( TypePoint4F ) 271{ 272 if(argc == 1) 273 dSscanf(argv[0], "%g %g %g %g", &((Point4F *) dptr)->x, &((Point4F *) dptr)->y, &((Point4F *) dptr)->z, &((Point4F *) dptr)->w); 274 else if(argc == 4) 275 *((Point4F *) dptr) = Point4F(dAtof(argv[0]), dAtof(argv[1]), dAtof(argv[2]), dAtof(argv[3])); 276 else 277 Con::printf("Point4F must be set as { x, y, z, w } or \"x y z w\""); 278} 279 280//----------------------------------------------------------------------------- 281// TypeRectI 282//----------------------------------------------------------------------------- 283ConsoleType(RectI, TypeRectI, RectI, "") 284ImplementConsoleTypeCasters( TypeRectI, RectI ) 285 286ConsoleGetType( TypeRectI ) 287{ 288 RectI *rect = (RectI *) dptr; 289 static const U32 bufSize = 256; 290 char* returnBuffer = Con::getReturnBuffer(bufSize); 291 dSprintf(returnBuffer, bufSize, "%d %d %d %d", rect->point.x, rect->point.y, 292 rect->extent.x, rect->extent.y); 293 return returnBuffer; 294} 295 296ConsoleSetType( TypeRectI ) 297{ 298 if(argc == 1) 299 dSscanf(argv[0], "%d %d %d %d", &((RectI *) dptr)->point.x, &((RectI *) dptr)->point.y, 300 &((RectI *) dptr)->extent.x, &((RectI *) dptr)->extent.y); 301 else if(argc == 4) 302 *((RectI *) dptr) = RectI(dAtoi(argv[0]), dAtoi(argv[1]), dAtoi(argv[2]), dAtoi(argv[3])); 303 else 304 Con::printf("RectI must be set as { x, y, w, h } or \"x y w h\""); 305} 306 307//----------------------------------------------------------------------------- 308// TypeRectF 309//----------------------------------------------------------------------------- 310ConsoleType(RectF, TypeRectF, RectF, "") 311ImplementConsoleTypeCasters( TypeRectF, RectF ) 312 313ConsoleGetType( TypeRectF ) 314{ 315 RectF *rect = (RectF *) dptr; 316 static const U32 bufSize = 256; 317 char* returnBuffer = Con::getReturnBuffer(bufSize); 318 dSprintf(returnBuffer, bufSize, "%g %g %g %g", rect->point.x, rect->point.y, 319 rect->extent.x, rect->extent.y); 320 return returnBuffer; 321} 322 323ConsoleSetType( TypeRectF ) 324{ 325 if(argc == 1) 326 dSscanf(argv[0], "%g %g %g %g", &((RectF *) dptr)->point.x, &((RectF *) dptr)->point.y, 327 &((RectF *) dptr)->extent.x, &((RectF *) dptr)->extent.y); 328 else if(argc == 4) 329 *((RectF *) dptr) = RectF(dAtof(argv[0]), dAtof(argv[1]), dAtof(argv[2]), dAtof(argv[3])); 330 else 331 Con::printf("RectF must be set as { x, y, w, h } or \"x y w h\""); 332} 333 334//----------------------------------------------------------------------------- 335// TypeMatrix 336//----------------------------------------------------------------------------- 337ConsoleType(MatrixF, TypeMatrixF, MatrixF, "") 338ImplementConsoleTypeCasters( TypeMatrixF, MatrixF ) 339 340// Oh merry confusion. Torque stores matrices in row-major order yet to TorqueScript 341// matrices were passed in column-major order, so we need to stick to this here. 342 343ConsoleGetType( TypeMatrixF ) 344{ 345 MatrixF* mat = ( MatrixF* ) dptr; 346 347 Point3F col0, col1, col2; 348 mat->getColumn(0, &col0); 349 mat->getColumn(1, &col1); 350 mat->getColumn(2, &col2); 351 static const U32 bufSize = 256; 352 char* returnBuffer = Con::getReturnBuffer(bufSize); 353 dSprintf(returnBuffer,bufSize,"%g %g %g %g %g %g %g %g %g", 354 col0.x, col0.y, col0.z, col1.x, col1.y, col1.z, col2.x, col2.y, col2.z); 355 return returnBuffer; 356} 357 358ConsoleSetType( TypeMatrixF ) 359{ 360 if( argc != 1 ) 361 { 362 Con::errorf( "MatrixF must be set as \"c0x c0y c0z c1x c1y c1z c2x c2y c2z\"" ); 363 return; 364 } 365 366 Point3F col0, col1, col2; 367 dSscanf( argv[ 0 ], "%g %g %g %g %g %g %g %g %g", 368 &col0.x, &col0.y, &col0.z, &col1.x, &col1.y, &col1.z, &col2.x, &col2.y, &col2.z ); 369 370 MatrixF* mat = ( MatrixF* ) dptr; 371 372 mat->setColumn( 0, col0 ); 373 mat->setColumn( 1, col1 ); 374 mat->setColumn( 2, col2 ); 375} 376 377//----------------------------------------------------------------------------- 378// TypeMatrixPosition 379//----------------------------------------------------------------------------- 380ConsoleMappedType(MatrixPosition, TypeMatrixPosition, Point3F, MatrixF, "") 381 382ConsoleGetType( TypeMatrixPosition ) 383{ 384 F32 *col = (F32 *) dptr + 3; 385 static const U32 bufSize = 256; 386 char* returnBuffer = Con::getReturnBuffer(bufSize); 387 if(col[12] == 1.f) 388 dSprintf(returnBuffer, bufSize, "%g %g %g", col[0], col[4], col[8]); 389 else 390 dSprintf(returnBuffer, bufSize, "%g %g %g %g", col[0], col[4], col[8], col[12]); 391 return returnBuffer; 392} 393 394ConsoleSetType( TypeMatrixPosition ) 395{ 396 F32 *col = ((F32 *) dptr) + 3; 397 if (argc == 1) 398 { 399 col[0] = col[4] = col[8] = 0.f; 400 col[12] = 1.f; 401 dSscanf(argv[0], "%g %g %g %g", &col[0], &col[4], &col[8], &col[12]); 402 } 403 else if (argc <= 4) 404 { 405 for (S32 i = 0; i < argc; i++) 406 col[i << 2] = dAtof(argv[i]); 407 } 408 else 409 Con::printf("Matrix position must be set as { x, y, z, w } or \"x y z w\""); 410} 411 412//----------------------------------------------------------------------------- 413// TypeMatrixRotation 414//----------------------------------------------------------------------------- 415ConsoleMappedType(MatrixRotation, TypeMatrixRotation, AngAxisF, MatrixF, "") 416 417ConsoleGetType( TypeMatrixRotation ) 418{ 419 AngAxisF aa(*(MatrixF *) dptr); 420 aa.axis.normalize(); 421 static const U32 bufSize = 256; 422 char* returnBuffer = Con::getReturnBuffer(bufSize); 423 dSprintf(returnBuffer,bufSize,"%g %g %g %g",aa.axis.x,aa.axis.y,aa.axis.z,mRadToDeg(aa.angle)); 424 return returnBuffer; 425} 426 427ConsoleSetType( TypeMatrixRotation ) 428{ 429 // DMM: Note that this will ONLY SET the ULeft 3x3 submatrix. 430 // 431 AngAxisF aa(Point3F(0,0,0),0); 432 if (argc == 1) 433 { 434 dSscanf(argv[0], "%g %g %g %g", &aa.axis.x, &aa.axis.y, &aa.axis.z, &aa.angle); 435 aa.angle = mDegToRad(aa.angle); 436 } 437 else if (argc == 4) 438 { 439 for (S32 i = 0; i < argc; i++) 440 ((F32*)&aa)[i] = dAtof(argv[i]); 441 aa.angle = mDegToRad(aa.angle); 442 } 443 else 444 Con::printf("Matrix rotation must be set as { x, y, z, angle } or \"x y z angle\""); 445 446 // 447 MatrixF temp; 448 aa.setMatrix(&temp); 449 450 F32* pDst = *(MatrixF *)dptr; 451 const F32* pSrc = temp; 452 for (U32 i = 0; i < 3; i++) 453 for (U32 j = 0; j < 3; j++) 454 pDst[i*4 + j] = pSrc[i*4 + j]; 455} 456 457//----------------------------------------------------------------------------- 458// TypeAngAxisF 459//----------------------------------------------------------------------------- 460ConsoleType(AngAxisF, TypeAngAxisF, AngAxisF, "") 461ImplementConsoleTypeCasters( TypeAngAxisF, AngAxisF ) 462 463ConsoleGetType( TypeAngAxisF ) 464{ 465 AngAxisF* aa = ( AngAxisF* ) dptr; 466 static const U32 bufSize = 256; 467 char* returnBuffer = Con::getReturnBuffer(bufSize); 468 dSprintf(returnBuffer,bufSize,"%g %g %g %g",aa->axis.x,aa->axis.y,aa->axis.z,mRadToDeg(aa->angle)); 469 return returnBuffer; 470} 471 472ConsoleSetType( TypeAngAxisF ) 473{ 474 // DMM: Note that this will ONLY SET the ULeft 3x3 submatrix. 475 // 476 AngAxisF* aa = ( AngAxisF* ) dptr; 477 if (argc == 1) 478 { 479 dSscanf(argv[0], "%g %g %g %g", &aa->axis.x, &aa->axis.y, &aa->axis.z, &aa->angle); 480 aa->angle = mDegToRad(aa->angle); 481 } 482 else if (argc == 4) 483 { 484 for (S32 i = 0; i < argc; i++) 485 ((F32*)&aa)[i] = dAtof(argv[i]); 486 aa->angle = mDegToRad(aa->angle); 487 } 488 else 489 Con::printf("AngAxisF must be set as { x, y, z, angle } or \"x y z angle\""); 490} 491 492 493//----------------------------------------------------------------------------- 494// TypeTransformF 495//----------------------------------------------------------------------------- 496 497const TransformF TransformF::Identity( Point3F::Zero, AngAxisF( Point3F( 0, 0, 1 ), 0) ); 498 499ConsoleType(TransformF, TypeTransformF, TransformF, "") 500ImplementConsoleTypeCasters( TypeTransformF, TransformF ) 501 502ConsoleGetType( TypeTransformF ) 503{ 504 TransformF* aa = ( TransformF* ) dptr; 505 static const U32 bufSize = 256; 506 char* returnBuffer = Con::getReturnBuffer(bufSize); 507 dSprintf( returnBuffer, bufSize, "%g %g %g %g %g %g %g", 508 aa->mPosition.x, aa->mPosition.y, aa->mPosition.z, 509 aa->mOrientation.axis.x, aa->mOrientation.axis.y, aa->mOrientation.axis.z, aa->mOrientation.angle ); 510 return returnBuffer; 511} 512 513ConsoleSetType( TypeTransformF ) 514{ 515 TransformF* aa = ( TransformF* ) dptr; 516 if( argc == 1 ) 517 { 518 U32 count = dSscanf( argv[ 0 ], "%g %g %g %g %g %g %g", 519 &aa->mPosition.x, &aa->mPosition.y, &aa->mPosition.z, 520 &aa->mOrientation.axis.x, &aa->mOrientation.axis.y, &aa->mOrientation.axis.z, &aa->mOrientation.angle ); 521 522 aa->mHasRotation = ( count == 7 ); 523 } 524 else if( argc == 7 ) 525 { 526 aa->mPosition.x = dAtof( argv[ 0 ] ); 527 aa->mPosition.y = dAtof( argv[ 1 ] ); 528 aa->mPosition.z = dAtof( argv[ 2 ] ); 529 aa->mOrientation.axis.x = dAtof( argv[ 3 ] ); 530 aa->mOrientation.axis.y = dAtof( argv[ 4 ] ); 531 aa->mOrientation.axis.z = dAtof( argv[ 5 ] ); 532 aa->mOrientation.angle = dAtof( argv[ 6 ] ); 533 } 534 else 535 Con::errorf( "TransformF must be set as { px, py, pz, x, y, z, angle } or \"px py pz x y z angle\""); 536} 537 538 539 540//----------------------------------------------------------------------------- 541// TypeBox3F 542//----------------------------------------------------------------------------- 543ConsoleType(Box3F, TypeBox3F, Box3F, "") 544ImplementConsoleTypeCasters( TypeBox3F, Box3F ) 545 546ConsoleGetType( TypeBox3F ) 547{ 548 const Box3F* pBox = (const Box3F*)dptr; 549 550 static const U32 bufSize = 256; 551 char* returnBuffer = Con::getReturnBuffer(bufSize); 552 dSprintf(returnBuffer, bufSize, "%g %g %g %g %g %g", 553 pBox->minExtents.x, pBox->minExtents.y, pBox->minExtents.z, 554 pBox->maxExtents.x, pBox->maxExtents.y, pBox->maxExtents.z); 555 556 return returnBuffer; 557} 558 559ConsoleSetType( TypeBox3F ) 560{ 561 Box3F* pDst = (Box3F*)dptr; 562 563 if (argc == 1) 564 { 565 U32 args = dSscanf(argv[0], "%g %g %g %g %g %g", 566 &pDst->minExtents.x, &pDst->minExtents.y, &pDst->minExtents.z, 567 &pDst->maxExtents.x, &pDst->maxExtents.y, &pDst->maxExtents.z); 568 AssertWarn(args == 6, "Warning, box probably not read properly"); 569 } 570 else 571 { 572 Con::printf("Box3F must be set as \"xMin yMin zMin xMax yMax zMax\""); 573 } 574} 575 576 577//----------------------------------------------------------------------------- 578// TypeEaseF 579//----------------------------------------------------------------------------- 580ConsoleType(EaseF, TypeEaseF, EaseF, "") 581ImplementConsoleTypeCasters( TypeEaseF, EaseF ) 582 583ConsoleGetType( TypeEaseF ) 584{ 585 const EaseF* pEase = (const EaseF*)dptr; 586 587 static const U32 bufSize = 256; 588 char* returnBuffer = Con::getReturnBuffer(bufSize); 589 dSprintf(returnBuffer, bufSize, "%d %d %g %g", 590 pEase->mDir, pEase->mType, pEase->mParam[0], pEase->mParam[1]); 591 592 return returnBuffer; 593} 594 595ConsoleSetType( TypeEaseF ) 596{ 597 EaseF* pDst = (EaseF*)dptr; 598 599 // defaults... 600 pDst->mParam[0] = -1.0f; 601 pDst->mParam[1] = -1.0f; 602 if (argc == 1) { 603 U32 args = dSscanf(argv[0], "%d %d %f %f", // the two params are optional and assumed -1 if not present... 604 &pDst->mDir, &pDst->mType, &pDst->mParam[0],&pDst->mParam[1]); 605 if( args < 2 ) 606 Con::warnf( "Warning, EaseF probably not read properly" ); 607 } else { 608 Con::printf("EaseF must be set as \"dir type [param0 param1]\""); 609 } 610} 611 612//----------------------------------------------------------------------------- 613// TypeRotationF 614//----------------------------------------------------------------------------- 615ConsoleType(RotationF, TypeRotationF, RotationF, "") 616ImplementConsoleTypeCasters( TypeRotationF, RotationF ) 617 618ConsoleGetType(TypeRotationF) 619{ 620 RotationF *pt = (RotationF *)dptr; 621 static const U32 bufSize = 256; 622 char* returnBuffer = Con::getReturnBuffer(bufSize); 623 624 EulerF out = pt->asEulerF(RotationF::Degrees); 625 dSprintf(returnBuffer, bufSize, "%g %g %g", out.x, out.y, out.z); 626 627 return returnBuffer; 628} 629 630ConsoleSetType(TypeRotationF) 631{ 632 if (argc == 1) 633 { 634 U32 elements = StringUnit::getUnitCount(argv[0], " \t\n"); 635 if (elements == 3) 636 { 637 EulerF in; 638 dSscanf(argv[0], "%g %g %g", &in.x, &in.y, &in.z); 639 ((RotationF *)dptr)->set(in, RotationF::Degrees); 640 } 641 else 642 { 643 AngAxisF in; 644 dSscanf(argv[0], "%g %g %g %g", &in.axis.x, &in.axis.y, &in.axis.z, &in.angle); 645 ((RotationF *)dptr)->set(in, RotationF::Degrees); 646 } 647 } 648 else if (argc == 3) 649 { 650 EulerF in(dAtof(argv[0]), dAtof(argv[1]), dAtof(argv[2])); 651 ((RotationF *)dptr)->set(in, RotationF::Degrees); 652 } 653 else if (argc == 4) 654 { 655 AngAxisF in(Point3F(dAtof(argv[0]), dAtof(argv[1]), dAtof(argv[2])), dAtof(argv[3])); 656 ((RotationF *)dptr)->set(in, RotationF::Degrees); 657 } 658 else 659 Con::printf("RotationF must be set as { x, y, z, w } or \"x y z w\""); 660} 661 662//----------------------------------------------------------------------------- 663 664DefineEngineFunction( VectorAdd, VectorF, ( VectorF a, VectorF b ),, 665 "Add two vectors.\n" 666 "@param a The first vector.\n" 667 "@param b The second vector.\n" 668 "@return The vector @a a + @a b.\n\n" 669 "@tsexample\n" 670 "//-----------------------------------------------------------------------------\n" 671 "//\n" 672 "// VectorAdd( %a, %b );\n" 673 "//\n" 674 "// The sum of vector a, (ax, ay, az), and vector b, (bx, by, bz) is:\n" 675 "//\n" 676 "// a + b = ( ax + bx, ay + by, az + bz )\n" 677 "//\n" 678 "//-----------------------------------------------------------------------------\n" 679 "%a = \"1 0 0\";\n" 680 "%b = \"0 1 0\";\n\n" 681 "// %r = \"( 1 + 0, 0 + 1, 0 + 0 )\";\n" 682 "// %r = \"1 1 0\";\n" 683 "%r = VectorAdd( %a, %b );\n" 684 "@endtsexample\n\n" 685 "@ingroup Vectors") 686{ 687 return a + b; 688} 689 690//----------------------------------------------------------------------------- 691 692DefineEngineFunction( VectorSub, VectorF, ( VectorF a, VectorF b ),, 693 "Subtract two vectors.\n" 694 "@param a The first vector.\n" 695 "@param b The second vector.\n" 696 "@return The vector @a a - @a b.\n\n" 697 "@tsexample\n" 698 "//-----------------------------------------------------------------------------\n" 699 "//\n" 700 "// VectorSub( %a, %b );\n" 701 "//\n" 702 "// The difference of vector a, (ax, ay, az), and vector b, (bx, by, bz) is:\n" 703 "//\n" 704 "// a - b = ( ax - bx, ay - by, az - bz )\n" 705 "//\n" 706 "//-----------------------------------------------------------------------------\n\n" 707 708 "%a = \"1 0 0\";\n" 709 "%b = \"0 1 0\";\n\n" 710 711 "// %r = \"( 1 - 0, 0 - 1, 0 - 0 )\";\n" 712 "// %r = \"1 -1 0\";\n" 713 "%r = VectorSub( %a, %b );\n" 714 "@endtsexample\n\n" 715 "@ingroup Vectors" ) 716{ 717 return a - b; 718} 719 720//----------------------------------------------------------------------------- 721 722DefineEngineFunction( VectorScale, VectorF, ( VectorF a, F32 scalar ),, 723 "Scales a vector by a scalar.\n" 724 "@param a The vector to scale.\n" 725 "@param scalar The scale factor.\n" 726 "@return The vector @a a * @a scalar.\n\n" 727 "@tsexample\n" 728 "//-----------------------------------------------------------------------------\n" 729 "//\n" 730 "// VectorScale( %a, %v );\n" 731 "//\n" 732 "// Scaling vector a, (ax, ay, az), but the scalar, v, is:\n" 733 "//\n" 734 "// a * v = ( ax * v, ay * v, az * v )\n" 735 "//\n" 736 "//-----------------------------------------------------------------------------\n\n" 737 738 "%a = \"1 1 0\";\n" 739 "%v = \"2\";\n\n" 740 741 "// %r = \"( 1 * 2, 1 * 2, 0 * 2 )\";\n" 742 "// %r = \"2 2 0\";\n" 743 "%r = VectorScale( %a, %v );\n" 744 "@endtsexample\n\n" 745 "@ingroup Vectors" ) 746{ 747 return a * scalar; 748} 749DefineEngineFunction( VectorMul, VectorF, ( VectorF a, VectorF b ),, 750 "Multiplies two vectors.\n" 751 "@param a The first vector.\n" 752 "@param b The second vector.\n" 753 "@return The vector @a a * @a b.\n\n" 754 "@tsexample\n" 755 "//-----------------------------------------------------------------------------\n" 756 "//\n" 757 "// VectorMul( %a, %b );\n" 758 "//\n" 759 "// The multiplication of vector a, (ax, ay, az), and vector b, (bx, by, bz) is:\n" 760 "//\n" 761 "// a * b = ( ax * bx, ay * by, az * bz )\n" 762 "//\n" 763 "//-----------------------------------------------------------------------------\n\n" 764 765 "%a = \"1 0 0\";\n" 766 "%b = \"0 1 0\";\n\n" 767 768 "// %r = \"( 1 * 0, 0 * 1, 0 * 0 )\";\n" 769 "// %r = \"0 0 0\";\n" 770 "%r = VectorMul( %a, %b );\n" 771 "@endtsexample\n\n" 772 "@ingroup Vectors" ) 773{ 774 return a * b; 775} 776 777DefineEngineFunction( VectorDiv, VectorF, ( VectorF a, VectorF b ),, 778 "Divide two vectors.\n" 779 "@param a The first vector.\n" 780 "@param b The second vector.\n" 781 "@return The vector @a a / @a b.\n\n" 782 "@tsexample\n" 783 "//-----------------------------------------------------------------------------\n" 784 "//\n" 785 "// VectorDiv( %a, %b );\n" 786 "//\n" 787 "// The division of vector a, (ax, ay, az), and vector b, (bx, by, bz) is:\n" 788 "//\n" 789 "// a * b = ( ax / bx, ay / by, az / bz )\n" 790 "//\n" 791 "//-----------------------------------------------------------------------------\n\n" 792 793 "%a = \"1 1 1\";\n" 794 "%b = \"2 2 2\";\n\n" 795 796 "// %r = \"( 1 / 2, 1 / 2, 1 / 2 )\";\n" 797 "// %r = \"0.5 0.5 0.5\";\n" 798 "%r = VectorDiv( %a, %b );\n" 799 "@endtsexample\n\n" 800 "@ingroup Vectors" ) 801{ 802 //this is kind of bad, but so is dividing by 0 803 if(b.x == 0) b.x = 0.000001f; 804 if(b.y == 0) b.y = 0.000001f; 805 if(b.z == 0) b.z = 0.000001f; 806 807 return a / b; 808} 809 810//----------------------------------------------------------------------------- 811 812DefineEngineFunction( VectorNormalize, VectorF, ( VectorF v ),, 813 "Brings a vector into its unit form, i.e. such that it has the magnitute 1.\n" 814 "@param v The vector to normalize.\n" 815 "@return The vector @a v scaled to length 1.\n\n" 816 "@tsexample\n" 817 "//-----------------------------------------------------------------------------\n" 818 "//\n" 819 "// VectorNormalize( %a );\n" 820 "//\n" 821 "// The normalized vector a, (ax, ay, az), is:\n" 822 "//\n" 823 "// a^ = a / ||a||\n" 824 "// = ( ax / ||a||, ay / ||a||, az / ||a|| )\n" 825 "//\n" 826 "//-----------------------------------------------------------------------------\n\n" 827 828 "%a = \"1 1 0\";\n" 829 "%l = 1.414;\n\n" 830 831 "// %r = \"( 1 / 1.141, 1 / 1.141, 0 / 1.141 )\";\n" 832 "// %r = \"0.707 0.707 0\";\n" 833 "%r = VectorNormalize( %a );\n" 834 "@endtsexample\n\n" 835 "@ingroup Vectors" ) 836{ 837 VectorF n( v ); 838 n.normalizeSafe(); 839 return n; 840} 841 842//----------------------------------------------------------------------------- 843 844DefineEngineFunction( VectorDot, F32, ( VectorF a, VectorF b ),, 845 "Compute the dot product of two vectors.\n" 846 "@param a The first vector.\n" 847 "@param b The second vector.\n" 848 "@return The dot product @a a * @a b.\n\n" 849 "@tsexample\n" 850 "//-----------------------------------------------------------------------------\n" 851 "//\n" 852 "// VectorDot( %a, %b );\n" 853 "//\n" 854 "// The dot product between vector a, (ax, ay, az), and vector b, (bx, by, bz), is:\n" 855 "//\n" 856 "// a . b = ( ax * bx + ay * by + az * bz )\n" 857 "//\n" 858 "//-----------------------------------------------------------------------------\n\n" 859 860 "%a = \"1 1 0\";\n" 861 "%b = \"2 0 1\";\n\n" 862 863 "// %r = \"( 1 * 2 + 1 * 0 + 0 * 1 )\";\n" 864 "// %r = 2;\n" 865 "%r = VectorDot( %a, %b );\n" 866 "@endtsexample\n\n" 867 "@ingroup Vectors" ) 868{ 869 return mDot( a, b ); 870} 871 872//----------------------------------------------------------------------------- 873 874DefineEngineFunction( VectorCross, VectorF, ( VectorF a, VectorF b ),, 875 "Calculcate the cross product of two vectors.\n" 876 "@param a The first vector.\n" 877 "@param b The second vector.\n" 878 "@return The cross product @a x @a b.\n\n" 879 "@tsexample\n" 880 "//-----------------------------------------------------------------------------\n" 881 "//\n" 882 "// VectorCross( %a, %b );\n" 883 "//\n" 884 "// The cross product of vector a, (ax, ay, az), and vector b, (bx, by, bz), is\n" 885 "//\n" 886 "// a x b = ( ( ay * bz ) - ( az * by ), ( az * bx ) - ( ax * bz ), ( ax * by ) - ( ay * bx ) )\n" 887 "//\n" 888 "//-----------------------------------------------------------------------------\n\n" 889 890 "%a = \"1 1 0\";\n" 891 "%b = \"2 0 1\";\n\n" 892 893 "// %r = \"( ( 1 * 1 ) - ( 0 * 0 ), ( 0 * 2 ) - ( 1 * 1 ), ( 1 * 0 ) - ( 1 * 2 ) )\";\n" 894 "// %r = \"1 -1 -2\";\n" 895 "%r = VectorCross( %a, %b );\n" 896 "@endtsexample\n\n" 897 "@ingroup Vectors" ) 898{ 899 VectorF v; 900 mCross( a, b, &v ); 901 return v; 902} 903 904//----------------------------------------------------------------------------- 905 906DefineEngineFunction( VectorDist, F32, ( VectorF a, VectorF b ),, 907 "Compute the distance between two vectors.\n" 908 "@param a The first vector.\n" 909 "@param b The second vector.\n" 910 "@return The length( @a b - @a a ).\n\n" 911 "@tsexample\n" 912 "//-----------------------------------------------------------------------------\n" 913 "//\n" 914 "// VectorDist( %a, %b );\n" 915 "//\n" 916 "// The distance between vector a, (ax, ay, az), and vector b, (bx, by, bz), is\n" 917 "//\n" 918 "// a -> b = ||( b - a )||\n" 919 "// = ||( bx - ax, by - ay, bz - az )||\n" 920 "// = mSqrt( ( bx - ax ) * ( bx - ax ) + ( by - ay ) * ( by - ay ) + ( bz - az ) * ( bz - az ) )\n" 921 "//\n" 922 "//-----------------------------------------------------------------------------\n\n" 923 924 "%a = \"1 1 0\";\n" 925 "%b = \"2 0 1\";\n\n" 926 927 "// %r = mSqrt( ( 2 - 1 ) * ( 2 - 1) + ( 0 - 1 ) * ( 0 - 1 ) + ( 1 - 0 ) * ( 1 - 0 ) );\n" 928 "// %r = mSqrt( 3 );\n" 929 "%r = VectorDist( %a, %b );\n" 930 "@endtsexample\n\n" 931 "@ingroup Vectors" ) 932{ 933 VectorF v = b - a; 934 return v.len(); 935} 936 937//----------------------------------------------------------------------------- 938 939DefineEngineFunction( VectorMidPoint, VectorF, ( VectorF a, VectorF b ),, 940 "Gets the midpoint between the two vectors.\n" 941 "@param a The first vector.\n" 942 "@param b The second vector.\n" 943 "@return The vector (@a a + @a b) / 2.\n\n" 944 "@tsexample\n" 945 "//-----------------------------------------------------------------------------\n" 946 "//\n" 947 "// VectorMidPoint( %a, %b );\n" 948 "//\n" 949 "// The midpoint of vector a, (ax, ay, az), and vector b, (bx, by, bz) is:\n" 950 "//\n" 951 "// (a + b)/2 = ( (ax + bx) /2, ay + by) /2, (az + bz) /2 )\n" 952 "//\n" 953 "//-----------------------------------------------------------------------------\n" 954// "%a = \"1 0 0\";\n" 955// "%b = \"0 1 0\";\n\n" 956// "// %r = \"( 1 + 0, 0 + 1, 0 + 0 )\";\n" 957// "// %r = \"1 1 0\";\n" 958// "%r = VectorAdd( %a, %b );\n" 959 "@endtsexample\n\n" 960 "@ingroup Vectors") 961{ 962 return (a + b)/2.0f; 963} 964 965//----------------------------------------------------------------------------- 966 967DefineEngineFunction( VectorLen, F32, ( VectorF v ),, 968 "Calculate the magnitude of the given vector.\n" 969 "@param v A vector.\n" 970 "@return The length of vector @a v.\n\n" 971 "@tsexample\n" 972 "//-----------------------------------------------------------------------------\n" 973 "//\n" 974 "// VectorLen( %a );\n" 975 "//\n" 976 "// The length or magnitude of vector a, (ax, ay, az), is:\n" 977 "//\n" 978 "// ||a|| = Sqrt( ax * ax + ay * ay + az * az )\n" 979 "//\n" 980 "//-----------------------------------------------------------------------------\n\n" 981 982 "%a = \"1 1 0\";\n\n" 983 984 "// %r = mSqrt( 1 * 1 + 1 * 1 + 0 * 0 );\n" 985 "// %r = mSqrt( 2 );\n" 986 "// %r = 1.414;\n" 987 "%r = VectorLen( %a );\n" 988 "@endtsexample\n\n" 989 "@ingroup Vectors" ) 990{ 991 return v.len(); 992} 993 994//----------------------------------------------------------------------------- 995 996DefineEngineFunction( VectorOrthoBasis, MatrixF, ( AngAxisF aa ),, 997 "Create an orthogonal basis from the given vector.\n" 998 "@param aaf The vector to create the orthogonal basis from.\n" 999 "@return A matrix representing the orthogonal basis.\n" 1000 "@ingroup Vectors" ) 1001{ 1002 MatrixF mat; 1003 aa.setMatrix(&mat); 1004 return mat; 1005} 1006 1007//----------------------------------------------------------------------------- 1008 1009//ConsoleFunction(VectorRot, const char*, 3, 3, "(Vector3F, float) rotate a vector in 2d") 1010DefineEngineFunction( VectorRot, const char*, (Point3F v, F32 angle), , "(Vector3F, float) rotate a vector in 2d") 1011{ 1012 //VectorF v(0,0,0); 1013 //dSscanf(argv[1],"%g %g %g",&v.x,&v.y,&v.z); 1014 //dSscanf(axeStr,"%g %g %g",&v.x,&v.y,&v.z); 1015 1016 //float angle = dAtof(argv[2]); 1017 //float angle = dAtof(angleStr); 1018 1019 float x = 0, y = 0; 1020 1021 x = v.x * cos(angle) - v.y * sin(angle); 1022 y = v.x * sin(angle) + v.y * cos(angle); 1023 1024 char* returnBuffer = Con::getReturnBuffer(256); 1025 dSprintf(returnBuffer,256,"%g %g %g", x, y, v.z); 1026 return returnBuffer; 1027} 1028 1029DefineEngineFunction( VectorLerp, VectorF, ( VectorF a, VectorF b, F32 t ),, 1030 "Linearly interpolate between two vectors by @a t.\n" 1031 "@param a Vector to start interpolation from.\n" 1032 "@param b Vector to interpolate to.\n" 1033 "@param t Interpolation factor (0-1). At zero, @a a is returned and at one, @a b is returned. In between, an interpolated vector " 1034 "between @a a and @a b is returned.\n" 1035 "@return An interpolated vector between @a a and @a b.\n\n" 1036 "@tsexample\n" 1037 "//-----------------------------------------------------------------------------\n" 1038 "//\n" 1039 "// VectorLerp( %a, %b );\n" 1040 "//\n" 1041 "// The point between vector a, (ax, ay, az), and vector b, (bx, by, bz), which is\n" 1042 "// weighted by the interpolation factor, t, is\n" 1043 "//\n" 1044 "// r = a + t * ( b - a )\n" 1045 "// = ( ax + t * ( bx - ax ), ay + t * ( by - ay ), az + t * ( bz - az ) )\n" 1046 "//\n" 1047 "//-----------------------------------------------------------------------------\n\n" 1048 1049 "%a = \"1 1 0\";\n" 1050 "%b = \"2 0 1\";\n" 1051 "%v = \"0.25\";\n\n" 1052 1053 "// %r = \"( 1 + 0.25 * ( 2 - 1 ), 1 + 0.25 * ( 0 - 1 ), 0 + 0.25 * ( 1 - 0 ) )\";\n" 1054 "// %r = \"1.25 0.75 0.25\";\n" 1055 "%r = VectorLerp( %a, %b );\n" 1056 "@endtsexample\n\n" 1057 "@ingroup Vectors" ) 1058{ 1059 VectorF c; 1060 c.interpolate( a, b, t ); 1061 1062 return c; 1063} 1064 1065DefineEngineFunction(VectorReflect, VectorF, (VectorF vec, VectorF normal), , 1066 "Compute the reflection of a vector based on a normal.\n" 1067 "@param a The vector.\n" 1068 "@param b The normal.\n" 1069 "@return The reflected vector.\n\n" 1070 "@ingroup Vectors") 1071{ 1072 normal.normalize(); 1073 1074 return MathUtils::reflect(vec, normal); 1075} 1076 1077//----------------------------------------------------------------------------- 1078 1079DefineEngineFunction( MatrixCreate, TransformF, ( VectorF position, AngAxisF orientation ),, 1080 "Create a transform from the given translation and orientation.\n" 1081 "@param position The translation vector for the transform.\n" 1082 "@param orientation The axis and rotation that orients the transform.\n" 1083 "@return A transform based on the given position and orientation.\n" 1084 "@ingroup Matrices" ) 1085{ 1086 TransformF transform( position, orientation ); 1087 return transform; 1088} 1089 1090//----------------------------------------------------------------------------- 1091 1092DefineEngineFunction( MatrixCreateFromEuler, TransformF, ( Point3F angles ),, 1093 "@Create a matrix from the given rotations.\n\n" 1094 "@param Vector3F X, Y, and Z rotation in *radians*.\n" 1095 "@return A transform based on the given orientation.\n" 1096 "@ingroup Matrices" ) 1097{ 1098 QuatF rotQ( angles ); 1099 AngAxisF aa; 1100 aa.set(rotQ); 1101 1102 return TransformF( Point3F::Zero, aa ); 1103} 1104 1105//----------------------------------------------------------------------------- 1106 1107DefineEngineFunction( MatrixMultiply, TransformF, ( TransformF left, TransformF right ),, 1108 "@brief Multiply the two matrices.\n\n" 1109 "@param left First transform.\n" 1110 "@param right Right transform.\n" 1111 "@return Concatenation of the two transforms.\n" 1112 "@ingroup Matrices" ) 1113{ 1114 MatrixF m1 = left.getMatrix(); 1115 MatrixF m2 = right.getMatrix(); 1116 1117 m1.mul( m2 ); 1118 1119 return TransformF( m1 ); 1120} 1121 1122//----------------------------------------------------------------------------- 1123 1124DefineEngineFunction( MatrixMulVector, VectorF, ( TransformF transform, VectorF vector ),, 1125 "@brief Multiply the vector by the transform assuming that w=0.\n\n" 1126 "This function will multiply the given vector by the given transform such that translation will " 1127 "not affect the vector.\n\n" 1128 "@param transform A transform.\n" 1129 "@param vector A vector.\n" 1130 "@return The transformed vector.\n" 1131 "@ingroup Matrices") 1132{ 1133 MatrixF m = transform.getMatrix(); 1134 m.mulV( vector ); 1135 return vector; 1136} 1137 1138//----------------------------------------------------------------------------- 1139 1140DefineEngineFunction( MatrixMulPoint, Point3F, ( TransformF transform, Point3F point ),, 1141 "@brief Multiply the given point by the given transform assuming that w=1.\n\n" 1142 "This function will multiply the given vector such that translation with take effect.\n" 1143 "@param transform A transform.\n" 1144 "@param point A vector.\n" 1145 "@return The transformed vector.\n" 1146 "@ingroup Matrices") 1147{ 1148 MatrixF m = transform.getMatrix(); 1149 m.mulP( point ); 1150 return point; 1151} 1152 1153ConsoleFunctionGroupEnd(MatrixMath); 1154 1155//------------------------------------------------------------------------------ 1156 1157DefineEngineFunction( getBoxCenter, Point3F, ( Box3F box ),, 1158 "Get the center point of an axis-aligned box.\n\n" 1159 "@param b A Box3F, in string format using \"minExtentX minExtentY minExtentZ maxExtentX maxExtentY maxExtentZ\"\n" 1160 "@return Center of the box.\n" 1161 "@ingroup Math") 1162{ 1163 return box.getCenter(); 1164} 1165 1166//------------------------------------------------------------------------------ 1167 1168DefineEngineFunction( setRandomSeed, void, ( S32 seed ), ( -1 ), 1169 "Set the current seed for the random number generator.\n" 1170 "Based on this seed, a repeatable sequence of numbers will be produced by getRandom().\n" 1171 "@param seed The seed with which to initialize the randon number generator with. The same seed will always leed to" 1172 "the same sequence of pseudo-random numbers.\n" 1173 "If -1, the current timestamp will be used as the seed which is a good basis for randomization.\n" 1174 "@ingroup Random" ) 1175{ 1176 if( seed == -1 ) 1177 seed = Platform::getRealMilliseconds(); 1178 1179 MRandomLCG::setGlobalRandSeed( seed ); 1180} 1181 1182//------------------------------------------------------------------------------ 1183 1184DefineEngineFunction( getRandomSeed, S32, (),, 1185 "Get the current seed used by the random number generator.\n" 1186 "@return The current random number generator seed value.\n" 1187 "@ingroup Random" ) 1188{ 1189 return gRandGen.getSeed(); 1190} 1191 1192//------------------------------------------------------------------------------ 1193 1194S32 mRandI(S32 i1, S32 i2) 1195{ 1196 return gRandGen.randI(i1, i2); 1197} 1198 1199F32 mRandF(F32 f1, F32 f2) 1200{ 1201 return gRandGen.randF(f1, f2); 1202} 1203 1204F32 mRandF() 1205{ 1206 return gRandGen.randF(); 1207} 1208 1209DefineEngineFunction(getRandom, F32, (S32 a, S32 b), (S32_MAX, S32_MAX), 1210 "( int a, int b ) " 1211 "@brief Returns a random number based on parameters passed in..\n\n" 1212 "If no parameters are passed in, getRandom() will return a float between 0.0 and 1.0. If one " 1213 "parameter is passed an integer between 0 and the passed in value will be returned. Two parameters will " 1214 "return an integer between the specified numbers.\n\n" 1215 "@param a If this is the only parameter, a number between 0 and a is returned. Elsewise represents the lower bound.\n" 1216 "@param b Upper bound on the random number. The random number will be <= @a b.\n" 1217 "@return A pseudo-random integer between @a a and @a b, between 0 and a, or a " 1218 "float between 0.0 and 1.1 depending on usage.\n\n" 1219 "@note All parameters are optional." 1220 "@see setRandomSeed\n" 1221 "@ingroup Random" ) 1222{ 1223 if (a != S32_MAX) 1224 { 1225 if (b == S32_MAX) 1226 return F32(gRandGen.randI(0, getMax(a, 0))); 1227 else 1228 { 1229 S32 min = a; 1230 S32 max = b; 1231 if (min > max) 1232 { 1233 S32 t = min; 1234 min = max; 1235 max = t; 1236 } 1237 return F32(gRandGen.randI(min, max)); 1238 } 1239 } 1240 return gRandGen.randF(); 1241} 1242 1243//------------------------------------------------------------------------------ 1244