SpatialConvex.h



Classes

SpatialConvex -- Spatial Convex class (full description)

class SpatialConvex : public SpatialSign

Interface

Public Members
SpatialConvex()
SpatialConvex(const SpatialVector * v1, const SpatialVector * v2, const SpatialVector * v3)
SpatialConvex(const SpatialVector * v1, const SpatialVector * v2, const SpatialVector * v3, const SpatialVector * v4)
SpatialConvex(const SpatialConvex &)
SpatialConvex& operator =(const SpatialConvex &)
void add(SpatialConstraint &)
void simplify()
void intersect(const SpatialIndex * index, SpatialMarkup * markup, BitList * partial, BitList * full)
void intersect(const SpatialIndex * index, SpatialMarkup * markup, ValVec<uint32> * partial, ValVec<uint32> * full)
size_t numConstraints()
SpatialConstraint & operator [](size_t i)
void read(istream&)
void write(ostream&) const
Private Members
void doIntersect()
void simplify0()
SpatialMarkup::Markup triangleTest(size_t nodeIndex)
void fillChildren(size_t nodeIndex)
SpatialMarkup::Markup testNode(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)
SpatialMarkup::Markup testNode(size_t nodeIndex)
SpatialMarkup::Markup testTriangle(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2, int vsum)
void setfull(uint32 id, size_t level)
void testPartial(size_t level, uint32 id, const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)
void testSubTriangle(size_t level, uint32 id, const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)
int testConstraints(size_t i, size_t j)
int testVertex(size_t vIndex)
int testVertex(const SpatialVector & v)
bool testHole(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)
bool testEdge0(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)
bool testEdge(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)
bool eSolve(const SpatialVector & v1, const SpatialVector & v2, size_t cIndex)
bool testBoundingCircle(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)
bool testEdgeConstraint(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2, size_t cIndex)
size_t testOtherPosNone(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)
bool testConstraintInside(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2, size_t cIndex)
bool testVectorInside(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2, SpatialVector & v)

Description

Member Description

SpatialConvex()

Default Constructor

SpatialConvex(const SpatialVector * v1, const SpatialVector * v2, const SpatialVector * v3)

Constructor from a triangle

SpatialConvex(const SpatialVector * v1, const SpatialVector * v2, const SpatialVector * v3, const SpatialVector * v4)

Constructor from a rectangle

SpatialConvex(const SpatialConvex &)

Copy constructor

SpatialConvex& operator =(const SpatialConvex &)

Assignment

void add(SpatialConstraint &)

Add a constraint

void simplify()

Simplify the convex, remove redundancies

void intersect(const SpatialIndex * index, SpatialMarkup * markup, BitList * partial, BitList * full)

Intersect with index. The partial and full bitlists for the result have to be given. The markup accelerates the intersection for the index that is in memory, but is not used for the dynamically built triangles. If the conves occupies a large percent of the area of the sphere, bitlists are the preferred result method.

void intersect(const SpatialIndex * index, SpatialMarkup * markup, ValVec<uint32> * partial, ValVec<uint32> * full)

Same intersection, but the result is given in a list of nodes. If the conves is very small, this is the preferred result method.

size_t numConstraints()

Return the number of constraints

SpatialConstraint & operator [](size_t i)

[] operator: give back constraint

void read(istream&)

read from stream

void write(ostream&) const

write to stream

void doIntersect()

Do the intersection (common function for overloaded intersect())

void simplify0()

Simplification routine for zERO convexes. This is called by simplify() in case we have all zERO constraints.

SpatialMarkup::Markup triangleTest(size_t nodeIndex)

This is the testsuit for the intersection.

triangleTest: Test the nodes of the index if the convex hits it the argument gives the index of the nodes_ array to specify the QuadNode

void fillChildren(size_t nodeIndex)

fillChildren: Mark the child nodes as markup.

SpatialMarkup::Markup testNode(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)

test each quadnode for intersections. Calls testTriangle after having tested the vertices using testVertex.

SpatialMarkup::Markup testNode(size_t nodeIndex)

the same routine, but for a given saved node

SpatialMarkup::Markup testTriangle(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2, int vsum)

testTriangle: tests a triangle given by 3 vertices if it intersects the convex. Here the whole logic of deciding whether it is partial, full, swallowed or unknown is handled.

void setfull(uint32 id, size_t level)

setfull: set the full bitlist for each node below this level.

void testPartial(size_t level, uint32 id, const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)

test a triangle's subtriangles whether they are partial. If level is nonzero, recurse: subdivide the triangle according to our rules and test each subdivision. (our rules are: each subdivided triangle has to be given ordered counter-clockwise, 0th index starts off new 0-node, 1st index starts off new 1-node, 2nd index starts off new 2-node middle triangle gives new 3-node.) if we are at the bottom, set this id's leafindex in partial bitlist.

void testSubTriangle(size_t level, uint32 id, const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)

call full or partial depending on result of testNode.

int testConstraints(size_t i, size_t j)

Test for constraint relative position; intersect, one in the other, disjoint.

int testVertex(size_t vIndex)

Test if vertices are inside the convex for a saved node. makes use of the markup (this is where the speedup occurs)

int testVertex(const SpatialVector & v)

Same testVertex but for any vector v, no handling using markup.

bool testHole(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)

testHole : look for 'holes', i.e. negative constraints that have their centers inside the node with the three corners v0,v1,v2.

bool testEdge0(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)

testEdge0: test the edges of the triangle against the edges of the zERO convex. The convex is stored in corners_ so that the convex is always on the left-hand-side of an edge corners_(i) - corners_(i+1). (just like the triangles). This makes testing for intersections with the edges easy.

bool testEdge(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)

testEdge: look whether one of the constraints intersects with one of the edges of node with the corners v0,v1,v2.

bool eSolve(const SpatialVector & v1, const SpatialVector & v2, size_t cIndex)

eSolve: solve the quadratic equation for the edge v1,v2 of constraint[cIndex]

bool testBoundingCircle(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)

Test if bounding circle intersects with a constraint

bool testEdgeConstraint(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2, size_t cIndex)

Test if a constraint intersects the edges

size_t testOtherPosNone(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2)

Look for any positive constraint that does not intersect the edges

bool testConstraintInside(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2, size_t cIndex)

Test for a constraint lying inside or outside of triangle

bool testVectorInside(const SpatialVector & v0, const SpatialVector & v1, const SpatialVector & v2, SpatialVector & v)

Test for a vector lying inside or outside of triangle

© Copyright The Johns Hopkins University 1999, All Rights Reserved.
Peter Z. Kunszt,