/** * Returns the latitude and longitude of the sector's angular center: (minimum latitude + maximum latitude) / 2, * (minimum longitude + maximum longitude) / 2. * * @return The latitude and longitude of the sector's angular center */ public LatLon getCentroid() { Angle la = Angle.fromDegrees(0.5 * (this.getMaxLatitude().degrees + this.getMinLatitude().degrees)); Angle lo = Angle.fromDegrees(0.5 * (this.getMaxLongitude().degrees + this.getMinLongitude().degrees)); return new LatLon(la, lo); }
public Position add(Position that) { Angle lat = Angle.normalizedLatitude(this.latitude.add(that.latitude)); Angle lon = Angle.normalizedLongitude(this.longitude.add(that.longitude)); return new Position(lat, lon, this.elevation + that.elevation); }
/** * Determine if a point is behind the <code>Line</code>'s origin. * * @param point The point to test. * * @return true if <code>point</code> is behind this <code>Line</code>'s origin, false otherwise. */ public boolean isPointBehindLineOrigin(Vec4 point) { double dot = point.subtract3(this.getOrigin()).dot3(this.getDirection()); return dot < 0.0; }
public LatLon add(Position that) { if (that == null) { throw new IllegalArgumentException("Angle Is Null"); } Angle lat = Angle.normalizedLatitude(this.latitude.add(that.getLatitude())); Angle lon = Angle.normalizedLongitude(this.longitude.add(that.getLongitude())); return new LatLon(lat, lon); }
public LatLon subtract(Position that) { if (that == null) { throw new IllegalArgumentException("Angle Is Null"); } Angle lat = Angle.normalizedLatitude(this.latitude.subtract(that.getLatitude())); Angle lon = Angle.normalizedLongitude(this.longitude.subtract(that.getLongitude())); return new LatLon(lat, lon); }
public Position subtract(Position that) { Angle lat = Angle.normalizedLatitude(this.latitude.subtract(that.latitude)); Angle lon = Angle.normalizedLongitude(this.longitude.subtract(that.longitude)); return new Position(lat, lon, this.elevation - that.elevation); }
public static Position fromDegrees(double latitude, double longitude, double elevation) { return new Position(Angle.fromDegrees(latitude), Angle.fromDegrees(longitude), elevation); }
public static Position fromRadians(double latitude, double longitude, double elevation) { return new Position(Angle.fromRadians(latitude), Angle.fromRadians(longitude), elevation); }
public static boolean equals(LatLon a, LatLon b) { return a.getLatitude().equals(b.getLatitude()) && a.getLongitude().equals(b.getLongitude()); }
public Sector[] subdivide() { Angle midLat = Angle.average(this.minLatitude, this.maxLatitude); Angle midLon = Angle.average(this.minLongitude, this.maxLongitude); Sector[] sectors = new Sector[4]; sectors[0] = new Sector(this.minLatitude, midLat, this.minLongitude, midLon); sectors[1] = new Sector(this.minLatitude, midLat, midLon, this.maxLongitude); sectors[2] = new Sector(midLat, this.maxLatitude, this.minLongitude, midLon); sectors[3] = new Sector(midLat, this.maxLatitude, midLon, this.maxLongitude); return sectors; }
/** * get my DMS representation * @return the Degrees Minutes Second representation */ public String getDMS() { String dms = "?"; if (latAngle.getDegrees() != 0.0) { dms = latAngle.toFormattedDMSString() + " " + lonAngle.toFormattedDMSString(); } return dms; }
protected void prepareDrawableTerrain(RenderContext rc, TerrainTile tile, BasicDrawableTerrain drawable) { // Assemble the drawable's geographic sector and Cartesian vertex origin. drawable.sector.set(tile.sector); drawable.vertexOrigin.set(tile.origin); // Assemble the drawable's element buffer ranges. drawable.lineElementRange.set(this.levelSetLineElementRange); drawable.triStripElementRange.set(this.levelSetTriStripElementRange); // Assemble the drawable's OpenGL buffer objects. drawable.vertexPoints = tile.getPointBuffer(rc); drawable.vertexTexCoords = this.levelSetVertexTexCoordBuffer; drawable.elements = this.levelSetElementBuffer; }
public static double distanceToSegment(Vec4 p0, Vec4 p1, Vec4 p) { Vec4 pb = nearestPointOnSegment(p0, p1, p); return p.distanceTo3(pb); }
/** * Obtains an angle from a specified number of radians. * * @param radians the size in radians of the angle to be obtained. * * @return a new angle, whose size in radians is given by <code>radians</code>. */ public static Angle fromRadians(double radians) { return new Angle(RADIANS_TO_DEGREES * radians, radians); }
/** * This factory method returns a new offset used for anchoring a rectangle to its bottom-left corner. * * @return Offset(WorldWind.OFFSET_FRACTION, 0.0, WorldWind.OFFSET_FRACTION, 0.0) */ public static Offset bottomLeft() { return new Offset(WorldWind.OFFSET_FRACTION, 0.0, WorldWind.OFFSET_FRACTION, 0.0); }
public static Position fromDegrees(double latitude, double longitude) { return new Position(Angle.fromDegrees(latitude), Angle.fromDegrees(longitude), 0); }
public static Angle fromRadiansLatitude(double radians) { radians = radians < -PIOver2 ? -PIOver2 : radians > PIOver2 ? PIOver2 : radians; double degrees = RADIANS_TO_DEGREES * radians; degrees = degrees < -90 ? -90 : degrees > 90 ? 90 : degrees; return new Angle(degrees, radians); }
public static Angle fromDegreesLongitude(double degrees) { degrees = degrees < -180 ? -180 : degrees > 180 ? 180 : degrees; double radians = DEGREES_TO_RADIANS * degrees; radians = radians < -Math.PI ? -Math.PI : radians > Math.PI ? Math.PI : radians; return new Angle(degrees, radians); }
public static Angle fromRadiansLongitude(double radians) { radians = radians < -Math.PI ? -Math.PI : radians > Math.PI ? Math.PI : radians; double degrees = RADIANS_TO_DEGREES * radians; degrees = degrees < -180 ? -180 : degrees > 180 ? 180 : degrees; return new Angle(degrees, radians); }