linearMath -
codectile - 31.05.2015
linearMath
Introduction
Linear mathematics plugin for sa-mp. This plugin is based upon Bullet's LinearMath library, to provide fast and efficient vector as well as quaternion math calculations. It completely utilizes,
Single
Instruction,
Multiple
Data (
SIMD) method of parallel computing which makes it fast as well as efficient.
Functions
Code:
//vectors
native AddVectors(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, &Float:x, &Float:y, &Float:z);
native Float:DotProduct(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2);
native CrossProduct(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, &Float:x, &Float:y, &Float:z);
native Float:GetVectorAngle(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2);
native Float:GetDistance(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2);
native Float:GetMagnitude(Float:x, Float:y, Float:z);
native GetNormalized(Float:x, Float:y, Float:z , &Float:nx, &Float:ny, &Float:nz);
native GetClosestAxis(Float:x, Float:y, Float:z);
native GetFurthestAxis(Float:x, Float:y, Float:z);
native RotateVector(Float:x, Float:y, Float:z, Float:ax, Float:ay, Float:az, Float:angle, &Float:rx, &Float:ry, &Float:rz);
native GetReflectedVector(Float:x, Float:y, Float:z, Float:nx, Float:ny, Float:nz, &Float:rx, &Float:ry, &Float:rz);
//quaternions
native Float:GetQuaternionAngle(Float:x, Float:y, Float:z, Float:w);
native GetAxisOfRotation(Float:x, Float:y, Float:z, Float:w, &Float:x1, &Float:y1, &Float:z1);
native Float:DotProductQuaternion(Float:x1, Float:y1, Float:z1, Float:w1, Float:x2, Float:y2, Float:z2, Float:w2);
native Float:GetQuaternionMagnitude(Float:x, Float:y, Float:z, Float:w);
native Float:GetInverseQuaternion(Float:x, Float:y, Float:z, Float:w, &Float:ix, &Float:iy, &Float:iz, &Float:iw);
Documentation and Download
https://github.com/codectile/linearMath
Note: Now there is a support for Linux systems. But the .so library won't be updated, to use the updated library, compile it your favorable OS.
Re: linearMath -
iWhite - 31.05.2015
Could you give me an example, where I could use this? Because I think you don't need these kind of math plugins to create a good server.
Re: linearMath -
codectile - 31.05.2015
@iWhite: If you cannot find any use of this, that's good but that does not means that other community members will not find it useful
.
AW: linearMath -
BigETI - 31.05.2015
The code in "core.cpp" could have been written inside "linear.cpp", because you do not need to declare functions to use them just once.
Also some functions and declarations/definitions from "core.h" can be then written inside "linear.cpp", so you would only have left "#include <header file>"s there. By the way there is no "./LinearMath/" path in your repository.
Re: linearMath -
codectile - 31.05.2015
@BigETI: I forgot to mention that I am quite new to c/c++ as well as plugin development. I'll look into this.
EDIT: Cleaned up.
Re: linearMath -
Ritzy2K - 31.05.2015
well, it can be used to script speed boost? tho there's already ways...but this can be with direction?
ill check this out at night...
m studying, sneaked out here :3
Re: linearMath -
codectile - 03.06.2015
@[ND]xXZeusXx.: If you want to script a speed boost feature then you are good to go. The main purpose of this plugin is to provide fast and efficient mathematical calculations by making use of parallel computing.
Re: linearMath -
Crayder - 04.06.2015
Nice use of the bullet library, I think you should continue porting bullet functions in this plugin. Bullet physics has so many uses that could be VERY helpful in SA-MP development. This 'linearMath' plugin alone is plentiful for many things yes, and I am not complaining. I'd like to see some physics calculations added to this such as trajectory path function, reflections, and more. Bullet physics is meant for these type of uses!
Re: linearMath -
codectile - 04.06.2015
I already thought of it. But, it will not be implemented into this plugin.
Re: linearMath -
Rancho - 04.06.2015
Linux version; look attachment.
Also requested merge pull.
Re: linearMath -
codectile - 04.06.2015
Thank you.
Re: linearMath -
denNorske - 13.06.2015
This looks like a promising plugin; I'll have a closer look and test it out on my server for some race stuff
Thumbs up for you! ^^
Re: linearMath -
Dat - 17.06.2015
Cool Bro