2. Algorithms¶
2.1. Enumerations¶
2.3. Functions¶
They implement some algorithms that.
-
template<typename
TItem
>
static inline boolbimpp::plan2d::algorithm
::
isContainsForBiggerVector
(const std::vector<TItem> &_all, const std::vector<TItem> &_sub)¶ Is the
_all
contains_sub
?Importance: The
_all
and_sub
must be sorted from small to big.- Parameters
_all
: A vector contains all items_sub
: A vector contains a part of items
-
static inline precision_type
bimpp::plan2d::algorithm
::
calculateAngleEx
(const node_type &_o, const node_type &_a, const node_type &_b)¶ Calculate the angle \( \alpha \) between \( \vec{OA} \) and \( \vec{OB} \).
\[\begin{split} f(\vec{OA}, \vec{OB}) = \begin{cases} \cos^{-1}(\vec{OA} \cdot \vec{OB}) & \quad \text{if } 0^{\circ} \leq \alpha \leq 180^{\circ}\\ \pi * 2 - \cos^{-1}(\vec{OA} \cdot \vec{OB}) & \quad \text{if } 180^{\circ} < \alpha < 360^{\circ} \end{cases} \end{split}\]- Parameters
_o
: The \( {O} \) node(point)_a
: The \( {A} \) node(point)_b
: The \( {B} \) node(point)
x-axis: \(cos(\alpha)\); y-axis: \(\alpha\) in radians
-
static inline precision_type
bimpp::plan2d::algorithm
::
calculateSinAngleEx
(const node_type &_o, const node_type &_a, const node_type &_b)¶ Calculate the increased sine of a angle \( \alpha \) between \( \vec{OA} \) and \( \vec{OB} \).
\[\begin{split} f(\vec{OA}, \vec{OB}) = \begin{cases} \vert\vec{OA} \times \vec{OB}\vert & \quad \text{if } 0^{\circ} \leq \alpha \leq 90^{\circ}\\ 2 - \vert\vec{OA} \times \vec{OB}\vert & \quad \text{if } 90^{\circ} < \alpha < 270^{\circ}\\ 4 + \vert\vec{OA} \times \vec{OB}\vert & \quad \text{if } 270^{\circ} \leq \alpha < 360^{\circ} \end{cases} \end{split}\]- Parameters
_o
: The \( {O} \) node(point)_a
: The \( {A} \) node(point)_b
: The \( {B} \) node(point)
x-axis: \(\alpha\) in radians; y-axis: increased \(sin(\alpha)\)
-
static inline precision_type
bimpp::plan2d::algorithm
::
calculateCosAngleEx
(const node_type &_o, const node_type &_a, const node_type &_b)¶ Calculate the increased cosine of a angle \( \alpha \) between \( \vec{OA} \) and \( \vec{OB} \).
\[\begin{split} f(\vec{OA}, \vec{OB}) = \begin{cases} 1 - \vec{OA} \cdot \vec{OB} & \quad \text{if } 0^{\circ} \leq \alpha \leq 180^{\circ}\\ 3 + \vec{OA} \cdot \vec{OB} & \quad \text{if } 180^{\circ} < \alpha < 360^{\circ} \end{cases} \end{split}\]- Parameters
_o
: The \( {O} \) node(point)_a
: The \( {A} \) node(point)_b
: The \( {B} \) node(point)
x-axis: \(\alpha\) in radians; y-axis: increased \(cos(\alpha)\)
-
static inline bool
bimpp::plan2d::algorithm
::
computeRoomExs
(const house_type &_house, room_ex_vector &_room_exs, id_type _room_id = TConstant::none_id)¶ Compute all room’s edges by all walls, and don’t use recursion.
- Parameters
_house
: The house_room_exs
: Output the room’s edge list_room_id
: The special id of room, find all rooms if it is none
This function computes some edges of all areas that are wrapped by colourful lines.
Blue lines: Means the room_ex is inside of the lines, and the side_type is bimpp::plan2d::algorithm::room_side_in.
Green lines: Means the room_ex is outside of the lines, and the side_type is bimpp::plan2d::algorithm::room_side_out.
Red lines: Means the room_ex is both inside and outside of the lines, and the side_type is bimpp::plan2d::algorithm::room_side_both.