Xj3D VRML/X3D Code API

org.web3d.vrml.export.compressors
Class FloatPacker

java.lang.Object
  extended byorg.web3d.vrml.export.compressors.FloatPacker

public class FloatPacker
extends java.lang.Object

Compresses float by using quanitization.

Version:
$Revision: 1.5 $
Author:
Alan Hudson

Constructor Summary
FloatPacker(int num_exponent_bits, int num_mantissa_bits)
           
 
Method Summary
 float decode(long src, boolean signed)
          Decodes a bit representation to a float value.
 long encode(float f, boolean rounding)
          Encode a float.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FloatPacker

public FloatPacker(int num_exponent_bits,
                   int num_mantissa_bits)
Method Detail

encode

public long encode(float f,
                   boolean rounding)
Encode a float. The return value is the bit reprenstation using the requested mantissa and exponent bits. Mask out the result and save the bits.

Parameters:
f - The float to encode
rounding - Whether to round the result. Gives better accuracy.

decode

public float decode(long src,
                    boolean signed)
Decodes a bit representation to a float value.

Parameters:
src - The source bits
Returns:
The float value

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium