From f98864d15b4d78eff215f550449a90c3269e07ac Mon Sep 17 00:00:00 2001 From: skramm Date: Sun, 31 Mar 2024 09:52:01 +0200 Subject: [PATCH] dox edits (bounding boxes) --- docs/homog2d_devinfo.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/homog2d_devinfo.md b/docs/homog2d_devinfo.md index d073af9..44e4e3d 100644 --- a/docs/homog2d_devinfo.md +++ b/docs/homog2d_devinfo.md @@ -149,22 +149,39 @@ This latter inheritance is only enabled if symbol `HOMOG2D_ENABLE_RTP` is define (see [build options](homog2d_manual.md#build_options)). -### 4.3 - Bounding Box of two primitives +### 4.3 - Bounding Boxes The concept of bounding box is easy to understand for the some primitives (classes `FRect`, `Circle`, `Ellipse`), and it is validated with the trait class template `HasBB<>`. +For Segments, it may throw, if the points share some common coordinate (thus not having an area). For the two "polylines" classes (`OPolyline` and `CPolyline`), it **may** exist (at compile time), but not always succeed. Indeed, these two types can have only two points, thus being equivalent to segments, that do not have a bounding box (consider vertical or horizontal segments). - On other primitives, the concept of bounding box makes no sense: * For lines, as that are infinite, a bounding box can not be defined. * For points, as a bounding box is implemented as a `FRect` object and that this type cannot have a null area, it can not be defined either. * For segments, as these may not have an area, no `getBB()` member function is enabled. +The table below summarizes what happens when calling `getBB()` on an object: + +| Type | | +|-------------|---------------| +| `Point2d` | always throws | +| `Line2d` | always throws | +| `Segment` | may throw | +| `Circle` | never throws | +| `FRect` | never throws | +| `OPolyline` | may throw | +| `CPolyline` | may throw | +| `Ellipse` | never throws | + +**Bounding box of two objects** + +This library provides a free function `getBB( t1, t1 )` that will return the bounding boxes holding `t1` and `t2`. + However, when computing the common bounding box of two arbitrary elements, things are not exactly the same. * if one of the two objects is a line, no bounding box can be computed, so a call to `getBB()` with two lines will not compile.