Some math improvements.
This commit is contained in:
@@ -894,7 +894,7 @@ public class L2CharacterAI extends AbstractAI
|
|||||||
final double dx = worldPosition.getX() - x;
|
final double dx = worldPosition.getX() - x;
|
||||||
final double dy = worldPosition.getY() - y;
|
final double dy = worldPosition.getY() - y;
|
||||||
|
|
||||||
double dist = Math.sqrt((dx * dx) + (dy * dy));
|
double dist = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final double sin = dy / dist;
|
final double sin = dy / dist;
|
||||||
final double cos = dx / dist;
|
final double cos = dx / dist;
|
||||||
|
|||||||
@@ -177,20 +177,14 @@ public class BoatManager
|
|||||||
{
|
{
|
||||||
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
||||||
{
|
{
|
||||||
double dx = (double) player.getX() - point1.getX();
|
if (Math.hypot(player.getX() - point1.getX(), player.getY() - point1.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
double dy = (double) player.getY() - point1.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (IClientOutgoingPacket p : packets)
|
for (IClientOutgoingPacket p : packets)
|
||||||
{
|
{
|
||||||
player.sendPacket(p);
|
player.sendPacket(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (Math.hypot(player.getX() - point2.getX(), player.getY() - point2.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
{
|
|
||||||
dx = (double) player.getX() - point2.getX();
|
|
||||||
dy = (double) player.getY() - point2.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (IClientOutgoingPacket p : packets)
|
for (IClientOutgoingPacket p : packets)
|
||||||
{
|
{
|
||||||
@@ -199,7 +193,6 @@ public class BoatManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -175,9 +175,7 @@ public class L2Territory
|
|||||||
int zmin = _zMin;
|
int zmin = _zMin;
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
final double dx = p1._x - x;
|
double distance = Math.hypot(p1._x - x, p1._y - y);
|
||||||
final double dy = p1._y - y;
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if ((curdistance == 0) || (distance < curdistance))
|
if ((curdistance == 0) || (distance < curdistance))
|
||||||
{
|
{
|
||||||
curdistance = distance;
|
curdistance = distance;
|
||||||
|
|||||||
@@ -3503,7 +3503,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
double dy = (y - curY);
|
double dy = (y - curY);
|
||||||
double dz = (z - curZ);
|
double dz = (z - curZ);
|
||||||
double distance = Math.sqrt((dx * dx) + (dy * dy));
|
double distance = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
||||||
if (verticalMovementOnly)
|
if (verticalMovementOnly)
|
||||||
@@ -3522,7 +3522,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = (x - curX);
|
dx = (x - curX);
|
||||||
dy = (y - curY);
|
dy = (y - curY);
|
||||||
dz = (z - curZ);
|
dz = (z - curZ);
|
||||||
distance = Math.sqrt((dx * dx) + (dy * dy));
|
distance = Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define movement angles needed
|
// Define movement angles needed
|
||||||
@@ -3649,7 +3649,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
||||||
// than the original movement was and the LoS gives a shorter distance than 2000
|
// than the original movement was and the LoS gives a shorter distance than 2000
|
||||||
@@ -3723,7 +3723,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
sin = dy / distance;
|
sin = dy / distance;
|
||||||
cos = dx / distance;
|
cos = dx / distance;
|
||||||
}
|
}
|
||||||
@@ -3743,7 +3743,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
// Apply Z distance for flying or swimming for correct timing calculations
|
// Apply Z distance for flying or swimming for correct timing calculations
|
||||||
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
||||||
{
|
{
|
||||||
distance = Math.sqrt((distance * distance) + (dz * dz));
|
distance = Math.hypot(distance, dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
@@ -3827,9 +3827,8 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
final double dx = (m._xDestination - super.getX());
|
|
||||||
final double dy = (m._yDestination - super.getY());
|
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,9 +152,7 @@ public abstract class L2Vehicle extends L2Character
|
|||||||
m._zDestination = point.getZ();
|
m._zDestination = point.getZ();
|
||||||
m._heading = 0;
|
m._heading = 0;
|
||||||
|
|
||||||
final double dx = point.getX() - getX();
|
final double distance = Math.hypot(point.getX() - getX(), point.getY() - getY());
|
||||||
final double dy = point.getY() - getY();
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if (distance > 1)
|
if (distance > 1)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public double getDistanceToZone(int x, int y)
|
public double getDistanceToZone(int x, int y)
|
||||||
{
|
{
|
||||||
return (Math.sqrt((Math.pow(_x - x, 2) + Math.pow(_y - y, 2))) - _rad);
|
return Math.hypot(_x - x, _y - y) - _rad;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
||||||
|
|||||||
@@ -894,7 +894,7 @@ public class L2CharacterAI extends AbstractAI
|
|||||||
final double dx = worldPosition.getX() - x;
|
final double dx = worldPosition.getX() - x;
|
||||||
final double dy = worldPosition.getY() - y;
|
final double dy = worldPosition.getY() - y;
|
||||||
|
|
||||||
double dist = Math.sqrt((dx * dx) + (dy * dy));
|
double dist = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final double sin = dy / dist;
|
final double sin = dy / dist;
|
||||||
final double cos = dx / dist;
|
final double cos = dx / dist;
|
||||||
|
|||||||
@@ -177,20 +177,14 @@ public class BoatManager
|
|||||||
{
|
{
|
||||||
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
||||||
{
|
{
|
||||||
double dx = (double) player.getX() - point1.getX();
|
if (Math.hypot(player.getX() - point1.getX(), player.getY() - point1.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
double dy = (double) player.getY() - point1.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (IClientOutgoingPacket p : packets)
|
for (IClientOutgoingPacket p : packets)
|
||||||
{
|
{
|
||||||
player.sendPacket(p);
|
player.sendPacket(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (Math.hypot(player.getX() - point2.getX(), player.getY() - point2.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
{
|
|
||||||
dx = (double) player.getX() - point2.getX();
|
|
||||||
dy = (double) player.getY() - point2.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (IClientOutgoingPacket p : packets)
|
for (IClientOutgoingPacket p : packets)
|
||||||
{
|
{
|
||||||
@@ -199,7 +193,6 @@ public class BoatManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -175,9 +175,7 @@ public class L2Territory
|
|||||||
int zmin = _zMin;
|
int zmin = _zMin;
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
final double dx = p1._x - x;
|
double distance = Math.hypot(p1._x - x, p1._y - y);
|
||||||
final double dy = p1._y - y;
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if ((curdistance == 0) || (distance < curdistance))
|
if ((curdistance == 0) || (distance < curdistance))
|
||||||
{
|
{
|
||||||
curdistance = distance;
|
curdistance = distance;
|
||||||
|
|||||||
@@ -3503,7 +3503,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
double dy = (y - curY);
|
double dy = (y - curY);
|
||||||
double dz = (z - curZ);
|
double dz = (z - curZ);
|
||||||
double distance = Math.sqrt((dx * dx) + (dy * dy));
|
double distance = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
||||||
if (verticalMovementOnly)
|
if (verticalMovementOnly)
|
||||||
@@ -3522,7 +3522,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = (x - curX);
|
dx = (x - curX);
|
||||||
dy = (y - curY);
|
dy = (y - curY);
|
||||||
dz = (z - curZ);
|
dz = (z - curZ);
|
||||||
distance = Math.sqrt((dx * dx) + (dy * dy));
|
distance = Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define movement angles needed
|
// Define movement angles needed
|
||||||
@@ -3649,7 +3649,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
||||||
// than the original movement was and the LoS gives a shorter distance than 2000
|
// than the original movement was and the LoS gives a shorter distance than 2000
|
||||||
@@ -3723,7 +3723,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
sin = dy / distance;
|
sin = dy / distance;
|
||||||
cos = dx / distance;
|
cos = dx / distance;
|
||||||
}
|
}
|
||||||
@@ -3743,7 +3743,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
// Apply Z distance for flying or swimming for correct timing calculations
|
// Apply Z distance for flying or swimming for correct timing calculations
|
||||||
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
||||||
{
|
{
|
||||||
distance = Math.sqrt((distance * distance) + (dz * dz));
|
distance = Math.hypot(distance, dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
@@ -3827,9 +3827,8 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
final double dx = (m._xDestination - super.getX());
|
|
||||||
final double dy = (m._yDestination - super.getY());
|
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,9 +152,7 @@ public abstract class L2Vehicle extends L2Character
|
|||||||
m._zDestination = point.getZ();
|
m._zDestination = point.getZ();
|
||||||
m._heading = 0;
|
m._heading = 0;
|
||||||
|
|
||||||
final double dx = point.getX() - getX();
|
final double distance = Math.hypot(point.getX() - getX(), point.getY() - getY());
|
||||||
final double dy = point.getY() - getY();
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if (distance > 1)
|
if (distance > 1)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public double getDistanceToZone(int x, int y)
|
public double getDistanceToZone(int x, int y)
|
||||||
{
|
{
|
||||||
return (Math.sqrt((Math.pow(_x - x, 2) + Math.pow(_y - y, 2))) - _rad);
|
return Math.hypot(_x - x, _y - y) - _rad;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
||||||
|
|||||||
@@ -894,7 +894,7 @@ public class L2CharacterAI extends AbstractAI
|
|||||||
final double dx = worldPosition.getX() - x;
|
final double dx = worldPosition.getX() - x;
|
||||||
final double dy = worldPosition.getY() - y;
|
final double dy = worldPosition.getY() - y;
|
||||||
|
|
||||||
double dist = Math.sqrt((dx * dx) + (dy * dy));
|
double dist = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final double sin = dy / dist;
|
final double sin = dy / dist;
|
||||||
final double cos = dx / dist;
|
final double cos = dx / dist;
|
||||||
|
|||||||
@@ -177,20 +177,14 @@ public class BoatManager
|
|||||||
{
|
{
|
||||||
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
||||||
{
|
{
|
||||||
double dx = (double) player.getX() - point1.getX();
|
if (Math.hypot(player.getX() - point1.getX(), player.getY() - point1.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
double dy = (double) player.getY() - point1.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (IClientOutgoingPacket p : packets)
|
for (IClientOutgoingPacket p : packets)
|
||||||
{
|
{
|
||||||
player.sendPacket(p);
|
player.sendPacket(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (Math.hypot(player.getX() - point2.getX(), player.getY() - point2.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
{
|
|
||||||
dx = (double) player.getX() - point2.getX();
|
|
||||||
dy = (double) player.getY() - point2.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (IClientOutgoingPacket p : packets)
|
for (IClientOutgoingPacket p : packets)
|
||||||
{
|
{
|
||||||
@@ -199,7 +193,6 @@ public class BoatManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -175,9 +175,7 @@ public class L2Territory
|
|||||||
int zmin = _zMin;
|
int zmin = _zMin;
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
final double dx = p1._x - x;
|
double distance = Math.hypot(p1._x - x, p1._y - y);
|
||||||
final double dy = p1._y - y;
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if ((curdistance == 0) || (distance < curdistance))
|
if ((curdistance == 0) || (distance < curdistance))
|
||||||
{
|
{
|
||||||
curdistance = distance;
|
curdistance = distance;
|
||||||
|
|||||||
@@ -3503,7 +3503,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
double dy = (y - curY);
|
double dy = (y - curY);
|
||||||
double dz = (z - curZ);
|
double dz = (z - curZ);
|
||||||
double distance = Math.sqrt((dx * dx) + (dy * dy));
|
double distance = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
||||||
if (verticalMovementOnly)
|
if (verticalMovementOnly)
|
||||||
@@ -3522,7 +3522,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = (x - curX);
|
dx = (x - curX);
|
||||||
dy = (y - curY);
|
dy = (y - curY);
|
||||||
dz = (z - curZ);
|
dz = (z - curZ);
|
||||||
distance = Math.sqrt((dx * dx) + (dy * dy));
|
distance = Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define movement angles needed
|
// Define movement angles needed
|
||||||
@@ -3649,7 +3649,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
||||||
// than the original movement was and the LoS gives a shorter distance than 2000
|
// than the original movement was and the LoS gives a shorter distance than 2000
|
||||||
@@ -3723,7 +3723,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
sin = dy / distance;
|
sin = dy / distance;
|
||||||
cos = dx / distance;
|
cos = dx / distance;
|
||||||
}
|
}
|
||||||
@@ -3743,7 +3743,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
// Apply Z distance for flying or swimming for correct timing calculations
|
// Apply Z distance for flying or swimming for correct timing calculations
|
||||||
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
||||||
{
|
{
|
||||||
distance = Math.sqrt((distance * distance) + (dz * dz));
|
distance = Math.hypot(distance, dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
@@ -3827,9 +3827,8 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
final double dx = (m._xDestination - super.getX());
|
|
||||||
final double dy = (m._yDestination - super.getY());
|
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,9 +152,7 @@ public abstract class L2Vehicle extends L2Character
|
|||||||
m._zDestination = point.getZ();
|
m._zDestination = point.getZ();
|
||||||
m._heading = 0;
|
m._heading = 0;
|
||||||
|
|
||||||
final double dx = point.getX() - getX();
|
final double distance = Math.hypot(point.getX() - getX(), point.getY() - getY());
|
||||||
final double dy = point.getY() - getY();
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if (distance > 1)
|
if (distance > 1)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public double getDistanceToZone(int x, int y)
|
public double getDistanceToZone(int x, int y)
|
||||||
{
|
{
|
||||||
return (Math.sqrt((Math.pow(_x - x, 2) + Math.pow(_y - y, 2))) - _rad);
|
return Math.hypot(_x - x, _y - y) - _rad;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
||||||
|
|||||||
@@ -947,7 +947,7 @@ public class L2CharacterAI extends AbstractAI
|
|||||||
final double dx = worldPosition.getX() - x;
|
final double dx = worldPosition.getX() - x;
|
||||||
final double dy = worldPosition.getY() - y;
|
final double dy = worldPosition.getY() - y;
|
||||||
|
|
||||||
double dist = Math.sqrt((dx * dx) + (dy * dy));
|
double dist = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final double sin = dy / dist;
|
final double sin = dy / dist;
|
||||||
final double cos = dx / dist;
|
final double cos = dx / dist;
|
||||||
|
|||||||
@@ -171,20 +171,14 @@ public class BoatManager
|
|||||||
{
|
{
|
||||||
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
||||||
{
|
{
|
||||||
double dx = (double) player.getX() - point1.getX();
|
if (Math.hypot(player.getX() - point1.getX(), player.getY() - point1.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
double dy = (double) player.getY() - point1.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (L2GameServerPacket p : packets)
|
for (L2GameServerPacket p : packets)
|
||||||
{
|
{
|
||||||
player.sendPacket(p);
|
player.sendPacket(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (Math.hypot(player.getX() - point2.getX(), player.getY() - point2.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
{
|
|
||||||
dx = (double) player.getX() - point2.getX();
|
|
||||||
dy = (double) player.getY() - point2.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (L2GameServerPacket p : packets)
|
for (L2GameServerPacket p : packets)
|
||||||
{
|
{
|
||||||
@@ -193,7 +187,6 @@ public class BoatManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -149,9 +149,7 @@ public class L2Territory
|
|||||||
int zmin = _zMin;
|
int zmin = _zMin;
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
final double dx = p1._x - x;
|
double distance = Math.hypot(p1._x - x, p1._y - y);
|
||||||
final double dy = p1._y - y;
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if ((curdistance == 0) || (distance < curdistance))
|
if ((curdistance == 0) || (distance < curdistance))
|
||||||
{
|
{
|
||||||
curdistance = distance;
|
curdistance = distance;
|
||||||
|
|||||||
@@ -4294,7 +4294,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
double dy = (y - curY);
|
double dy = (y - curY);
|
||||||
double dz = (z - curZ);
|
double dz = (z - curZ);
|
||||||
double distance = Math.sqrt((dx * dx) + (dy * dy));
|
double distance = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
||||||
if (verticalMovementOnly)
|
if (verticalMovementOnly)
|
||||||
@@ -4313,7 +4313,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = (x - curX);
|
dx = (x - curX);
|
||||||
dy = (y - curY);
|
dy = (y - curY);
|
||||||
dz = (z - curZ);
|
dz = (z - curZ);
|
||||||
distance = Math.sqrt((dx * dx) + (dy * dy));
|
distance = Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@@ -4439,7 +4439,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
||||||
// than the original movement was and the LoS gives a shorter distance than 2000
|
// than the original movement was and the LoS gives a shorter distance than 2000
|
||||||
@@ -4504,7 +4504,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
sin = dy / distance;
|
sin = dy / distance;
|
||||||
cos = dx / distance;
|
cos = dx / distance;
|
||||||
}
|
}
|
||||||
@@ -4525,7 +4525,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
// Apply Z distance for flying or swimming for correct timing calculations
|
// Apply Z distance for flying or swimming for correct timing calculations
|
||||||
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
||||||
{
|
{
|
||||||
distance = Math.sqrt((distance * distance) + (dz * dz));
|
distance = Math.hypot(distance, dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
@@ -4609,9 +4609,8 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
final double dx = (m._xDestination - super.getX());
|
|
||||||
final double dy = (m._yDestination - super.getY());
|
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -157,9 +157,7 @@ public abstract class L2Vehicle extends L2Character
|
|||||||
m._zDestination = point.getZ();
|
m._zDestination = point.getZ();
|
||||||
m._heading = 0;
|
m._heading = 0;
|
||||||
|
|
||||||
final double dx = point.getX() - getX();
|
final double distance = Math.hypot(point.getX() - getX(), point.getY() - getY());
|
||||||
final double dy = point.getY() - getY();
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if (distance > 1)
|
if (distance > 1)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public double getDistanceToZone(int x, int y)
|
public double getDistanceToZone(int x, int y)
|
||||||
{
|
{
|
||||||
return Math.sqrt(Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) - _rad;
|
return Math.hypot(_x - x, _y - y) - _rad;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
||||||
|
|||||||
@@ -894,7 +894,7 @@ public class L2CharacterAI extends AbstractAI
|
|||||||
final double dx = worldPosition.getX() - x;
|
final double dx = worldPosition.getX() - x;
|
||||||
final double dy = worldPosition.getY() - y;
|
final double dy = worldPosition.getY() - y;
|
||||||
|
|
||||||
double dist = Math.sqrt((dx * dx) + (dy * dy));
|
double dist = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final double sin = dy / dist;
|
final double sin = dy / dist;
|
||||||
final double cos = dx / dist;
|
final double cos = dx / dist;
|
||||||
|
|||||||
@@ -177,20 +177,14 @@ public class BoatManager
|
|||||||
{
|
{
|
||||||
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
||||||
{
|
{
|
||||||
double dx = (double) player.getX() - point1.getX();
|
if (Math.hypot(player.getX() - point1.getX(), player.getY() - point1.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
double dy = (double) player.getY() - point1.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (IClientOutgoingPacket p : packets)
|
for (IClientOutgoingPacket p : packets)
|
||||||
{
|
{
|
||||||
player.sendPacket(p);
|
player.sendPacket(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (Math.hypot(player.getX() - point2.getX(), player.getY() - point2.getY()) < Config.BOAT_BROADCAST_RADIUS)
|
||||||
{
|
|
||||||
dx = (double) player.getX() - point2.getX();
|
|
||||||
dy = (double) player.getY() - point2.getY();
|
|
||||||
if (Math.sqrt((dx * dx) + (dy * dy)) < Config.BOAT_BROADCAST_RADIUS)
|
|
||||||
{
|
{
|
||||||
for (IClientOutgoingPacket p : packets)
|
for (IClientOutgoingPacket p : packets)
|
||||||
{
|
{
|
||||||
@@ -199,7 +193,6 @@ public class BoatManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -175,9 +175,7 @@ public class L2Territory
|
|||||||
int zmin = _zMin;
|
int zmin = _zMin;
|
||||||
for (Point p1 : _points)
|
for (Point p1 : _points)
|
||||||
{
|
{
|
||||||
final double dx = p1._x - x;
|
double distance = Math.hypot(p1._x - x, p1._y - y);
|
||||||
final double dy = p1._y - y;
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if ((curdistance == 0) || (distance < curdistance))
|
if ((curdistance == 0) || (distance < curdistance))
|
||||||
{
|
{
|
||||||
curdistance = distance;
|
curdistance = distance;
|
||||||
|
|||||||
@@ -3503,7 +3503,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
double dy = (y - curY);
|
double dy = (y - curY);
|
||||||
double dz = (z - curZ);
|
double dz = (z - curZ);
|
||||||
double distance = Math.sqrt((dx * dx) + (dy * dy));
|
double distance = Math.hypot(dx, dy);
|
||||||
|
|
||||||
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
final boolean verticalMovementOnly = isFlying() && (distance == 0) && (dz != 0);
|
||||||
if (verticalMovementOnly)
|
if (verticalMovementOnly)
|
||||||
@@ -3522,7 +3522,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = (x - curX);
|
dx = (x - curX);
|
||||||
dy = (y - curY);
|
dy = (y - curY);
|
||||||
dz = (z - curZ);
|
dz = (z - curZ);
|
||||||
distance = Math.sqrt((dx * dx) + (dy * dy));
|
distance = Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define movement angles needed
|
// Define movement angles needed
|
||||||
@@ -3649,7 +3649,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
}
|
}
|
||||||
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
|
||||||
// than the original movement was and the LoS gives a shorter distance than 2000
|
// than the original movement was and the LoS gives a shorter distance than 2000
|
||||||
@@ -3723,7 +3723,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
distance = verticalMovementOnly ? Math.abs(dz * dz) : Math.sqrt((dx * dx) + (dy * dy));
|
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
|
||||||
sin = dy / distance;
|
sin = dy / distance;
|
||||||
cos = dx / distance;
|
cos = dx / distance;
|
||||||
}
|
}
|
||||||
@@ -3743,7 +3743,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
// Apply Z distance for flying or swimming for correct timing calculations
|
// Apply Z distance for flying or swimming for correct timing calculations
|
||||||
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
if ((isFlying() || isInsideZone(ZoneId.WATER)) && !verticalMovementOnly)
|
||||||
{
|
{
|
||||||
distance = Math.sqrt((distance * distance) + (dz * dz));
|
distance = Math.hypot(distance, dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
@@ -3827,9 +3827,8 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
m._yDestination = md.geoPath.get(m.onGeodataPathIndex).getY();
|
||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
final double dx = (m._xDestination - super.getX());
|
|
||||||
final double dy = (m._yDestination - super.getY());
|
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,9 +152,7 @@ public abstract class L2Vehicle extends L2Character
|
|||||||
m._zDestination = point.getZ();
|
m._zDestination = point.getZ();
|
||||||
m._heading = 0;
|
m._heading = 0;
|
||||||
|
|
||||||
final double dx = point.getX() - getX();
|
final double distance = Math.hypot(point.getX() - getX(), point.getY() - getY());
|
||||||
final double dy = point.getY() - getY();
|
|
||||||
final double distance = Math.sqrt((dx * dx) + (dy * dy));
|
|
||||||
if (distance > 1)
|
if (distance > 1)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public double getDistanceToZone(int x, int y)
|
public double getDistanceToZone(int x, int y)
|
||||||
{
|
{
|
||||||
return (Math.sqrt((Math.pow(_x - x, 2) + Math.pow(_y - y, 2))) - _rad);
|
return Math.hypot(_x - x, _y - y) - _rad;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
// getLowZ() / getHighZ() - These two functions were added to cope with the demand of the new fishing algorithms, wich are now able to correctly place the hook in the water, thanks to getHighZ(). getLowZ() was added, considering potential future modifications.
|
||||||
|
|||||||
Reference in New Issue
Block a user