#include <coloring.hpp>
Collaboration diagram for Arak::Coloring:
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< Vertex > | VertexHandle |
typedef PointerHandle< InteriorEdge > | IntEdgeHandle |
typedef PointerHandle< BoundaryEdge > | BdEdgeHandle |
typedef Grid< IntEdgeHandle > | InteriorEdgeIndex |
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::Rectangle & | boundary () const |
Returns the boundary of this coloring. | |
const InteriorEdgeIndex & | getInteriorEdgeIndex () 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 QueryPointIndex & | getQueryPoints () const |
Returns a const reference to the query point index. | |
QueryPointIndex & | getQueryPoints () |
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. | |
InteriorEdgeIndex * | intEdgeIndex |
A grid of cells that record all crossing interior edges. | |
QueryPointIndex * | queryPoints |
An index of points in the interior of the coloring whose colors are maintained under updates. | |
Store< Vertex > | vertexStore |
A store of (potential) vertices to be used in the coloring. | |
std::vector< VertexHandle > | interiorVertices |
A vector of pointers to vertices in the interior of the region. | |
std::vector< VertexHandle > | boundaryVertices |
An vector of pointers to vertices on the boundary of the region. | |
std::vector< VertexHandle > | cornerVertices |
A vector of pointers to vertices at the corner of the region. | |
Store< InteriorEdge > | intEdgeStore |
A store of (potential) interior edges to be used in the coloring. | |
std::vector< IntEdgeHandle > | interiorEdges |
A vector of pointers to edges in the interior of the region. | |
Store< BoundaryEdge > | bdEdgeStore |
A store of (potential) boundary edges to be used in the coloring. | |
std::vector< BdEdgeHandle > | boundaryEdges |
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. |
|
|
|
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(). |
|
|
Default constructor.
Definition at line 282 of file coloring.cpp. References initialize(), and Arak::Geometry::Rectangle. |
|
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.
Definition at line 289 of file coloring.cpp. References initialize(), and Arak::Geometry::Rectangle. |
|
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.
Definition at line 295 of file coloring.cpp. References boundary(), initialize(), Arak::Util::PropertyMap, and Arak::Geometry::Rectangle. |
|
Destructor.
Definition at line 343 of file coloring.cpp. References clear(). |
|
Adds a new listener to this coloring's list of listeners.
Definition at line 1725 of file coloring.cpp. References listeners. Referenced by Arak::ArakPosteriorRangeObs::ArakPosteriorRangeObs(), Arak::ArakPosteriorSonarObs::ArakPosteriorSonarObs(), and Arak::ArakPrior::initialize(). |
|
Adds all query points in the supplied index to the internal query point index.
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(). |
|
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(). |
|
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. |
|
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(). |
|
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(). |
|
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.
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(). |
|
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.
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(). |
|
Disconnects a boundary vertex from its incident boundary edges. These boundary edges are replaced by a single boundary edge.
Definition at line 900 of file coloring.cpp. References BdEdgeHandle, freeEdge(), newBoundaryEdge(), and VertexHandle. Referenced by deleteBdTriangle(), and deleteCornerTriangle(). |
|
Frees a boundary edge for future use.
Definition at line 490 of file coloring.cpp. References BdEdgeHandle, bdEdgeStore, boundaryEdges, Store< BoundaryEdge >::deleteItem(), PointerHandle< T >::valid(), and VertexHandle. |
|
Frees an interior edge for future use.
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(). |
|
Frees a vertex for future use.
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(). |
|
Definition at line 1313 of file coloring.hpp. References BdEdgeHandle, and boundaryEdges. |
|
Returns a const reference to the boundary edge with the supplied index.
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(). |
|
Definition at line 1299 of file coloring.hpp. References IntEdgeHandle, and interiorEdges. |
|
Returns a const reference to the interior edge with the supplied index.
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(). |
|
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(). |
|
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(). |
|
Returns a reference to the query point index.
Definition at line 1819 of file coloring.hpp. References queryPoints. |
|
Returns a const reference to the query point index.
Definition at line 1814 of file coloring.hpp. References queryPoints. Referenced by visualize(). |
|
Returns a mutable reference to the vertex with the supplied type and index.
Definition at line 1258 of file coloring.hpp. References boundaryVertices, cornerVertices, interiorVertices, and VertexHandle. |
|
Returns a const reference to the vertex with the supplied type and index.
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(). |
|
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.
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(). |
|
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(). |
|
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.
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(). |
|
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.
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(). |
|
Returns a reference to a fresh vertex.
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
Returns the number of boundary edges in the coloring.
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(). |
|
Returns the number of interior edges in the coloring.
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(). |
|
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(). |
|
An inequality operator. Two colorings are equal iff they are the same object. Definition at line 1906 of file coloring.hpp. |
|
An equality operator. Two colorings are equal iff they are the same object. Definition at line 1898 of file coloring.hpp. |
|
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. |
|
Returns a point sampled uniformly at random from the interior of the colored region.
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(). |
|
Returns a reference to a vertex with the supplied type selected uniformly at random.
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(). |
|
Initializes this coloring from a text representation read from the supplied stream.
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>>(). |
|
Initializes this coloring from a binary representation read from the supplied stream.
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(). |
|
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.
Definition at line 1743 of file coloring.cpp. References listeners, Arak::Geometry::Point, queryPoints, Arak::QueryPointIndex::recolor(), and Arak::Coloring::Listener::recolored(). |
|
This helper method performs all necessary updates (including informing listeners) when the triangle with the supplied vertices has been recolored.
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(). |
|
Returns true iff every point in the closure of the supplied convex polygon is the supplied color.
Definition at line 1684 of file coloring.cpp. References color(), compatible(), IntEdgeHandle, intEdgeIndex, Arak::Geometry::Polygon, and VertexHandle. |
|
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(). |
|
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.
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(). |
|
Traces the segment from xp to yp and finds the first interior edge that intersects the segment (if any).
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(). |
|
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(). |
|
Writes a text representation of this coloring out to the supplied stream.
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<<(). |
|
Writes a binary representation of this coloring out to the supplied stream.
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. |
|
Writes an Xfig visualization of this coloring out to the supplied stream.
Definition at line 2023 of file coloring.cpp. References bd, toTriangulation(), and Arak::Geometry::Triangle. Referenced by main(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
A store of (potential) vertices to be used in the coloring.
Definition at line 934 of file coloring.hpp. Referenced by freeVertex(), and newVertex(). |