Fit-to-box transform

From H3D.org

Jump to: navigation, search

The FitToBoxTransform node transforms it's children nodes into an invisible box of a specified size and position. The size and position of the box are defined by the boxSize and boxCenter fields respectively.


Learning objective:

  • Using the FitToBoxTransform node


 
<Scene>
  <FitToBoxTransform boxSize="0.05 0.1 0.1" boxCenter="0.1 0.1 0" uniformScalingOnly="false" active="true">
    <Shape>
      <Appearance>
        <Material diffuseColor="0.3 0.8 0.8" />
      </Appearance>
      <Sphere radius="0.15" />
    </Shape>
  </FitToBoxTransform>
</Scene>
 

In the example above the Sphere is transformed by FitToBoxTransform into a box of size 0.05x0.1x0.1 centered at (0.1 0.1 0). The box is clearly smaller than the dimension of the Sphere. When the Sphere is transformed, it is fitted into the box. In this case, uniformScalingOnly is set to false and hence the sphere is "flattened" to fit the box. If the field is set to true then the box is scaled uniformly. Although it is not necessary here, the active field is set to true to update the transformation matrix.

References

Personal tools
go to