/** * Indicates whether or not (the bounding box of) a cylinder intersects this * box. * * @param cylinder the cylinder * * @return true if the (bounding box of the) cylinder intersects this box, * false otherwise */ public boolean intersectsCylinder(Cylinder cylinder) { // expand box by effective cylinder radii double rx = cylinder.getEffectiveRadius(this.planes[0]); // r-min plane double ry = cylinder.getEffectiveRadius(this.planes[2]); // s-min plane double rz = cylinder.getEffectiveRadius(this.planes[4]); // t-min plane // the expansion includes the bounding box of the cylinder Vec4 expansion = new Vec4(rx, ry, rz); // perform the conservatively approximate (cylinder bounding box) intersection check return this.intersectsLineSegment(cylinder.getBottomCenter(), cylinder.getTopCenter(), expansion); }
/** * Gets the geometric extent of this obstacle cylinder for a specified globe. * * @param globe the globe to be used for the conversion * * @return the geometric extent of this obstacle cylinder * * @see AbstractAirspace#getExtent(Globe, double) */ @Override public Cylinder getExtent(Globe globe) { Position bcp = new Position(this.getCenter(), this.getAltitudes()[0]); Position tcp = new Position(this.getCenter(), this.getAltitudes()[1]); Vec4 bottomCenter = globe.computePointFromPosition(bcp); Vec4 topCenter = globe.computePointFromPosition(tcp); double radius = this.getRadii()[1]; return new Cylinder(bottomCenter, topCenter, radius); // TODO: check available method //return super.getExtent(globe, 1d); }
/******************************************************************************************************************* * * ******************************************************************************************************************/ private void drawBoundingVolumes(DrawContext dc, ArrayList<MercatorTextureTile> tiles) { float[] previousColor = new float[4]; dc.getGL().glGetFloatv(GL.GL_CURRENT_COLOR, previousColor, 0); dc.getGL().glColor3d(0, 1, 0); for (MercatorTextureTile tile : tiles) { ((Cylinder) tile.getExtent(dc)).render(dc); } Cylinder c = dc.getGlobe().computeBoundingCylinder(dc.getVerticalExaggeration(), this.levels.getSector()); dc.getGL().glColor3d(1, 1, 0); c.render(dc); dc.getGL().glColor4fv(previousColor, 0); }
/** * Converts this vertical cylinder to a geometric cylinder. * * @param globe the globe to be used for the conversion * @return the geometric cylinder */ public gov.nasa.worldwind.geom.Cylinder toGeometricCylinder(Globe globe) { Position center = this.getCenterPosition(); Angle latitude = center.getLatitude(); Angle longitude = center.getLongitude(); double elevation = center.getElevation(); double radius = this.getEastWestRadius(); Position bcp = new Position(latitude, longitude, elevation - this.getVerticalRadius()); Position tcp = new Position(latitude, longitude, elevation + this.getVerticalRadius()); Vec4 bottomCenter = globe.computePointFromPosition(bcp); Vec4 topCenter = globe.computePointFromPosition(tcp); return new gov.nasa.worldwind.geom.Cylinder(bottomCenter, topCenter, radius); }