Thread: [Include] 3DTryg Functions
View Single Post
Old 05/06/2016, 08:23 PM   #21
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: Get Point In Front 2D 3D

Updated 3DTryg.inc to v2.5 now

Fixed GetVehicleRotation thanks for IllidanS4
PHP Code:
GetVehicleRotation(vehicleid,&Float:rx,&Float:ry,&Float:rz); 
Added new function:
PHP Code:
Float:GetPointInFrontOfVehicle2D(vehicleid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfVehicle3D(vehicleid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);

Float:GetPointInFrontOfPlayer(playerid,&Float:tx,&Float:ty,Float:radius); //GetXYInFrontOfPlayer
 
Float:GetPointInFrontOfCamera2D(playerid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfCamera3D(playerid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);

Float:GetPlayerTargetAngle(playerid,Float:x,Float:y,&Float:rz=0.0);
Float:SetPlayerTargetAngle(playerid,Float:x,Float:y,&Float:rz=0.0);

GetPlayerCameraRotation(playerid,&Float:rx,&Float:rz);
Float:GetPlayerCameraZAngle(playerid,&Float:rz=0.0);

GetPointInFrontOnGround(Float:x,Float:y,Float:z,Float:rx,Float:rz,&Float:tx,&Float:ty,&Float:tz,Float:max_distance);

bool:IsPointInCylinder(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:maxdist);

bool:IsProbable(chance); 
Completed functions:
PHP Code:
GetGroundRotation(Float:x,Float:y,Float:size,&Float:rx,&Float:ry); 
Optimized functions:
PHP Code:
NLTZ(value);
NMTZ(value);
Float:NLTZF(Float:value);
Float:NMTZF(Float:value);

Float:ShiftDegreeToRadian(Float:deg);
Float:ShiftDegreeToRadianEx(Float:deg);
Float:ShiftDegreeToGrades(Float:deg);
Float:ShiftRadianToDegree(Float:rad);
Float:ShiftRadianToDegreeEx(Float:rad);
Float:ShiftRadianToGrades(Float:rad);
Float:ShiftGradesToDegree(Float:grad);
Float:ShiftGradesToRadian(Float:grad);

ShiftRotationToVector(Float:rx,Float:rz,&Float:vx,&Float:vy,&Float:vz);

GetRotationFor2Point2D(Float:x,Float:y,Float:tx,Float:ty,&Float:rz);

Float:GetDistanceBetweenPoints1D(Float:x1,Float:x2);
Float:GetDistanceBetweenPoints2D(Float:x1,Float:y1,Float:x2,Float:y2);
Float:GetDistanceBetweenPoints3D(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2);

Float:sqrtN(Float:value,Float:exponent); 
All functions:
PHP Code:
Float:sqrtN(Float:value,Float:exponent);
abs(value);
power(value,Float:exponent);
Float:ctg(Float:value,anglemode:mode=radian);
Float:secans(Float:value,anglemode:mode=radian);
Float:cosecans(Float:value,anglemode:mode=radian);
single_clock(max,id);
even_clock(max,id);
uneven_clock(max,id);
IsEven(value);
GetRandomHit(Float:x,Float:y,Float:z,range,&Float:tx,&Float:ty,&Float:tz);
Float:GetDistanceBetweenPoints1D(Float:x1,Float:x2);
Float:GetDistanceBetweenPoints2D(Float:x1,Float:y1,Float:x2,Float:y2);
Float:GetDistanceBetweenPoints3D(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2);
NLTZ(value);
NMTZ(value);
Float:NLTZF(Float:value);
Float:NMTZF(Float:value);
CompRotation(rotation,&cr=0);
Float:CompRotationFloat(Float:rotation,&Float:cr=0.0);
GetPointInFront2D(Float:x,Float:y,Float:rz,Float:radius,&Float:tx,&Float:ty);
Float:GetPointInFrontOfPlayer(playerid,&Float:tx,&Float:ty,Float:radius);
Float:GetPointInFrontOfCamera2D(playerid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfCamera3D(playerid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);
GetPointInFront3D(Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,&Float:tx,&Float:ty,&Float:tz);
GetRotationFor2Point2D(Float:x,Float:y,Float:tx,Float:ty,&Float:rz);
GetRotationFor2Point3D(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,&Float:rx,&Float:rz);
GetRandomClockPos(Float:x,Float:y,Float:z,Float:radius,&Float:tx,&Float:ty,&Float:tz,&Float:trz,Float:rz = -1000.0);
GetRandomPointInCube(Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz,&Float:x,&Float:y,&Float:z);
Float:ShiftDegreeToRadian(Float:deg);
Float:ShiftDegreeToRadianEx(Float:deg);
Float:ShiftDegreeToGrades(Float:deg);
Float:ShiftRadianToDegree(Float:rad);
Float:ShiftRadianToDegreeEx(Float:rad);
Float:ShiftRadianToGrades(Float:rad);
Float:ShiftGradesToDegree(Float:grad);
Float:ShiftGradesToRadian(Float:grad);
ConvertMTARaceRotation(Float:rotation1,Float:rotation2,Float:rotation3,&Float:rx,&Float:ry,&Float:rz);
ConvertToMTARaceRotation(Float:rx,Float:ry,Float:rz,&Float:rotation1,&Float:rotation2,&Float:rotation3);
GetMoveTime(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,Float:speed,&rtime);
Float:GetSpeedForMoveTime(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,&Float:speed,rtime);
GetVehicleRotation(vehicleid,&Float:rx,&Float:ry,&Float:rz);
Float:GetPointInFrontOfVehicle2D(vehicleid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfVehicle3D(vehicleid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);
GetPlayerCameraRotation(playerid,&Float:rx,&Float:rz);
Float:GetPlayerCameraZAngle(playerid,&Float:rz=0.0);
GetPointFor2Point2D(Float:x1,Float:y1,Float:x2,Float:y2,Float:percent_size,&Float:tx,&Float:ty);
GetPointFor2Point3D(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2,Float:percent_size,&Float:tx,&Float:ty,&Float:tz);
ShiftVectorToRotation(Float:vx,Float:vy,Float:vz,&Float:rx,&Float:rz);
ShiftRotationToVector(Float:rx,Float:rz,&Float:vx,&Float:vy,&Float:vz);
bool:IsPointBetween2Points2D(Float:px,Float:py,Float:xA,Float:yA,Float:xB,Float:yB);
bool:IsPointBetween2Points3D(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB);
bool:IsPointNearly2Points2D(Float:px,Float:py,Float:xA,Float:yA,Float:xB,Float:yB,Float:maxdist);
bool:IsPointNearly2Points3D(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:maxdist);
bool:IsPointInCylinder(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:maxdist);
bool:IsProbable(chance);
GetGroundRotation(Float:x,Float:y,Float:size,&Float:rx,&Float:ry);
GetPointInFrontOnGround(Float:x,Float:y,Float:z,Float:rx,Float:rz,&Float:tx,&Float:ty,&Float:tz,Float:max_distance);
Float:GetPlayerTargetAngle(playerid,Float:x,Float:y,&Float:rz=0.0);
Float:SetPlayerTargetAngle(playerid,Float:x,Float:y,&Float:rz=0.0);

Deprecated Functions:
GetXYInFrontOfPlayer -> GetPointInFrontOfPlayer
GetPointInFront
-> GetPointInFront3D
GetPointInFrontOfCamera
-> GetPointInFrontOfCamera3D
GetDistanceBetweenPoints 
-> GetDistanceBetweenPoints3D

Old prototype
:
GetAngle -> GetPlayerTargetAngle SetPlayerTargetAngle GetRotationFor2Point2D 

Last edited by AbyssMorgan; 05/06/2016 at 08:54 PM. Reason: Update 2.5B
AbyssMorgan is offline   Reply With Quote