/** * Returns the 3D bounding box of the specified glyph code. * * @param glyphCode the glyphCode from the original 2D Font * @param bounds the 3D glyph's bounds */ public void getBoundingBox(int glyphCode, BoundingBox bounds) { int[] gCodes = {glyphCode}; GlyphVector gVec = font.createGlyphVector(frc, gCodes); Rectangle2D.Float bounds2d = (Rectangle2D.Float) (((GlyphMetrics) (gVec.getGlyphMetrics(0))).getBounds2D()); Point3d lower = new Point3d(bounds2d.x, bounds2d.y, 0.0); Point3d upper; if (fontExtrusion != null) { upper = new Point3d( bounds2d.x + bounds2d.width, bounds2d.y + bounds2d.height, fontExtrusion.length); } else { upper = new Point3d(bounds2d.x + bounds2d.width, bounds2d.y + bounds2d.height, 0.0); } bounds.setLower(lower); bounds.setUpper(upper); }
/** * Retrieves the 3D bounding box that encloses this Text3D object. * * @param bounds the object to copy the bounding information to. * @exception CapabilityNotSetException if appropriate capability is not set and this object is * part of live or compiled scene graph * @see BoundingBox */ final void getBoundingBox(BoundingBox bounds) { synchronized (this) { bounds.setLower(lower); bounds.setUpper(upper); } }