Adaptagrams
Public Member Functions | List of all members
dialect::Side Class Reference

A side of a Face. E.g. a rectangular Face has four Sides: north, south, east, and west. More...

#include <faces.h>

Collaboration diagram for dialect::Side:
Collaboration graph

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.
 

Detailed Description

A side of a Face. E.g. a rectangular Face has four Sides: north, south, east, and west.

Constructor & Destructor Documentation

◆ Side()

Side::Side ( Nodes  nodeSeq,
CardinalDir  direc 
)

Standard constructor.

Parameters
[in]nodeSeqThe Nodes belonging to this Side, in clockwise order w.r.t. the Face to which the Side belongs.
[in]direcThe cardinal direction in which we move as we go forward through the sequnce of Nodes.
Note
In theory the direc could be computed from the given nodeSeq; however, wherever possible we want to promote the setting of directions logically, based on existing constraints, rather than inferring directions geometrically. When Faces construct Sides, there is such a constrained direction in place.

Member Function Documentation

◆ closedInterval()

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.

Returns
The closed interval covered by the Side.

References dialect::BoundingBox::getInterval().

Referenced by getIntervalOppositeSegment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeCollateralProjSeq()

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.

Parameters
[in]tpThe TreePlacement to be added to this Side.
[in]paddingOptional padding for the new tree box.
Returns
A ProjSeq representing the computed projection sequence.

References containsNode(), Avoid::Point::x, and Avoid::Point::y.

Here is the call graph for this function:

◆ findNodeIndex()

size_t Side::findNodeIndex ( id_type  id) const

Get the index of a Node in this Side's node sequence.

Parameters
[in]idThe ID of the Node to be found.
Returns
The index where the given ID occurs, or -1 if not found.

◆ getCentreCoord()

double Side::getCentreCoord ( void  ) const

Check the centre coordinate of this Side.

Note
We are working under the assumption that all Nodes belonging to a given Side are centre-aligned!

References Avoid::Point::x, vpsc::XDIM, and Avoid::Point::y.

Referenced by getFirstPtOppositeSegment(), and halfWidthOppositeSegment().

Here is the caller graph for this function:

◆ getFirstPtOppositeSegment()

Avoid::Point Side::getFirstPtOppositeSegment ( LineSegment &  seg) const

Compute the first point of the interval of this Side that lies opposite a given line segment.

Parameters
[in]segThe LineSegment in question.
Returns
The Point.
Exceptions
Runtimeerror if this Side does not lie opposite the given segment.
See also
Side::liesOppositeSegment

References getCentreCoord(), getIntervalOppositeSegment(), and vpsc::XDIM.

Here is the call graph for this function:

◆ getIntervalOppositeSegment()

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.

Parameters
[in]segThe LineSegment in question.
[in]openIntervalSet true if you want to instead intersect this Side's closed interval with the LineSegment's open interval.
Returns
An interval representing the intersection.
Note
Returns an empty interval (b < a) if the two intervals do not intersect, or if the Side and the LineSegment are not aligned in the same dimension.

References closedInterval().

Referenced by getFirstPtOppositeSegment(), halfWidthOppositeSegment(), and liesOppositeSegment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ halfWidthOppositeSegment()

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.

Parameters
[in]segThe LineSegment in question.
Returns
The desired half-width. Will be equal to -1 if the Side's interval does not intersect that of the segment, or if it does but the two are in-line with one another.
Note
The Edges of the Side are given the thickness value set for aligned edges in the underlying Graph.

References getCentreCoord(), dialect::Graph::getEdgeThickness(), and getIntervalOppositeSegment().

Here is the call graph for this function:

◆ liesOppositeSegment()

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.

Parameters
[in]segThe LineSegment in question.
[in]openIntervalSet true if you want to instead intersect this Side's closed interval with the LineSegment's open interval.
Returns
boolean

References getIntervalOppositeSegment().

Here is the call graph for this function:

The documentation for this class was generated from the following files: