The CtcVisible and CtcNoVisible contractors
Main authors: Quentin Brateau
The visibility constraint characterizes the set of points \(\mathbf{x} \in \mathbb{R}^2\) that are visible from an observation point \(\mathbf{a}\) given an obstacle segment \([\mathbf{e}_1\mathbf{e}_2]\).
This constraint is based on the work of Rémy Guyonneau (see [Guyonneau2013]). A point \(\mathbf{x}\) is considered visible if the segment \([\mathbf{a}\mathbf{x}]\) does not intersect the obstacle segment \([\mathbf{e}_1\mathbf{e}_2]\). This creates a “shadow cone” originating from \(\mathbf{a}\).
-
class CtcVisible : public codac2::Ctc<CtcVisible, IntervalVector>, private codac2::CtcVisibleBase
-
class CtcNoVisible : public codac2::Ctc<CtcNoVisible, IntervalVector>, private codac2::CtcVisibleBase
Note
Current implementations assume a thin (degenerated) observation point \(\mathbf{a}\). Future versions will support visibility from observation lines, set defined by convex polygons, and from any set defined by a Separator.
Methods
-
void codac2::CtcVisible::contract(IntervalVector &x) const
-
void codac2::CtcNoVisible::contract(IntervalVector &x) const
Example of use: Characterizing the set of visible and non-visible points from an observation point
In this example, we characterize the visible and hidden areas from an observer at the origin \(\mathbf{a}=(0,0)^\intercal\) facing a wall represented by a segment from \((2, -1)\) to \((2, 1)\).
a = [1, 1]
s = Segment([1, 4], [3, 2])
ctc = CtcVisible(a, s)
DefaultFigure.pave(
[[-1,6],[-1,6]],
ctc,
0.1
)
Vector a({1, 1});
Segment s({1, 4}, {3, 2});
CtcVisible ctc(a, s);
DefaultFigure::pave(
{{-1,6},{-1,6}},
ctc,
0.1
);
a = [1, 1]
s = Segment([1, 4], [3, 2])
ctc = CtcNoVisible(a, s)
DefaultFigure.pave(
[[-1,6],[-1,6]],
ctc,
0.1
)
Vector a({1, 1});
Segment s({1, 4}, {3, 2});
CtcNoVisible ctc(a, s);
DefaultFigure::pave(
{{-1,6},{-1,6}},
ctc,
0.1
);
Characterization of the visibility area. The points that are not visible are out of the visibility region and belongs to the blue area. The uncertain region is represented in yellow.
Characterization of the non-visibility area. The points that are visible are out of the non-visibility region and belongs to the blue area. The uncertain region is represented in yellow.
Separator on the Visibility Constraint
The visibility constraint can also be applied as a separator, which allows us to characterize the set of points that are visible or not visible from an observation point. This is particularly useful for applications such as path planning, where one needs to determine the regions that are accessible or hidden from a certain viewpoint.
a = [1, 1]
l = [Segment([1,4], [2, 3]), Segment([2, 3], [2.5,1]), Segment([4, 0.5], [3.5, -0.5])]
sep = SepVisible(a, l)
DefaultFigure.pave(
[[-1,6],[-1,6]],
sep,
0.1
)
Vector a({1, 1});
std::vector<Segment> l = {{{1,4}, {2, 3}}, {{2, 3}, {2.5,1}}, {{4, 0.5}, {3.5, -0.5}}};
SepVisible sep(a, l);
DefaultFigure::pave(
{{-1,6},{-1,6}},
sep,
1e-1
);
Characterization of the visibility area relative to a list of obstacle segments. The green area is visible from the observation point, while blue area is not visible. The uncertain region is represented in yellow.
a = [1, 1]
p = Polygon([[2.5,3], [2, 2], [3,1], [4, 1.5], [4, 3]])
sep = SepVisible(a, p)
DefaultFigure.pave(
[[-1,6],[-1,6]],
sep,
0.1
)
Vector a({1, 1});
Polygon p({{2.5,3}, {2, 2}, {3,1}, {4, 1.5}, {4, 3}});
SepVisible sep(a, p);
DefaultFigure::pave(
{{-1,6},{-1,6}},
sep,
1e-1
);
Characterization of the visibility area relative to a polygon obstacle. The green area is visible from the observation point, while blue area is not visible. The uncertain region is represented in yellow.
Note
When implementing visibility over a union of segments, fake boundaries are appearing. These occur when the intersection of several visibility contractors creates “uncertain” regions that do not correspond to actual physical visibility limits. This is particularly visible on the two Figures that show a line of yellow boxes in the blue area. For a detailed discussion on handling these in interval analysis, see [Brateau2025].