private boolean needToSplit(DrawContext dc, Sector sector) { Vec4[] corners = sector.computeCornerPoints(dc.getGlobe(), dc.getVerticalExaggeration()); Vec4 centerPoint = sector.computeCenterPoint(dc.getGlobe(), dc.getVerticalExaggeration()); View view = dc.getView(); double d1 = view.getEyePoint().distanceTo3(corners[0]); double d2 = view.getEyePoint().distanceTo3(corners[1]); double d3 = view.getEyePoint().distanceTo3(corners[2]); double d4 = view.getEyePoint().distanceTo3(corners[3]); double d5 = view.getEyePoint().distanceTo3(centerPoint); double minDistance = d1; if (d2 < minDistance) minDistance = d2; if (d3 < minDistance) minDistance = d3; if (d4 < minDistance) minDistance = d4; if (d5 < minDistance) minDistance = d5; double cellSize = (Math.PI * sector.getDeltaLatRadians() * dc.getGlobe().getRadius()) / 20; // TODO return !(Math.log10(cellSize) <= (Math.log10(minDistance) - this.splitScale)); }
/** Force a packet to be sent. */ public void sendPacket() { // Also save stuff to a player's local hard-drive. if (activationEvent) { View MyView = MyHacker.getView(); Object[] send = new Object[] {new Integer(activationID), new Integer(activationType), MyHacker.getIP()}; MyView.addFunctionCall( new RemoteFunctionCall(Hacker.HACKTENDO_PLAYER, "hacktendoActivate", send)); } else if (targetEvent) { View MyView = MyHacker.getView(); Object[] send = null; if (playerSprite != null) send = new Object[] { new Integer(targetX), new Integer(targetY), MyHacker.getIP(), new Integer(playerSprite.getX()), new Integer(playerSprite.getY()) }; else send = new Object[] { new Integer(targetX), new Integer(targetY), MyHacker.getIP(), new Integer(targetX), new Integer(targetY) }; MyView.addFunctionCall( new RemoteFunctionCall(Hacker.HACKTENDO_PLAYER, "hacktendoTarget", send)); } activationEvent = false; targetEvent = false; }