edu.jhu.htm.core
Class Convex

java.lang.Object
  |
  +--edu.jhu.htm.core.Sign
        |
        +--edu.jhu.htm.core.Convex

public class Convex
extends Sign

The Convex class encapsulates all the code for intersection and lookup. It represents a convex on the unit sphere (see Domain).

  Current Version
  ===============
  ID:	$Id: Convex.java,v 1.3 2003/02/19 15:46:11 womullan Exp $
  Revision: 	$Revision: 1.3 $
  Date/time:	$Date: 2003/02/19 15:46:11 $
 

Version:
$Revision: 1.3 $

Field Summary
protected  int olevel
           
 
Fields inherited from class edu.jhu.htm.core.Sign
mIXED, nEG, pOS, sign_, zERO
 
Constructor Summary
Convex()
          Default Constructor
Convex(Vector3d v1, Vector3d v2, Vector3d v3)
          Constructor from a triangle Initialize domain from a triangle.
Convex(Vector3d v1, Vector3d v2, Vector3d v3, Vector3d v4)
          Constructor from a rectangle Initialize convex from a rectangle.
 
Method Summary
 void add(Constraint c)
          Add a constraint.
 boolean contains(Vector3d p)
           
 Constraint getConstraint(int c)
           
 Vector3d getCorner(int c)
           
 int getNumberOfConstraints()
           
 int getOlevel()
           
 void intersect(HTMindexImp idx, HTMrange htmrange, boolean varlen)
          Intersect with index.
static java.lang.String printMark(short mark)
           
protected  void saveTrixel(long htmid, HTMrange hr, boolean varlen)
          adds the given trixel tot he HTMrange
 void setOlevel(int lev)
           
 void simplify()
          simplify: We have the following decision tree for the simplification of convexes: Always test two constraints against each other.
 java.lang.String toString()
           
 
Methods inherited from class edu.jhu.htm.core.Sign
printSign
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

olevel

protected int olevel
Constructor Detail

Convex

public Convex()
Default Constructor


Convex

public Convex(Vector3d v1,
              Vector3d v2,
              Vector3d v3)
Constructor from a triangle Initialize domain from a triangle. The corners of these vectors form a triangle, so we just add three ZERO convexes to the domain where the direction is given by the cross product of the corners. Of course, the sign has to be determined (on which side of the triangle are we?) If the three points lie on one line, no convexes are added.


Convex

public Convex(Vector3d v1,
              Vector3d v2,
              Vector3d v3,
              Vector3d v4)
Constructor from a rectangle Initialize convex from a rectangle. The vectors that form a rectangle may be in any order, the code finds the edges by itself. If one of the vectors lies within the triangle formed by the other three vectors, the previous constructor is used.

Method Detail

add

public void add(Constraint c)
Add a constraint. Multiple contrains make up a complex area on the sphere. After adding a ne constraint the constraints are ordered by ascending opening angle. i


simplify

public void simplify()
simplify: We have the following decision tree for the simplification of convexes: Always test two constraints against each other. We have If both constraints are pOS If they intersect: keep both If one lies in the other: drop the larger one Else: disjunct. Empty convex, stop. If both constraints are nEG If they intersect or are disjunct: ok Else: one lies in the other, drop smaller 'hole' Mixed: one pOS, one nEG No intersection, disjunct: pOS is redundant Intersection: keep both pOS within nEG: empty convex, stop. nEG within pOS: keep both.


intersect

public void intersect(HTMindexImp idx,
                      HTMrange htmrange,
                      boolean varlen)
Intersect with index. The HTMrange for the result must be given. Specifying varlen = true will use adaptive depth HTM for the result so ranges will be in the resolution best suited to the shape of the convex.


saveTrixel

protected void saveTrixel(long htmid,
                          HTMrange hr,
                          boolean varlen)
adds the given trixel tot he HTMrange


getConstraint

public Constraint getConstraint(int c)

getNumberOfConstraints

public int getNumberOfConstraints()

getCorner

public Vector3d getCorner(int c)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

printMark

public static java.lang.String printMark(short mark)

setOlevel

public void setOlevel(int lev)

getOlevel

public int getOlevel()

contains

public boolean contains(Vector3d p)