com.sun.j3d.utils.scenegraph.transparency
Class SimpleDistanceComparator

java.lang.Object
  extended by com.sun.j3d.utils.scenegraph.transparency.SimpleDistanceComparator
All Implemented Interfaces:
java.util.Comparator<TransparencySortGeom>

public class SimpleDistanceComparator
extends java.lang.Object
implements java.util.Comparator<TransparencySortGeom>

Sample TransparencySortComparator which has the same functionality as the fixed default function in Java 3D.

Since:
Java 3D 1.4

Constructor Summary
SimpleDistanceComparator()
          Creates a new instance of SimpleDistanceComparator
 
Method Summary
 int compare(TransparencySortGeom t1, TransparencySortGeom t2)
          Compares its two arguments for order.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

SimpleDistanceComparator

public SimpleDistanceComparator()
Creates a new instance of SimpleDistanceComparator

Method Detail

compare

public int compare(TransparencySortGeom t1,
                   TransparencySortGeom t2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than (closer to the viewer), equal to, or greater than (further from the viewer) the second argument. The compare method will be called with 2 objects of type TransparencySortGeom and it's result should indicate which object is closer to the viewer. Object1 < Object2 if it is to be considered closer and rendered after.

Specified by:
compare in interface java.util.Comparator<TransparencySortGeom>
Parameters:
t1 - TransparencySortGeom object 1
t2 - TransparencySortGeom object 2