Adaptagrams
|
A side of a Face. E.g. a rectangular Face has four Sides: north, south, east, and west. More...
#include <faces.h>
Public Member Functions | |
Side (Nodes nodeSeq, CardinalDir direc) | |
Standard constructor. More... | |
Nodes | getNodeSeq (void) const |
Get a copy of the node sequence. | |
bool | containsNode (id_type id) const |
Check whether this Side contains a Node of the given ID. | |
size_t | findNodeIndex (id_type id) const |
Get the index of a Node in this Side's node sequence. More... | |
CardinalDir | getForwardDirec (void) const |
Check the forward direction of this Side. | |
vpsc::Dim | getAlignmentDimension (void) const |
Check the dimension in which this Side is aligned. | |
Node_SP | firstNode (void) const |
Get a pointer to the first Node on this Side. | |
Node_SP | lastNode (void) const |
Get a pointer to the last Node on this Side. | |
std::string | toString (void) const |
Write a string representation. | |
double | getCentreCoord (void) const |
Check the centre coordinate of this Side. More... | |
size_t | getNumRootNodes (void) const |
Check how many of the Nodes on this Side are marked as root nodes. | |
void | addTreePlacement (TreePlacement_SP tp) |
Record a TreePlacement as having been placed on this Side. | |
ProjSeq_SP | computeCollateralProjSeq (TreePlacement_SP tp, double padding=0) |
Compute a projection sequence to remove/prevent overlaps between the given TreePlacement's tree box, and any existing tree boxes already on this Side, as well as ordinary perimeter nodes on this Side. More... | |
interval | closedInterval (void) const |
Compute the closed interval [a, b], where a and b are the extreme coordinates covered by this Side, up to the extremes of the boxes of the extreme Nodes. More... | |
interval | getIntervalOppositeSegment (LineSegment &seg, bool openInterval=false) const |
Compute the closed interval [a, b] that is the intersection of this Side's closed interval with that of a given Segment. More... | |
bool | liesOppositeSegment (LineSegment &seg, bool openInterval=false) const |
Check whether the closed interval spanned by this Side runs in the same dimension as a given line segment, and overlaps it in projection onto that dimension. More... | |
Avoid::Point | getFirstPtOppositeSegment (LineSegment &seg) const |
Compute the first point of the interval of this Side that lies opposite a given line segment. More... | |
double | halfWidthOppositeSegment (LineSegment &seg) const |
Given a LineSegment, find that portion of this Side that lies opposite it, (if any) and report the maximum half-width of the near half. More... | |
const std::set< TreePlacement_SP > & | getTreePlacements (void) const |
Read-only access to the set of TreePlacements that have been attached to this Side. | |
Side::Side | ( | Nodes | nodeSeq, |
CardinalDir | direc | ||
) |
Standard constructor.
[in] | nodeSeq | The Nodes belonging to this Side, in clockwise order w.r.t. the Face to which the Side belongs. |
[in] | direc | The cardinal direction in which we move as we go forward through the sequnce of Nodes. |
interval Side::closedInterval | ( | void | ) | const |
Compute the closed interval [a, b], where a and b are the extreme coordinates covered by this Side, up to the extremes of the boxes of the extreme Nodes.
References dialect::BoundingBox::getInterval().
Referenced by getIntervalOppositeSegment().
ProjSeq_SP Side::computeCollateralProjSeq | ( | TreePlacement_SP | tp, |
double | padding = 0 |
||
) |
Compute a projection sequence to remove/prevent overlaps between the given TreePlacement's tree box, and any existing tree boxes already on this Side, as well as ordinary perimeter nodes on this Side.
[in] | tp | The TreePlacement to be added to this Side. |
[in] | padding | Optional padding for the new tree box. |
References containsNode(), Avoid::Point::x, and Avoid::Point::y.
size_t Side::findNodeIndex | ( | id_type | id | ) | const |
double Side::getCentreCoord | ( | void | ) | const |
Check the centre coordinate of this Side.
References Avoid::Point::x, vpsc::XDIM, and Avoid::Point::y.
Referenced by getFirstPtOppositeSegment(), and halfWidthOppositeSegment().
Avoid::Point Side::getFirstPtOppositeSegment | ( | LineSegment & | seg | ) | const |
Compute the first point of the interval of this Side that lies opposite a given line segment.
[in] | seg | The LineSegment in question. |
Runtime | error if this Side does not lie opposite the given segment. |
References getCentreCoord(), getIntervalOppositeSegment(), and vpsc::XDIM.
interval Side::getIntervalOppositeSegment | ( | LineSegment & | seg, |
bool | openInterval = false |
||
) | const |
Compute the closed interval [a, b] that is the intersection of this Side's closed interval with that of a given Segment.
[in] | seg | The LineSegment in question. |
[in] | openInterval | Set true if you want to instead intersect this Side's closed interval with the LineSegment's open interval. |
References closedInterval().
Referenced by getFirstPtOppositeSegment(), halfWidthOppositeSegment(), and liesOppositeSegment().
double Side::halfWidthOppositeSegment | ( | LineSegment & | seg | ) | const |
Given a LineSegment, find that portion of this Side that lies opposite it, (if any) and report the maximum half-width of the near half.
[in] | seg | The LineSegment in question. |
References getCentreCoord(), dialect::Graph::getEdgeThickness(), and getIntervalOppositeSegment().
bool Side::liesOppositeSegment | ( | LineSegment & | seg, |
bool | openInterval = false |
||
) | const |
Check whether the closed interval spanned by this Side runs in the same dimension as a given line segment, and overlaps it in projection onto that dimension.
[in] | seg | The LineSegment in question. |
[in] | openInterval | Set true if you want to instead intersect this Side's closed interval with the LineSegment's open interval. |
References getIntervalOppositeSegment().