/** {@inheritDoc} */ public float get_float() throws TypeMismatch { try { return ((FloatHolder) holder).value; } catch (ClassCastException cex) { TypeMismatch m = new TypeMismatch(); m.initCause(cex); throw m; } }
/** {@inheritDoc} */ public void insert_float(float a_x) throws InvalidValue, TypeMismatch { try { ((FloatHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } }
/** {@inheritDoc} */ public float extract_float() throws BAD_OPERATION { check(TCKind._tk_float); return ((FloatHolder) has).value; }
private float getFarthestExtent(Set<ShotKey> shotsInView, float[] shotsInViewMbr, float[] direction, FloatBinaryOperator extentFunction) { FloatHolder farthest = new FloatHolder(Float.NaN); // float[] testPoint = new float[3]; RTraversal.traverse(getTree().getRoot(), node -> { if (!Rectmath.intersects3(shotsInViewMbr, node.mbr())) { return false; } // return Rectmath.findCorner3( node.mbr( ) , testPoint , // corner -> { // float dist = Vecmath.dot3( corner , direction ); // return farthest.value != extentFunction.applyAsFloat( // farthest.value , dist ) ? true : null; // } ) != null; return true; }, leaf -> { if (shotsInView.contains(leaf.object().key)) { for (float[] coord : leaf.object().coordIterable()) { float dist = Vecmath.dot3(coord, direction); farthest.value = extentFunction.applyAsFloat(farthest.value, dist); } } return true; }); return farthest.value; }