Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Arak::Coloring Class Reference

#include <coloring.hpp>

Collaboration diagram for Arak::Coloring:

Collaboration graph
[legend]
List of all members.

Detailed Description

Represents a binary polygonal coloring of a planar region whose boundary is an axis aligned rectangle.

The colored region is called the window. (Extending this implementation to the case of an arbitrary simple polygonal window would be easy.) The coloring is polygonal, which means that color discontinuities occur only along line segments that form polylinear boundaries between subregions of different colors.

This class represents binary polygonal colorings using a graph consisting of interior and boundary vertices and edges. Each interior edge is a line segment representing a color discontinuity; interior edges may not cross. Each interior vertex is the point at the intersection of two interior edges. Each boundary vertex is the intersection of an interior edge and the boundary of the window. Boundary edges are line segments along the boundary that join two boundary vertices; these are a representational convenience, and do not represent color discontinuities.

There are two types of color discontinuities made from interior edges: polygons consist entirely of interior edges joining interior vertices, and polylines start at one boundary vertex and terminate at another. Both of these discontinuities are called paths. A path is represented by a doubly-linked list of alternating vertices and edges. In the case of a polygon, this list is circular and is rooted at an arbitrary vertex; in the case of a polyline, it is rooted at one of the boundary vertices and terminates at the other.

This data structure uses two types of indexes to speed computations. The first is an index that splits the colored region into a grid of cells that record all edges that intersect the cell; this is used to efficiently check for crossing edges and for ray tracing operations. The second is an index of query points in the region's interior that record their current color. From (even one of) these points the color of any arbitrary point can be computed by counting the number of interior edges that cross a test segment from the test point to the nearest query point.

Definition at line 75 of file coloring.hpp.

Public Types

typedef PointerHandle< VertexVertexHandle
typedef PointerHandle< InteriorEdgeIntEdgeHandle
typedef PointerHandle< BoundaryEdgeBdEdgeHandle
typedef Grid< IntEdgeHandleInteriorEdgeIndex
 A grid where each cell stores pointers to all interior edges whose segments intersect the cell's boundary.


Public Member Functions

 Coloring ()
 Default constructor.

 Coloring (Geometry::Rectangle &boundary, int gridRows=10, int gridCols=10, double minEdgeLength=0.0)
 Constructor.

 Coloring (const Util::PropertyMap &props)
 Constructor.

 ~Coloring ()
 Destructor.

void test () const
 Tests the integrity of this Coloring object.

const Geometry::Rectangleboundary () const
 Returns the boundary of this coloring.

const InteriorEdgeIndexgetInteriorEdgeIndex () const
 Returns a const reference to the interior edge index.

int numVertices (Vertex::Type type) const
 Returns the number of vertices of the supplied type.

const VertexHandle getVertex (Vertex::Type type, int index) const
 Returns a const reference to the vertex with the supplied type and index.

VertexHandle getVertex (Vertex::Type type, int index)
 Returns a mutable reference to the vertex with the supplied type and index.

int numInteriorEdges () const
 Returns the number of interior edges in the coloring.

int numBoundaryEdges () const
 Returns the number of boundary edges in the coloring.

const IntEdgeHandle getInteriorEdge (int index) const
 Returns a const reference to the interior edge with the supplied index.

IntEdgeHandle getInteriorEdge (int index)
const BdEdgeHandle getBoundaryEdge (int index) const
 Returns a const reference to the boundary edge with the supplied index.

BdEdgeHandle getBoundaryEdge (int index)
bool deleteVertex (VertexHandle v, TEST_IF_VALID_TAG) const
 Removes a vertex by joining its two adjacent vertices.

bool deleteVertex (VertexHandle &v, DO_IF_VALID_TAG)
bool deleteVertex (VertexHandle &v, DO_WITHOUT_TEST_TAG)
bool compatible (const Geometry::Point &xp, const Geometry::Point &yp) const
 Checks to see if the line segment from x to y crosses any edges that are currently in the coloring.

bool trace (const Geometry::Point &xp, const Geometry::Point &yp, IntEdgeHandle &edge, Geometry::Point &ipt, Geometry::Kernel::FT &sd) const
 Traces the segment from xp to yp and finds the first interior edge that intersects the segment (if any).

bool interior (const Geometry::Point &xp) const
 Returns true iff xp is in the interior of the colored region.

bool boundary (const Geometry::Point &xp) const
 Returns true iff xp lies on the boundary of the colored region.

bool outside (const Geometry::Point &xp) const
 Returns true iff xp lies outside the closure of the colored region.

Geometry::Point randomPoint (Arak::Util::Random &random=Arak::Util::default_random) const
 Returns a point sampled uniformly at random from the interior of the colored region.

double area () const
 Returns the area of the colored region.

VertexHandle randomVertex (Vertex::Type type, Arak::Util::Random &random=Arak::Util::default_random) const
 Returns a reference to a vertex with the supplied type selected uniformly at random.

void getPointWithColor (Geometry::Point &p, Color &c) const
 Computes a point in the interior of the coloring and its color.

Color color (const Geometry::Point &point) const
 Returns the color of the supplied point.

bool solid (const Geometry::Polygon &poly, Arak::Color color) const
 Returns true iff every point in the closure of the supplied convex polygon is the supplied color.

void addListener (Listener &listener) const
 Adds a new listener to this coloring's list of listeners.

void addQueryPoints (const QueryPointIndex &index) const
 Adds all query points in the supplied index to the internal query point index.

const QueryPointIndexgetQueryPoints () const
 Returns a const reference to the query point index.

QueryPointIndexgetQueryPoints ()
 Returns a reference to the query point index.

void write (std::ostream &out) const
 Writes a text representation of this coloring out to the supplied stream.

void writeBinary (std::ostream &out) const
 Writes a binary representation of this coloring out to the supplied stream.

void writeXfig (std::ostream &out) const
 Writes an Xfig visualization of this coloring out to the supplied stream.

bool read (std::istream &in)
 Initializes this coloring from a text representation read from the supplied stream.

bool readBinary (std::istream &in)
 Initializes this coloring from a binary representation read from the supplied stream.

template<typename FaceInfoType> void toTriangulation (CGAL::Constrained_Delaunay_triangulation_2< Geometry::Kernel, CGAL::Tds2< CGAL::Tvb< Arak::Geometry::Kernel, CGAL::Tdsvb< void > >, CGAL::Ctfb< Geometry::Kernel, CGAL::Triangulation_face_base_with_info_2< FaceInfoType, Geometry::Kernel, CGAL::Tfb< Arak::Geometry::Kernel, CGAL::Tdsfb< void > > > > >, CGAL::No_intersection_tag > &tri) const
 Computes a representation of this coloring as a constrained triangulation.

void visualize (CGAL::Qt_widget &widget, bool drawEdges=true, bool drawVertices=true, bool drawRegions=false, bool drawQueries=false) const
 Visualizes this coloring on the supplied widget.

bool operator== (const Coloring &other) const
 An equality operator.

bool operator!= (const Coloring &other) const
 An inequality operator.

bool splitEdge (IntEdgeHandle e, const Geometry::Point &p, TEST_IF_VALID_TAG) const
 Splits an interior edge into two that are joined by a vertex at the supplied point.

bool splitEdge (IntEdgeHandle &e, const Geometry::Point &p, DO_IF_VALID_TAG)
 Splits an interior edge into two that are joined by a vertex at the supplied point.

bool splitEdge (IntEdgeHandle &e, const Geometry::Point &p, DO_WITHOUT_TEST_TAG)
 Splits an interior edge into two that are joined by a vertex at the supplied point.

bool newInteriorTriangle (const Geometry::Point &x, const Geometry::Point &y, const Geometry::Point &z, TEST_IF_VALID_TAG) const
 Constructs a fresh triangular path in the interior of the colored region.

VertexHandle newInteriorTriangle (const Geometry::Point &x, const Geometry::Point &y, const Geometry::Point &z, DO_IF_VALID_TAG)
 Constructs a fresh triangular path in the interior of the colored region.

VertexHandle newInteriorTriangle (const Geometry::Point &x, const Geometry::Point &y, const Geometry::Point &z, DO_WITHOUT_TEST_TAG)
 Constructs a fresh triangular path in the interior of the colored region.

bool newBoundaryTriangle (BdEdgeHandle e, const Geometry::Point &u, const Geometry::Point &v, const Geometry::Point &w, TEST_IF_VALID_TAG) const
 Constructs a fresh triangular path along the boundary of the colored region.

VertexHandle newBoundaryTriangle (BdEdgeHandle e, const Geometry::Point &u, const Geometry::Point &v, const Geometry::Point &w, DO_IF_VALID_TAG)
 Constructs a fresh triangular path along the boundary of the colored region.

VertexHandle newBoundaryTriangle (BdEdgeHandle e, const Geometry::Point &u, const Geometry::Point &v, const Geometry::Point &w, DO_WITHOUT_TEST_TAG)
 Constructs a fresh triangular path along the boundary of the colored region.

bool newCornerTriangle (VertexHandle corner, const Geometry::Point &u, const Geometry::Point &v, TEST_IF_VALID_TAG) const
 Recolors a triangle in the corner of the colored region by constructing single interior edge that joins boundary vertices on adjacent faces of the boundary.

VertexHandle newCornerTriangle (VertexHandle corner, const Geometry::Point &u, const Geometry::Point &v, DO_IF_VALID_TAG)
 Recolors a triangle in the corner of the colored region by constructing single interior edge that joins boundary vertices on adjacent faces of the boundary.

VertexHandle newCornerTriangle (VertexHandle corner, const Geometry::Point &u, const Geometry::Point &v, DO_WITHOUT_TEST_TAG)
 Recolors a triangle in the corner of the colored region by constructing single interior edge that joins boundary vertices on adjacent faces of the boundary.

bool deleteIntTriangle (VertexHandle vh, TEST_IF_VALID_TAG) const
 Removes an interior triangle from the coloring.

bool deleteIntTriangle (VertexHandle &vh, DO_IF_VALID_TAG)
 Removes an interior triangle from the coloring.

bool deleteIntTriangle (VertexHandle &vh, DO_WITHOUT_TEST_TAG)
 Removes an interior triangle from the coloring.

bool deleteBdTriangle (VertexHandle vh, TEST_IF_VALID_TAG) const
 Removes a boundary triangle from the coloring.

bool deleteBdTriangle (VertexHandle &vh, DO_IF_VALID_TAG)
 Removes a boundary triangle from the coloring.

bool deleteBdTriangle (VertexHandle &vh, DO_WITHOUT_TEST_TAG)
 Removes a boundary triangle from the coloring.

bool deleteCornerTriangle (VertexHandle vh, TEST_IF_VALID_TAG) const
 Removes a corner triangle from the coloring.

bool deleteCornerTriangle (VertexHandle &vh, DO_IF_VALID_TAG)
 Removes a corner triangle from the coloring.

bool deleteCornerTriangle (VertexHandle &vh, DO_WITHOUT_TEST_TAG)
 Removes a corner triangle from the coloring.

bool moveIntVertex (VertexHandle v, const Geometry::Point &p, TEST_IF_VALID_TAG) const
 Moves an interior vertex to the supplied location.

bool moveIntVertex (VertexHandle &v, const Geometry::Point &p, DO_IF_VALID_TAG)
 Moves an interior vertex to the supplied location.

bool moveIntVertex (VertexHandle &v, const Geometry::Point &p, DO_WITHOUT_TEST_TAG)
 Moves an interior vertex to the supplied location.

bool moveVertexAlongBd (VertexHandle v, const Geometry::Point &p, TEST_IF_VALID_TAG) const
 Moves a boundary vertex to the supplied location on the same face of the boundary.

bool moveVertexAlongBd (VertexHandle &v, const Geometry::Point &p, DO_IF_VALID_TAG)
 Moves a boundary vertex to the supplied location on the same face of the boundary.

bool moveVertexAlongBd (VertexHandle &v, const Geometry::Point &p, DO_WITHOUT_TEST_TAG)
 Moves a boundary vertex to the supplied location on the same face of the boundary.

bool moveBdVertexPastCorner (BdEdgeHandle e, const Geometry::Point &p, TEST_IF_VALID_TAG) const
 Moves a boundary vertex past a corner vertex to an adjacent face of the boundary.

bool moveBdVertexPastCorner (BdEdgeHandle &e, const Geometry::Point &p, DO_IF_VALID_TAG)
 Moves a boundary vertex past a corner vertex to an adjacent face of the boundary.

bool moveBdVertexPastCorner (BdEdgeHandle &e, const Geometry::Point &p, DO_WITHOUT_TEST_TAG)
 Moves a boundary vertex past a corner vertex to an adjacent face of the boundary.

bool recolorQuadrilateral (IntEdgeHandle ab, IntEdgeHandle cd, bool ac, TEST_IF_VALID_TAG) const
 Recolors a quadrilateral region of the colorings.

bool recolorQuadrilateral (IntEdgeHandle &ab, IntEdgeHandle &cd, bool ac, DO_IF_VALID_TAG)
 Recolors a quadrilateral region of the colorings.

bool recolorQuadrilateral (IntEdgeHandle &ab, IntEdgeHandle &cd, bool ac, DO_WITHOUT_TEST_TAG)

Protected Member Functions

VertexHandle newVertex (Vertex::Type type, const Geometry::Point &p)
 Returns a reference to a fresh vertex.

void freeVertex (VertexHandle &v)
 Frees a vertex for future use.

void disconnectFromBd (VertexHandle v)
 Disconnects a boundary vertex from its incident boundary edges.

IntEdgeHandle newInteriorEdge (VertexHandle prev, VertexHandle next)
 Returns a reference to a fresh interior edge that leads from prev to next.

BdEdgeHandle newBoundaryEdge (VertexHandle prev, VertexHandle next, VertexHandle prevCorner, VertexHandle nextCorner)
 Returns a reference to a fresh boundary edge that leads from prev to next.

void freeEdge (IntEdgeHandle &e)
 Frees an interior edge for future use.

void freeEdge (BdEdgeHandle &e)
 Frees a boundary edge for future use.

void recolored (const Geometry::Point &a, const Geometry::Point &b, const Geometry::Point &c)
 This helper method performs all necessary updates (including informing listeners) when the triangle with the supplied vertices has been recolored.

void recolored (const Geometry::Point &a, const Geometry::Point &b, const Geometry::Point &c, const Geometry::Point &d)
 This helper method performs all necessary updates (including informing listeners) when the quadrilateral with the supplied vertices has been recolored.

void notifyVertexWillBeRemoved (VertexHandle vh)
 Notifies all listeners that the vertex with the supplied handle will be removed from the coloring.

void notifyVertexHasBeenAdded (VertexHandle vh)
 Notifies all listeners that the vertex with the supplied handle has been added to the coloring.

void notifyEdgeWillBeRemoved (IntEdgeHandle eh)
 Notifies all listeners that the edge with the supplied handle will be removed from the coloring.

void notifyEdgeHasBeenAdded (IntEdgeHandle eh)
 Notifies all listeners that the edge with the supplied handle has been added to the coloring.

void initialize (Geometry::Rectangle &boundary, int gridRows=10, int gridCols=10, double minEdgeLength=0.0)
 Initializes this coloring.

void clear ()
 Deallocates all internal structures in this coloring.


Protected Attributes

Geometry::Rectangle bd
 An axis-aligned rectangle representing the boundary of the colored region.

InteriorEdgeIndexintEdgeIndex
 A grid of cells that record all crossing interior edges.

QueryPointIndexqueryPoints
 An index of points in the interior of the coloring whose colors are maintained under updates.

Store< VertexvertexStore
 A store of (potential) vertices to be used in the coloring.

std::vector< VertexHandleinteriorVertices
 A vector of pointers to vertices in the interior of the region.

std::vector< VertexHandleboundaryVertices
 An vector of pointers to vertices on the boundary of the region.

std::vector< VertexHandlecornerVertices
 A vector of pointers to vertices at the corner of the region.

Store< InteriorEdgeintEdgeStore
 A store of (potential) interior edges to be used in the coloring.

std::vector< IntEdgeHandleinteriorEdges
 A vector of pointers to edges in the interior of the region.

Store< BoundaryEdgebdEdgeStore
 A store of (potential) boundary edges to be used in the coloring.

std::vector< BdEdgeHandleboundaryEdges
 An vector of pointers to edges on the boundary of the colored region.

std::list< Listener * > listeners
 A list of the objects that are listening to this coloring.

double minEdgeLengthSq
 This value is a constraint on the (squared) minimum edge length.


Member Typedef Documentation

typedef PointerHandle<BoundaryEdge> Arak::Coloring::BdEdgeHandle
 

Definition at line 87 of file coloring.hpp.

Referenced by disconnectFromBd(), Arak::CN94Proposal::BoundaryTriangleBirth::execute(), freeEdge(), getBoundaryEdge(), Arak::Coloring::Vertex::getNextBdEdge(), Arak::Coloring::Vertex::getPrevBdEdge(), Arak::CN94Proposal::ll(), moveBdVertexPastCorner(), moveVertexAlongBd(), newBoundaryEdge(), newBoundaryTriangle(), newCornerTriangle(), newVertex(), read(), readBinary(), Arak::CN94Proposal::BoundaryTriangleBirth::reset(), Arak::CN94Proposal::MoveBdVertexPastCorner::reset(), Arak::CN94Proposal::rll(), Arak::ModifiedCN94Proposal::sampleBoundaryTriangleBirth(), Arak::CN94Proposal::sampleBoundaryTriangleBirth(), Arak::CN94Proposal::sampleBoundaryTriangleDeath(), Arak::CN94Proposal::sampleCornerCutBirth(), Arak::CN94Proposal::sampleMoveBdVertexPastCorner(), test(), Arak::CN94Proposal::BoundaryTriangleDeath::undo(), visualize(), write(), and writeBinary().

typedef PointerHandle<InteriorEdge> Arak::Coloring::IntEdgeHandle
 

Definition at line 85 of file coloring.hpp.

Referenced by color(), compatible(), Arak::coneTrace(), deleteBdTriangle(), deleteCornerTriangle(), deleteIntTriangle(), deleteVertex(), Arak::Coloring::Listener::edgeHasBeenAdded(), Arak::ArakPrior::edgeHasBeenAdded(), Arak::Coloring::Listener::edgeWillBeRemoved(), Arak::ArakPrior::edgeWillBeRemoved(), Arak::CN94Proposal::InteriorVertexBirth::execute(), freeEdge(), getInteriorEdge(), Arak::Coloring::Vertex::getNextIntEdge(), Arak::Coloring::Vertex::getPrevIntEdge(), Arak::ScanEdge::init(), Arak::ModifiedCN94Proposal::ll(), localRecolorSampleProb(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), newInteriorEdge(), newInteriorTriangle(), newVertex(), notifyEdgeHasBeenAdded(), notifyEdgeWillBeRemoved(), recolorQuadrilateral(), Arak::CN94Proposal::InteriorVertexBirth::reset(), Arak::CN94Proposal::Recolor::reset(), Arak::ArakPosteriorRangeObs::retraceObs(), Arak::CN94Proposal::sampleInteriorVertexBirth(), Arak::ModifiedCN94Proposal::sampleRecolor(), Arak::CN94Proposal::sampleRecolor(), Arak::ModifiedCN94Proposal::sampleSlideInteriorVertex(), solid(), splitEdge(), test(), toTriangulation(), trace(), Arak::CN94Proposal::InteriorVertexDeath::undo(), Arak::CriticalStatsEstimator::update(), visualize(), write(), and writeBinary().

typedef Grid<IntEdgeHandle> Arak::Coloring::InteriorEdgeIndex
 

A grid where each cell stores pointers to all interior edges whose segments intersect the cell's boundary.

Definition at line 681 of file coloring.hpp.

Referenced by Arak::computeFirstSonarImpact(), Arak::coneTrace(), getInteriorEdgeIndex(), initialize(), and Arak::CriticalStatsEstimator::update().

typedef PointerHandle<Vertex> Arak::Coloring::VertexHandle
 

Definition at line 83 of file coloring.hpp.

Referenced by deleteBdTriangle(), deleteCornerTriangle(), deleteIntTriangle(), deleteVertex(), disconnectFromBd(), Arak::CN94Proposal::InteriorVertexDeath::execute(), Arak::CN94Proposal::Recolor::execute(), freeEdge(), freeVertex(), Arak::Coloring::BoundaryEdge::getNextCornerVertex(), Arak::Coloring::Vertex::getNextCornerVertex(), Arak::Coloring::Edge::getNextVertex(), Arak::Coloring::Vertex::getNextVertex(), Arak::Coloring::BoundaryEdge::getPrevCornerVertex(), Arak::Coloring::Vertex::getPrevCornerVertex(), Arak::Coloring::Edge::getPrevVertex(), Arak::Coloring::Vertex::getPrevVertex(), getVertex(), initialize(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryEdge(), newBoundaryTriangle(), newCornerTriangle(), newInteriorEdge(), newInteriorTriangle(), newVertex(), notifyVertexHasBeenAdded(), notifyVertexWillBeRemoved(), Arak::CN94Proposal::proposeBdTriangleDeath(), Arak::CN94Proposal::proposeIntTriangleDeath(), Arak::CN94Proposal::proposeIntVertexDeath(), Arak::Coloring::BoundaryEdge::randomPoint(), randomVertex(), recolorQuadrilateral(), Arak::ModifiedCN94Proposal::SlideInteriorVertex::reset(), Arak::CN94Proposal::CornerCutDeath::reset(), Arak::CN94Proposal::CornerCutBirth::reset(), Arak::CN94Proposal::BoundaryTriangleDeath::reset(), Arak::CN94Proposal::BoundaryTriangleBirth::reset(), Arak::CN94Proposal::MoveVertexAlongBdEdge::reset(), Arak::CN94Proposal::MoveInteriorVertex::reset(), Arak::CN94Proposal::InteriorVertexDeath::reset(), Arak::CN94Proposal::InteriorTriangleDeath::reset(), Arak::CN94Proposal::InteriorTriangleBirth::reset(), Arak::ModifiedCN94Proposal::rll(), Arak::CN94Proposal::sampleBoundaryTriangleDeath(), Arak::CN94Proposal::sampleCornerCutBirth(), Arak::CN94Proposal::sampleCornerCutDeath(), Arak::CN94Proposal::sampleInteriorDeath(), Arak::CN94Proposal::sampleMoveBdVertexPastCorner(), Arak::CN94Proposal::sampleMoveInteriorVertex(), Arak::CN94Proposal::sampleMoveVertexAlongBd(), Arak::ModifiedCN94Proposal::sampleSlideInteriorVertex(), solid(), splitEdge(), test(), toTriangulation(), trace(), Arak::CN94Proposal::InteriorVertexBirth::undo(), Arak::CriticalStatsEstimator::update(), Arak::Coloring::Listener::vertexHasBeenAdded(), Arak::ArakPrior::vertexHasBeenAdded(), Arak::Coloring::Listener::vertexWillBeRemoved(), Arak::ArakPrior::vertexWillBeRemoved(), visualize(), write(), and writeBinary().


Constructor & Destructor Documentation

Coloring::Coloring  ) 
 

Default constructor.

Definition at line 282 of file coloring.cpp.

References initialize(), and Arak::Geometry::Rectangle.

Coloring::Coloring Geometry::Rectangle boundary,
int  gridRows = 10,
int  gridCols = 10,
double  minEdgeLength = 0.0
 

Constructor.

The caller supplies the boundary of the colored region. The caller can optionally specify the dimensions of a grid index over the edges in the coloring; this is used to check for crossing edges and to compute the coloring of an arbitrary point in the region.

Parameters:
boundary an axis-aligned rectangle representing the boundary of the colored region.
gridRows the number of rows in the cell grid
gridCols the number of columns in the cell grid
minEdgeLength a constraint on the minimum edge length

Definition at line 289 of file coloring.cpp.

References initialize(), and Arak::Geometry::Rectangle.

Coloring::Coloring const Util::PropertyMap props  ) 
 

Constructor.

The caller supplies the boundary of the colored region. The caller can optionally specify the dimensions of a grid index over the edges in the coloring; this is used to check for crossing edges and to compute the coloring of an arbitrary point in the region.

Parameters:
props a property map

Definition at line 295 of file coloring.cpp.

References boundary(), initialize(), Arak::Util::PropertyMap, and Arak::Geometry::Rectangle.

Coloring::~Coloring  ) 
 

Destructor.

Definition at line 343 of file coloring.cpp.

References clear().


Member Function Documentation

void Coloring::addListener Listener listener  )  const
 

Adds a new listener to this coloring's list of listeners.

Parameters:
listener the new listener

Definition at line 1725 of file coloring.cpp.

References listeners.

Referenced by Arak::ArakPosteriorRangeObs::ArakPosteriorRangeObs(), Arak::ArakPosteriorSonarObs::ArakPosteriorSonarObs(), and Arak::ArakPrior::initialize().

void Coloring::addQueryPoints const QueryPointIndex index  )  const
 

Adds all query points in the supplied index to the internal query point index.

Parameters:
index an index of query points

Definition at line 347 of file coloring.cpp.

References color(), Arak::QueryPointIndex::point(), queryPoints, Arak::QueryPoint::setColor(), Arak::QueryPointIndex::size(), and TEST_VALIDITY.

Referenced by Arak::ArakPosteriorBernoulliObs::ArakPosteriorBernoulliObs(), Arak::ArakPosteriorGaussianObs::ArakPosteriorGaussianObs(), Arak::ArakPosteriorRangeObs::ArakPosteriorRangeObs(), and Arak::ArakPosteriorSonarObs::ArakPosteriorSonarObs().

double Arak::Coloring::area  )  const [inline]
 

Returns the area of the colored region.

Returns:
the area of the colored region

Definition at line 1748 of file coloring.hpp.

References bd.

Referenced by Arak::CN94Proposal::ll(), and Arak::CN94Proposal::rll().

bool Arak::Coloring::boundary const Geometry::Point xp  )  const [inline]
 

Returns true iff xp lies on the boundary of the colored region.

Parameters:
xp a point
Returns:
true iff xp lies on the boundary of the colored region

Definition at line 1719 of file coloring.hpp.

References bd, and Arak::Geometry::Point.

const Geometry::Rectangle& Arak::Coloring::boundary  )  const [inline]
 

Returns the boundary of this coloring.

Returns:
the boundary of this coloring

Definition at line 1201 of file coloring.hpp.

References bd, and Arak::Geometry::Rectangle.

Referenced by Arak::ArakPosteriorRangeObs::ArakPosteriorRangeObs(), Arak::ArakPosteriorSonarObs::ArakPosteriorSonarObs(), Coloring(), Arak::InitGui(), and test().

void Coloring::clear  )  [protected]
 

Deallocates all internal structures in this coloring.

Definition at line 313 of file coloring.cpp.

References boundaryEdges, boundaryVertices, cornerVertices, intEdgeIndex, interiorEdges, interiorVertices, and queryPoints.

Referenced by initialize(), and ~Coloring().

Color Coloring::color const Geometry::Point point  )  const
 

Returns the color of the supplied point.

This operation is expensive (requiring ray tracing); for a more efficient computation, the point should be registered as a query point.

Parameters:
point a point in the interior or on the boundary of the colored region
Returns:
true if the point is colored black, and false if it is white

Definition at line 1645 of file coloring.cpp.

References Arak::QueryPointIndex::closest(), Arak::QueryPoint::color(), Arak::Color, IntEdgeHandle, intEdgeIndex, Arak::INVALID_COLOR, Arak::opposite(), Arak::Geometry::Point, queryPoints, and trace().

Referenced by addQueryPoints(), read(), readBinary(), solid(), test(), Arak::ArakPosteriorSonarObs::updateObsLP(), and Arak::ArakPosteriorRangeObs::updateObsLP().

bool Coloring::compatible const Geometry::Point xp,
const Geometry::Point yp
const
 

Checks to see if the line segment from x to y crosses any edges that are currently in the coloring.

Two (closed) line segments cross iff their intersection is a single point. This method requires that both x and y are in the interior.

Parameters:
xp the origin of the line segment
yp the terminus of the line segment
Returns:
true if a line segment from x to y crosses an edge in the coloring

Definition at line 1545 of file coloring.cpp.

References IntEdgeHandle, intEdgeIndex, and Arak::Geometry::Point.

Referenced by deleteVertex(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), newInteriorTriangle(), recolorQuadrilateral(), solid(), and splitEdge().

void Coloring::disconnectFromBd VertexHandle  v  )  [protected]
 

Disconnects a boundary vertex from its incident boundary edges.

These boundary edges are replaced by a single boundary edge.

Parameters:
v a handle to the boundary vertex to be disconnected

Definition at line 900 of file coloring.cpp.

References BdEdgeHandle, freeEdge(), newBoundaryEdge(), and VertexHandle.

Referenced by deleteBdTriangle(), and deleteCornerTriangle().

void Coloring::freeEdge BdEdgeHandle e  )  [protected]
 

Frees a boundary edge for future use.

Parameters:
e a reference to the edge to be freed

Definition at line 490 of file coloring.cpp.

References BdEdgeHandle, bdEdgeStore, boundaryEdges, Store< BoundaryEdge >::deleteItem(), PointerHandle< T >::valid(), and VertexHandle.

void Coloring::freeEdge IntEdgeHandle e  )  [protected]
 

Frees an interior edge for future use.

Parameters:
e a reference to the edge to be freed

Definition at line 449 of file coloring.cpp.

References Store< InteriorEdge >::deleteItem(), IntEdgeHandle, intEdgeStore, interiorEdges, PointerHandle< T >::valid(), and VertexHandle.

Referenced by deleteBdTriangle(), deleteCornerTriangle(), deleteIntTriangle(), deleteVertex(), disconnectFromBd(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), read(), readBinary(), recolorQuadrilateral(), and splitEdge().

void Coloring::freeVertex VertexHandle v  )  [protected]
 

Frees a vertex for future use.

Parameters:
v a reference to the Vertex to be freed

Definition at line 395 of file coloring.cpp.

References boundaryVertices, cornerVertices, Store< Vertex >::deleteItem(), interiorVertices, PointerHandle< T >::valid(), VertexHandle, and vertexStore.

Referenced by deleteBdTriangle(), deleteCornerTriangle(), deleteIntTriangle(), deleteVertex(), moveBdVertexPastCorner(), moveIntVertex(), and moveVertexAlongBd().

BdEdgeHandle Arak::Coloring::getBoundaryEdge int  index  )  [inline]
 

Definition at line 1313 of file coloring.hpp.

References BdEdgeHandle, and boundaryEdges.

const BdEdgeHandle Arak::Coloring::getBoundaryEdge int  index  )  const [inline]
 

Returns a const reference to the boundary edge with the supplied index.

Parameters:
index an index between 0 and numBoundaryEdges() - 1
Returns:
a const reference to the edge

Definition at line 1310 of file coloring.hpp.

References BdEdgeHandle, and boundaryEdges.

Referenced by read(), readBinary(), Arak::ModifiedCN94Proposal::sampleBoundaryTriangleBirth(), Arak::CN94Proposal::sampleBoundaryTriangleBirth(), Arak::CN94Proposal::sampleBoundaryTriangleDeath(), test(), visualize(), write(), and writeBinary().

IntEdgeHandle Arak::Coloring::getInteriorEdge int  index  )  [inline]
 

Definition at line 1299 of file coloring.hpp.

References IntEdgeHandle, and interiorEdges.

const IntEdgeHandle Arak::Coloring::getInteriorEdge int  index  )  const [inline]
 

Returns a const reference to the interior edge with the supplied index.

Parameters:
index an index between 0 and numInteriorEdges() - 1
Returns:
a const reference to the edge

Definition at line 1296 of file coloring.hpp.

References IntEdgeHandle, and interiorEdges.

Referenced by Arak::ArakPrior::initialize(), Arak::CN94Proposal::sampleInteriorVertexBirth(), Arak::ModifiedCN94Proposal::sampleRecolor(), Arak::CN94Proposal::sampleRecolor(), test(), toTriangulation(), visualize(), write(), and writeBinary().

const InteriorEdgeIndex& Arak::Coloring::getInteriorEdgeIndex  )  const [inline]
 

Returns a const reference to the interior edge index.

Definition at line 1206 of file coloring.hpp.

References intEdgeIndex, and InteriorEdgeIndex.

Referenced by Arak::computeFirstSonarImpact(), Arak::coneTrace(), and Arak::CriticalStatsEstimator::update().

void Coloring::getPointWithColor Geometry::Point p,
Color c
const
 

Computes a point in the interior of the coloring and its color.

From this colored point the colors of all other points can be deduced from the discontinuity set.

Definition at line 1755 of file coloring.cpp.

References Arak::QueryPoint::color(), Arak::QueryPointIndex::point(), Arak::Geometry::Point, and queryPoints.

Referenced by toTriangulation(), write(), and writeBinary().

QueryPointIndex& Arak::Coloring::getQueryPoints  )  [inline]
 

Returns a reference to the query point index.

Definition at line 1819 of file coloring.hpp.

References queryPoints.

const QueryPointIndex& Arak::Coloring::getQueryPoints  )  const [inline]
 

Returns a const reference to the query point index.

Definition at line 1814 of file coloring.hpp.

References queryPoints.

Referenced by visualize().

VertexHandle Arak::Coloring::getVertex Vertex::Type  type,
int  index
[inline]
 

Returns a mutable reference to the vertex with the supplied type and index.

Parameters:
type a type of vertex
index an index between 0 and numVertices(type) - 1
Returns:
a mutable reference to the vertex

Definition at line 1258 of file coloring.hpp.

References boundaryVertices, cornerVertices, interiorVertices, and VertexHandle.

const VertexHandle Arak::Coloring::getVertex Vertex::Type  type,
int  index
const [inline]
 

Returns a const reference to the vertex with the supplied type and index.

Parameters:
type a type of vertex
index an index between 0 and numVertices(type) - 1
Returns:
a reference to the vertex

Definition at line 1237 of file coloring.hpp.

References boundaryVertices, cornerVertices, interiorVertices, and VertexHandle.

Referenced by Arak::ArakPrior::initialize(), randomVertex(), read(), readBinary(), test(), toTriangulation(), Arak::CriticalStatsEstimator::update(), visualize(), write(), and writeBinary().

void Coloring::initialize Geometry::Rectangle boundary,
int  gridRows = 10,
int  gridCols = 10,
double  minEdgeLength = 0.0
[protected]
 

Initializes this coloring.

The caller supplies the boundary of the colored region and the dimensions of a grid index over the edges in the coloring; this is used to check for crossing edges and to compute the coloring of an arbitrary point in the region.

Parameters:
boundary an axis-aligned rectangle representing the boundary of the colored region.
gridRows the number of rows in the cell grid
gridCols the number of columns in the cell grid
minEdgeLength (optional) a constraint on edge lengths

Definition at line 248 of file coloring.cpp.

References bd, clear(), intEdgeIndex, interior(), InteriorEdgeIndex, minEdgeLengthSq, newBoundaryEdge(), newVertex(), numBoundaryEdges(), numVertices(), Arak::QueryPointIndex::point(), queryPoints, Arak::Geometry::Rectangle, Arak::QueryPoint::setColor(), Arak::QueryPointIndex::size(), TEST_VALIDITY, VertexHandle, and Arak::WHITE.

Referenced by Coloring(), read(), and readBinary().

bool Arak::Coloring::interior const Geometry::Point xp  )  const [inline]
 

Returns true iff xp is in the interior of the colored region.

Parameters:
xp a point
Returns:
true iff xp is in the interior of the colored region

Definition at line 1709 of file coloring.hpp.

References bd, and Arak::Geometry::Point.

Referenced by initialize(), moveIntVertex(), newBoundaryTriangle(), newInteriorTriangle(), Arak::ModifiedCN94Proposal::sampleBoundaryTriangleBirth(), Arak::CN94Proposal::sampleBoundaryTriangleBirth(), Arak::CN94Proposal::sampleInteriorTriangleBirth(), Arak::CN94Proposal::sampleInteriorVertexBirth(), Arak::CN94Proposal::sampleMoveInteriorVertex(), Arak::ModifiedCN94Proposal::sampleSlideInteriorVertex(), and test().

Coloring::BdEdgeHandle Coloring::newBoundaryEdge VertexHandle  prev,
VertexHandle  next,
VertexHandle  prevCorner,
VertexHandle  nextCorner
[protected]
 

Returns a reference to a fresh boundary edge that leads from prev to next.

prev and next are both modified so that the new edge joins them.

Parameters:
prev the previous boundary vertex
next the next boundary vertex
prevCorner the previous corner vertex
nextCorner the next corner vertex
Returns:
the fresh boundary edge

Definition at line 220 of file coloring.cpp.

References BdEdgeHandle, bdEdgeStore, boundaryEdges, Store< BoundaryEdge >::newItem(), Arak::Geometry::Segment, PointerHandle< T >::valid(), and VertexHandle.

Referenced by disconnectFromBd(), initialize(), moveBdVertexPastCorner(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), read(), and readBinary().

Coloring::IntEdgeHandle Coloring::newInteriorEdge VertexHandle  prev,
VertexHandle  next
[protected]
 

Returns a reference to a fresh interior edge that leads from prev to next.

prev and next are both modified so that the new edge joins them.

Parameters:
prev the previous vertex
next the next vertex
Returns:
the fresh interior edge

Definition at line 177 of file coloring.cpp.

References IntEdgeHandle, intEdgeIndex, intEdgeStore, interiorEdges, Store< InteriorEdge >::newItem(), Arak::Geometry::Segment, PointerHandle< T >::valid(), and VertexHandle.

Referenced by deleteVertex(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), newInteriorTriangle(), read(), readBinary(), recolorQuadrilateral(), and splitEdge().

Coloring::VertexHandle Coloring::newVertex Vertex::Type  type,
const Geometry::Point p
[protected]
 

Returns a reference to a fresh vertex.

Parameters:
type the type of the new vertex
p the location of the vertex
Returns:
a reference to a new Vertex object

Definition at line 362 of file coloring.cpp.

References BdEdgeHandle, boundaryVertices, cornerVertices, IntEdgeHandle, interiorVertices, Store< Vertex >::newItem(), Arak::Geometry::Point, VertexHandle, and vertexStore.

Referenced by initialize(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), newInteriorTriangle(), read(), readBinary(), and splitEdge().

void Arak::Coloring::notifyEdgeHasBeenAdded IntEdgeHandle  eh  )  [inline, protected]
 

Notifies all listeners that the edge with the supplied handle has been added to the coloring.

Definition at line 1120 of file coloring.hpp.

References IntEdgeHandle, and listeners.

Referenced by deleteVertex(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), newInteriorTriangle(), recolorQuadrilateral(), and splitEdge().

void Arak::Coloring::notifyEdgeWillBeRemoved IntEdgeHandle  eh  )  [inline, protected]
 

Notifies all listeners that the edge with the supplied handle will be removed from the coloring.

Definition at line 1110 of file coloring.hpp.

References IntEdgeHandle, and listeners.

Referenced by deleteBdTriangle(), deleteCornerTriangle(), deleteIntTriangle(), deleteVertex(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), recolorQuadrilateral(), and splitEdge().

void Arak::Coloring::notifyVertexHasBeenAdded VertexHandle  vh  )  [inline, protected]
 

Notifies all listeners that the vertex with the supplied handle has been added to the coloring.

Definition at line 1100 of file coloring.hpp.

References listeners, and VertexHandle.

Referenced by deleteVertex(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), newInteriorTriangle(), recolorQuadrilateral(), and splitEdge().

void Arak::Coloring::notifyVertexWillBeRemoved VertexHandle  vh  )  [inline, protected]
 

Notifies all listeners that the vertex with the supplied handle will be removed from the coloring.

Definition at line 1090 of file coloring.hpp.

References listeners, and VertexHandle.

Referenced by deleteBdTriangle(), deleteCornerTriangle(), deleteIntTriangle(), deleteVertex(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), recolorQuadrilateral(), and splitEdge().

int Arak::Coloring::numBoundaryEdges  )  const [inline]
 

Returns the number of boundary edges in the coloring.

Returns:
the number of boundary edges

Definition at line 1285 of file coloring.hpp.

References boundaryEdges.

Referenced by initialize(), Arak::ModifiedCN94Proposal::ll(), Arak::CN94Proposal::ll(), moveBdVertexPastCorner(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), read(), readBinary(), Arak::ModifiedCN94Proposal::rll(), Arak::CN94Proposal::rll(), Arak::ModifiedCN94Proposal::sampleBoundaryTriangleBirth(), Arak::CN94Proposal::sampleBoundaryTriangleBirth(), Arak::CN94Proposal::sampleBoundaryTriangleDeath(), test(), visualize(), write(), and writeBinary().

int Arak::Coloring::numInteriorEdges  )  const [inline]
 

Returns the number of interior edges in the coloring.

Returns:
the number of interior edges

Definition at line 1276 of file coloring.hpp.

References interiorEdges.

Referenced by Arak::ArakPrior::initialize(), Arak::ModifiedCN94Proposal::ll(), Arak::CN94Proposal::ll(), localRecolorSampleProb(), Arak::ArakPrior::logMeasure(), Arak::ModifiedCN94Proposal::rll(), Arak::CN94Proposal::rll(), Arak::CN94Proposal::sampleInteriorVertexBirth(), Arak::ModifiedCN94Proposal::sampleRecolor(), Arak::CN94Proposal::sampleRecolor(), test(), toTriangulation(), Arak::CriticalStatsEstimator::update(), visualize(), write(), and writeBinary().

int Arak::Coloring::numVertices Vertex::Type  type  )  const [inline]
 

Returns the number of vertices of the supplied type.

Parameters:
type a type of vertex
Returns:
the number of vertices of the supplied type

Definition at line 1216 of file coloring.hpp.

References boundaryVertices, cornerVertices, and interiorVertices.

Referenced by initialize(), Arak::ArakPrior::initialize(), Arak::ModifiedCN94Proposal::ll(), Arak::CN94Proposal::ll(), randomVertex(), Arak::ModifiedCN94Proposal::rll(), Arak::CN94Proposal::rll(), Arak::CN94Proposal::sampleInteriorDeath(), Arak::CN94Proposal::sampleMoveInteriorVertex(), Arak::CN94Proposal::sampleMoveVertexAlongBd(), Arak::ModifiedCN94Proposal::sampleSlideInteriorVertex(), test(), toTriangulation(), Arak::CriticalStatsEstimator::update(), visualize(), write(), and writeBinary().

bool Arak::Coloring::operator!= const Coloring other  )  const [inline]
 

An inequality operator.

Two colorings are equal iff they are the same object.

Definition at line 1906 of file coloring.hpp.

bool Arak::Coloring::operator== const Coloring other  )  const [inline]
 

An equality operator.

Two colorings are equal iff they are the same object.

Definition at line 1898 of file coloring.hpp.

bool Arak::Coloring::outside const Geometry::Point xp  )  const [inline]
 

Returns true iff xp lies outside the closure of the colored region.

Parameters:
xp a point
Returns:
true iff xp lies outside the closure of the colored region

Definition at line 1729 of file coloring.hpp.

References bd, and Arak::Geometry::Point.

Geometry::Point Coloring::randomPoint Arak::Util::Random random = Arak::Util::default_random  )  const
 

Returns a point sampled uniformly at random from the interior of the colored region.

Parameters:
random a source of pseudorandomness
Returns:
a random point in the region

Todo:
Make sure this generates a point in the interior, independent of the numerical representation.

Definition at line 1634 of file coloring.cpp.

References bd, Point, Arak::Geometry::Point, and Arak::Util::Random::uniform().

Referenced by Arak::CriticalStatsEstimator::CriticalStatsEstimator(), and Arak::CN94Proposal::sampleInteriorTriangleBirth().

VertexHandle Arak::Coloring::randomVertex Vertex::Type  type,
Arak::Util::Random random = Arak::Util::default_random
const [inline]
 

Returns a reference to a vertex with the supplied type selected uniformly at random.

Parameters:
type a type of vertex
random a source of pseudorandomness
Returns:
a reference to the vertex

Definition at line 1761 of file coloring.hpp.

References getVertex(), numVertices(), and VertexHandle.

Referenced by Arak::CN94Proposal::sampleCornerCutBirth(), Arak::CN94Proposal::sampleCornerCutDeath(), Arak::CN94Proposal::sampleInteriorDeath(), Arak::CN94Proposal::sampleMoveBdVertexPastCorner(), Arak::CN94Proposal::sampleMoveInteriorVertex(), Arak::CN94Proposal::sampleMoveVertexAlongBd(), and Arak::ModifiedCN94Proposal::sampleSlideInteriorVertex().

bool Coloring::read std::istream &  in  ) 
 

Initializes this coloring from a text representation read from the supplied stream.

Parameters:
in the input stream to read the coloring from
Returns:
true if the read was successful, false otherwise

Definition at line 2112 of file coloring.cpp.

References bd, BdEdgeHandle, Arak::BLACK, Arak::QueryPoint::color(), color(), Arak::Color, freeEdge(), getBoundaryEdge(), getVertex(), initialize(), intEdgeIndex, newBoundaryEdge(), newInteriorEdge(), newVertex(), numBoundaryEdges(), Arak::Grid< ItemType >::numCols(), Arak::Grid< ItemType >::numRows(), Arak::opposite(), Arak::QueryPointIndex::point(), Arak::Geometry::Point, queryPoints, Arak::Geometry::Rectangle, Arak::QueryPoint::setColor(), Arak::QueryPointIndex::size(), Arak::skipcomments(), test(), and Arak::WHITE.

Referenced by Arak::operator>>().

bool Coloring::readBinary std::istream &  in  ) 
 

Initializes this coloring from a binary representation read from the supplied stream.

Parameters:
in the input stream to read the coloring from
Returns:
true if the read was successful, false otherwise

Definition at line 2233 of file coloring.cpp.

References bd, BdEdgeHandle, Arak::BLACK, Arak::QueryPoint::color(), color(), Arak::Color, freeEdge(), getBoundaryEdge(), getVertex(), initialize(), intEdgeIndex, newBoundaryEdge(), newInteriorEdge(), newVertex(), numBoundaryEdges(), Arak::Grid< ItemType >::numCols(), Arak::Grid< ItemType >::numRows(), Arak::opposite(), Arak::QueryPointIndex::point(), Arak::Geometry::Point, queryPoints, Arak::Geometry::Rectangle, Arak::QueryPoint::setColor(), Arak::QueryPointIndex::size(), test(), and Arak::WHITE.

Referenced by main().

void Coloring::recolored const Geometry::Point a,
const Geometry::Point b,
const Geometry::Point c,
const Geometry::Point d
[protected]
 

This helper method performs all necessary updates (including informing listeners) when the quadrilateral with the supplied vertices has been recolored.

The vertices are supplied in either clockwise or counter-clockwise order. Note that this quadrilateral is simple, but not necessarily convex.

Parameters:
a the first vertex of the quadrilateral
b the second vertex of the quadrilateral
c the third vertex of the quadrilateral
d the fourth vertex of the quadrilateral

Definition at line 1743 of file coloring.cpp.

References listeners, Arak::Geometry::Point, queryPoints, Arak::QueryPointIndex::recolor(), and Arak::Coloring::Listener::recolored().

void Coloring::recolored const Geometry::Point a,
const Geometry::Point b,
const Geometry::Point c
[protected]
 

This helper method performs all necessary updates (including informing listeners) when the triangle with the supplied vertices has been recolored.

Parameters:
a the first vertex of the triangle
b the second vertex of the triangle
c the third vertex of the triangle

Definition at line 1732 of file coloring.cpp.

References listeners, Arak::Geometry::Point, queryPoints, Arak::QueryPointIndex::recolor(), and Arak::Coloring::Listener::recolored().

Referenced by deleteBdTriangle(), deleteCornerTriangle(), deleteIntTriangle(), deleteVertex(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), newInteriorTriangle(), recolorQuadrilateral(), and splitEdge().

bool Coloring::solid const Geometry::Polygon poly,
Arak::Color  color
const
 

Returns true iff every point in the closure of the supplied convex polygon is the supplied color.

Parameters:
poly a convex polygon
color the text color
Returns:
true iff every point in poly is the supplied color

Definition at line 1684 of file coloring.cpp.

References color(), compatible(), IntEdgeHandle, intEdgeIndex, Arak::Geometry::Polygon, and VertexHandle.

void Coloring::test  )  const
 

Tests the integrity of this Coloring object.

An error is raised if this test fails.

Definition at line 73 of file coloring.cpp.

References bd, BdEdgeHandle, boundary(), Arak::QueryPoint::color(), color(), getBoundaryEdge(), getInteriorEdge(), getVertex(), IntEdgeHandle, interior(), minEdgeLengthSq, numBoundaryEdges(), numInteriorEdges(), numVertices(), Arak::QueryPointIndex::point(), queryPoints, Arak::Geometry::Segment, Arak::QueryPointIndex::size(), and VertexHandle.

Referenced by read(), and readBinary().

template<typename FaceInfoType>
void Arak::Coloring::toTriangulation CGAL::Constrained_Delaunay_triangulation_2< Geometry::Kernel, CGAL::Tds2< CGAL::Tvb< Arak::Geometry::Kernel, CGAL::Tdsvb< void > >, CGAL::Ctfb< Geometry::Kernel, CGAL::Triangulation_face_base_with_info_2< FaceInfoType, Geometry::Kernel, CGAL::Tfb< Arak::Geometry::Kernel, CGAL::Tdsfb< void > > > > >, CGAL::No_intersection_tag > &  tri  )  const
 

Computes a representation of this coloring as a constrained triangulation.

Each constrained edge represents a color discontinuity and the faces are annotated with their colors. The FaceInfoType supplied as a template parameter must derive from FaceColorInfo.

Todo:
I can't get this to compile when I use the typedef "typename Triangulation<FaceInfoType>::Triangulation" as the parameter type.
Parameters:
tri the triangulation that is first cleared, and then updated to represent this coloring

Definition at line 1937 of file coloring.hpp.

References Arak::Color, getInteriorEdge(), getPointWithColor(), getVertex(), IntEdgeHandle, Arak::INVALID_COLOR, Arak::Geometry::Kernel, numInteriorEdges(), numVertices(), Arak::opposite(), Arak::Geometry::Point, and VertexHandle.

Referenced by visualize(), and writeXfig().

bool Coloring::trace const Geometry::Point xp,
const Geometry::Point yp,
IntEdgeHandle edge,
Geometry::Point ipt,
Geometry::Kernel::FT &  sd
const
 

Traces the segment from xp to yp and finds the first interior edge that intersects the segment (if any).

Parameters:
xp a point in the interior of the coloring
yp a point distinct from xp
edge a handle an interior edge that is updated to the first interior edge intersecting the segment (if any)
ipt the intersection point (if any)
sd updated to the squared distance between xp and the intersection point (if any)
Returns:
true if there is an intersecting edge

Definition at line 1576 of file coloring.cpp.

References IntEdgeHandle, intEdgeIndex, Arak::intersection(), Arak::Geometry::Point, Arak::Geometry::Segment, PointerHandle< T >::valid(), and VertexHandle.

Referenced by color(), and Arak::ArakPosteriorRangeObs::retraceObs().

void Coloring::visualize CGAL::Qt_widget &  widget,
bool  drawEdges = true,
bool  drawVertices = true,
bool  drawRegions = false,
bool  drawQueries = false
const
 

Visualizes this coloring on the supplied widget.

Definition at line 1761 of file coloring.cpp.

References bd, BdEdgeHandle, Arak::BLACK, Arak::QueryPoint::color(), getBoundaryEdge(), getInteriorEdge(), getQueryPoints(), getVertex(), IntEdgeHandle, numBoundaryEdges(), numInteriorEdges(), numVertices(), Arak::QueryPointIndex::point(), queryPoints, Arak::QueryPointIndex::size(), toTriangulation(), Arak::Geometry::Triangle, and VertexHandle.

Referenced by Arak::ColoringQTLayer::draw().

void Coloring::write std::ostream &  out  )  const
 

Writes a text representation of this coloring out to the supplied stream.

Parameters:
out the output stream to write the coloring on

Definition at line 1849 of file coloring.cpp.

References bd, BdEdgeHandle, Arak::Color, COLORING_HEADER, getBoundaryEdge(), getInteriorEdge(), getPointWithColor(), getVertex(), IntEdgeHandle, numBoundaryEdges(), numInteriorEdges(), numVertices(), Arak::Geometry::Point, and VertexHandle.

Referenced by Arak::operator<<().

void Coloring::writeBinary std::ostream &  out  )  const
 

Writes a binary representation of this coloring out to the supplied stream.

Parameters:
out the output stream to write the coloring on

Definition at line 1931 of file coloring.cpp.

References bd, BdEdgeHandle, Arak::Color, getBoundaryEdge(), getInteriorEdge(), getPointWithColor(), getVertex(), IntEdgeHandle, numBoundaryEdges(), numInteriorEdges(), numVertices(), Arak::Geometry::Point, and VertexHandle.

void Coloring::writeXfig std::ostream &  out  )  const
 

Writes an Xfig visualization of this coloring out to the supplied stream.

Parameters:
out the output stream to write the visualization on

Definition at line 2023 of file coloring.cpp.

References bd, toTriangulation(), and Arak::Geometry::Triangle.

Referenced by main().


Member Data Documentation

Geometry::Rectangle Arak::Coloring::bd [protected]
 

An axis-aligned rectangle representing the boundary of the colored region.

(This could be generalized to an arbitrary convex region of the plane, but uniform sampling would be more expensive. A triangulation could be used to sample more complex regions efficiently.)

Definition at line 908 of file coloring.hpp.

Referenced by area(), boundary(), initialize(), interior(), outside(), randomPoint(), read(), readBinary(), test(), visualize(), write(), writeBinary(), and writeXfig().

Store<BoundaryEdge> Arak::Coloring::bdEdgeStore [protected]
 

A store of (potential) boundary edges to be used in the coloring.

Definition at line 972 of file coloring.hpp.

Referenced by freeEdge(), and newBoundaryEdge().

std::vector<BdEdgeHandle> Arak::Coloring::boundaryEdges [protected]
 

An vector of pointers to edges on the boundary of the colored region.

This array permits random access to these edges.

Definition at line 978 of file coloring.hpp.

Referenced by clear(), freeEdge(), getBoundaryEdge(), newBoundaryEdge(), and numBoundaryEdges().

std::vector<VertexHandle> Arak::Coloring::boundaryVertices [protected]
 

An vector of pointers to vertices on the boundary of the region.

This array permits random access to the boundary vertices.

Definition at line 946 of file coloring.hpp.

Referenced by clear(), freeVertex(), getVertex(), newVertex(), and numVertices().

std::vector<VertexHandle> Arak::Coloring::cornerVertices [protected]
 

A vector of pointers to vertices at the corner of the region.

This array permits random access to the corner vertices.

Definition at line 952 of file coloring.hpp.

Referenced by clear(), freeVertex(), getVertex(), newVertex(), and numVertices().

InteriorEdgeIndex* Arak::Coloring::intEdgeIndex [protected]
 

A grid of cells that record all crossing interior edges.

Definition at line 913 of file coloring.hpp.

Referenced by clear(), color(), compatible(), getInteriorEdgeIndex(), initialize(), newInteriorEdge(), read(), readBinary(), solid(), and trace().

Store<InteriorEdge> Arak::Coloring::intEdgeStore [protected]
 

A store of (potential) interior edges to be used in the coloring.

Definition at line 958 of file coloring.hpp.

Referenced by freeEdge(), and newInteriorEdge().

std::vector<IntEdgeHandle> Arak::Coloring::interiorEdges [protected]
 

A vector of pointers to edges in the interior of the region.

An edge is in the interior unless both of its vertices are not in the interior. This array permits random access to the interior edges.

Definition at line 966 of file coloring.hpp.

Referenced by clear(), freeEdge(), getInteriorEdge(), newInteriorEdge(), and numInteriorEdges().

std::vector<VertexHandle> Arak::Coloring::interiorVertices [protected]
 

A vector of pointers to vertices in the interior of the region.

This array permits random access to the interior vertices.

Definition at line 940 of file coloring.hpp.

Referenced by clear(), freeVertex(), getVertex(), newVertex(), and numVertices().

std::list<Listener*> Arak::Coloring::listeners [mutable, protected]
 

A list of the objects that are listening to this coloring.

Definition at line 983 of file coloring.hpp.

Referenced by addListener(), notifyEdgeHasBeenAdded(), notifyEdgeWillBeRemoved(), notifyVertexHasBeenAdded(), notifyVertexWillBeRemoved(), and recolored().

double Arak::Coloring::minEdgeLengthSq [protected]
 

This value is a constraint on the (squared) minimum edge length.

It can be set to zero to allow all edge lengths.

Definition at line 989 of file coloring.hpp.

Referenced by deleteVertex(), initialize(), moveBdVertexPastCorner(), moveIntVertex(), moveVertexAlongBd(), newBoundaryTriangle(), newCornerTriangle(), newInteriorTriangle(), recolorQuadrilateral(), splitEdge(), and test().

QueryPointIndex* Arak::Coloring::queryPoints [mutable, protected]
 

An index of points in the interior of the coloring whose colors are maintained under updates.

Definition at line 929 of file coloring.hpp.

Referenced by addQueryPoints(), clear(), color(), getPointWithColor(), getQueryPoints(), initialize(), read(), readBinary(), recolored(), test(), and visualize().

Store<Vertex> Arak::Coloring::vertexStore [protected]
 

A store of (potential) vertices to be used in the coloring.

Definition at line 934 of file coloring.hpp.

Referenced by freeVertex(), and newVertex().


The documentation for this class was generated from the following files:
Generated on Wed May 25 14:40:54 2005 for Arak by doxygen 1.3.6