PlotNode

Bounding Boxes

Legend for the drawing below:

**** - Self sigma BB.
~~~~ - Self pad box
#### - Self width and depth.
.... - All children
++++ - Child[n] sigma BB.

i.e. For a child its ++++ is equivalent to my ****.

Points in the drawing below:

  • D - Self datum point.
  • S - Self plot datum point.
  • x[n] - Child datum point.
  • Pl - Parent landing point to self.
  • Pt - Parent take-off point from self.
  • P[n] - Self take off point and landing point to child n.
  • pl[n] - Child n landing point from self.
  • pt[n] - Child n take-off point to self.
  • tdc - Top dead centre.

Box .... has depth of max(Boxes(++++).width) and width max(Box(~~~~), sum(Boxes(++++).depth)).

Each instance of class knows about the following:

Boxes:

  • **** - Self sigma BB as computed Dim() objects: self.bbSigmaDepth
    and self.bbSigmaWidth. Or as computed Box() object self.bbSigma
  • ~~~~ - As computed Dim() objects: self.bbSelfWidth, self.bbSelfDepth
  • #### - Self width and depth as Dim() objects: self.width and self.depth
  • .... - All children as a Box() object: self.bbChildren

And padding between ~~~~ and .... as Dim() object self.bbSpaceChildren

i.e. not ++++ - Child[n] sigma BB. That the caller knows about its children.

Points: given D each instance of this class knows:

S, Pl, Pt, P[0] to P[N-1], x[0], tdc (only).

In the following diagram where lines are adjacent that means that there is no spacing between them. This diagram shows the root at top left and the children from left to right. The default plot of the include graph is to have the root at top left with the processed file centre left with the children running from top to bottom. It is felt that this is more intuitive for source code.

-|-----> x increases
 |
 |
\/
y increases

D ***************************************************************************
*                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                     *
*                ~                                    ~                     *
*                ~    S ### Pl ###tdc### Pt ######    ~                     *
*                ~    #                          #    ~                     *
*                ~    #                          #    ~                     *
*                ~    #         Parent           #    ~                     *
*                ~    #                          #    ~                     *
*                ~    ## P[0] ## P[c] ## P[C-1] ##    ~                     *
*                ~                                    ~                     *
*                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                     *
*                                 ^                                         *
*                                 | == self._bbSpaceChildren                *
*                                 |                                         *
*...........................................................................*
*.x[0] + pl[0] + pt[0] +x[c] + pl[c] + pt[c] ++++++++++++x[C-1]+pl/pt[C-1]+.*
*.+                    ++                               ++                +.*
*.+     Child[0]       ++                               ++                +.*
*.+                    ++                               ++   Child[C-1]   +.*
*.+++++++++++++++++++++++           Child[c]            ++                +.*
*.                      +                               +++++++++++++++++++.*
*.                      +                               +                  .*
*.                      +++++++++++++++++++++++++++++++++                  .*
*...........................................................................*
*****************************************************************************

Note: .... can be narrower than ~~~~

Vertices

The following show root at the left. Linking parent to child:

                    PC_land    PC_stop
                     |            |
                     x>>>>>>>>>>>>x
                    /
                   /
    x>>>>>>>>>>>>x/
    |            |
PC_roll        PC_to

PC_roll and PC_to are determined by the parent. PC_land and PC_stop are determined by the child.

And child to parent:

CP_stop     CP_land
    |          |
    x<<<<<<<<<<x\
                 \
                  \
                   x<<<<<<<<<<<<x
                   |            |
                CP_to        CP_roll

CP_roll and CP_to are determined by the child. CP_land and CP_stop are determined by the parent.

exception cpip.plot.PlotNode.ExceptionPlotNode

Exception when handling PlotNodeBbox object.

class cpip.plot.PlotNode.PlotNodeBbox

This is a class that can hold the width and depth of an object and the bounding box of self and the children.

This can then compute various dimensions of self and children.

bbChildren

The bounding box of children as a cpip.plot.Coord.Box or None. i.e. the box ....

Returns:cpip.plot.Coord.Box([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Bounding box.
bbChildrenDepth

The bounding box depth of children as a cpip.plot.Coord.Dim or None. i.e. the depth of box ....

Returns:cpip.plot.Coord.Dim([float, str]) – Depth
bbChildrenWidth

The bounding box width of children as a cpip.plot.Coord.Dim or None. i.e. the width of box ....

Returns:cpip.plot.Coord.Dim([float, str]) – Width
bbSelfDepth

The depth of self plus padding as a cpip.plot.Coord.Dim. i.e. the depth of box ~~~~

Returns:cpip.plot.Coord.Dim([float, str]) – Depth
bbSelfPadding

The immediate padding around self as a cpip.plot.Coord.Pad.

Returns:NoneType,cpip.plot.Coord.Pad([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>]), cpip.plot.Coord.Dim([float, <class 'str'>]), cpip.plot.Coord.Dim([<class 'float'>, <class 'str'>])]) – Padding
bbSelfWidth

The width of self plus padding as a cpip.plot.Coord.Dim or None. i.e. the width of box ~~~~

Returns:cpip.plot.Coord.Dim([float, str]) – Width
bbSigma

Bounding box of self and my children as a cpip.plot.Coord.Box.

bbSigmaDepth

The depth of self+children as a cpip.plot.Coord.Dim or None in the case that I don’t exist and I have no children. i.e. the depth of box ****

Returns:cpip.plot.Coord.Dim([float, str]) – Depth
bbSigmaWidth

The depth of self+children as a cpip.plot.Coord.Dim or None in the case that I don’t exist and I have no children. i.e. the width of box ****

Returns:cpip.plot.Coord.Dim([float, str]) – Width
bbSpaceChildren

The additional distance to give to the children as a cpip.plot.Coord.Dim.

Parameters:value (cpip.plot.Coord.Dim([float, str])) – Spacing between children.
Returns:NoneType,cpip.plot.Coord.Dim([float, str]) – Spacing between children.
box

The cpip.plot.Coord.Box of ####.

Returns:cpip.plot.Coord.Box([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – The box
childBboxDatum(theDatum)

The point x[0] above as a cpip.plot.Coord.Pt given theDatum as cpip.plot.Coord.Pt or None if no children.

Parameters:theDatum (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Datum
Returns:cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Point x[0]
depth

The immediate depth of the node, if None then no BB depth or bbSpaceChildrend is allocated. i.e. the depth of box ####

Parameters:value (cpip.plot.Coord.Dim([float, str])) – The depth.
Returns:NoneType,cpip.plot.Coord.Dim([float, str]) – The depth.
extendChildBbox(theChildBbox)

Extends the child bounding box by the amount theChildBbox which should be a cpip.plot.Coord.Box. This extends the .... line above.

Parameters:theChildBbox (cpip.plot.Coord.Box([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – The additional bounding box.
Returns:NoneType
hasSetArea

Returns True if width and depth are set, False otherwise.

numChildren

The number of children.

Returns:int – The number of children.
plotPointCentre(theLd)

Returns the logical point at the centre of the box shown as #### above.

plotPointSelf(theDatum)

The point S as a cpip.plot.Coord.Pt given theDatum as cpip.plot.Coord.Pt.

Parameters:theDatum (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Datum
Returns:cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Point S
width

The immediate width of the node, if None then no BB depth or bbSpaceChildrend is allocated. i.e. the depth of box ####

Parameters:value (cpip.plot.Coord.Dim([float, str])) – The depth.
Returns:NoneType,cpip.plot.Coord.Dim([float, str]) – The depth.
class cpip.plot.PlotNode.PlotNodeBboxBoxy

Sub-class parent child edges that contact the corners of the box shown as #### above.

cpLand(theLd, childIndex)

The me-as-parent-from-child landing point given the logical datum as a cpip.plot.Coord.Pt.

Parameters:
  • theLd (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Logical datum.
  • childIndex (int) – Index
Returns:

cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Landing point.

cpRoll(theLd)

The me-as-child-to-parent start point given the logical datum as a cpip.plot.Coord.Pt.

Parameters:theLd (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Logical datum.
Returns:cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Start point.
cpStop(theLd, childIndex)

The me-as-parent-from-child stop point given the logical datum as a cpip.plot.Coord.Pt.

Parameters:
  • theLd (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Logical datum.
  • childIndex (int) – Index
Returns:

cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Stop point.

cpTo(theLd)

The me-as-child-to-parent take off point given the logical datum as a cpip.plot.Coord.Pt.

Parameters:theLd (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Logical datum.
Returns:cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Take off point.
pcLand(theLd)

The parent-to-me-as-child landing point given the logical datum as a cpip.plot.Coord.Pt.

Parameters:theLd (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Logical datum.
Returns:cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Landing point.
pcRoll(theDatum, childIndex)

The me-as-parent-to-child logical start point given the logical datum as a cpip.plot.Coord.Pt and the child ordinal. This gives equispaced points along the lower edge.

Parameters:
  • theDatum (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Logical datum.
  • childIndex (int) – Index
Returns:

cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Start point.

pcStop(theLd)

The parent-to-me-as-child stop point given the logical datum as a cpip.plot.Coord.Pt.

Parameters:theLd (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Logical datum.
Returns:cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Stop point.
pcTo(theDatum, childIndex)

The me-as-parent-to-child logical take off point given the logical datum as a cpip.plot.Coord.Pt ind the child ordinal. This gives equispaced points along the lower edge.

Parameters:
  • theDatum (cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])])) – Logical datum.
  • childIndex (int) – Index
Returns:

cpip.plot.Coord.Pt([cpip.plot.Coord.Dim([float, str]), cpip.plot.Coord.Dim([float, <class 'str'>])]) – Take off point.

class cpip.plot.PlotNode.PlotNodeBboxRoundy

Sub-class for parent child edges that contact the centre of the box shown as #### above.

cpLand(theDatumL, childIndex)

The me-as-parent-from-child landing point given the logical datum as a cpip.plot.Coord.Pt.

cpRoll(theDatumL)

The me-as-child-to-parent start point given the logical datum as a cpip.plot.Coord.Pt.

cpStop(theDatumL, childIndex)

The me-as-parent-from-child stop point given the logical datum as a cpip.plot.Coord.Pt.

cpTo(theDatumL)

The me-as-child-to-parent take off point given the logical datum as a cpip.plot.Coord.Pt.

pcLand(theDatumL)

The parent-to-me-as-child landing point given the logical datum as a cpip.plot.Coord.Pt.

pcRoll(theDatumL, childIndex)

The me-as-parent-to-child logical start point given the logical datum as a cpip.plot.Coord.Pt ind the child ordinal. This gives equispaced points along the lower edge.

pcStop(theDatumL)

The parent-to-me-as-child stop point given the logical datum as a cpip.plot.Coord.Pt.

pcTo(theDatumL, childIndex)

The me-as-parent-to-child logical take off point given the logical datum as a cpip.plot.Coord.Pt ind the child ordinal. This gives equispaced points along the lower edge.