This question Calculate field of view / angle of a point to a shapefile was attempting to achieve a similar outcome to my need (calculating the angle of view between observer locations and a polygon). The image from the question is shown below for ease, with the angle of interest being alpha:
My solution is to use a virtual layer to calculate the bearing between each viewpoint and each of the nodes on the polygon layer and then use aggregate expressions to give me the information I need.
I have the following code at present but testing it throws a syntax error (1 - near ".": syntax error) that I cannot work out (there may be other errors and I'm not convinced it's the most optimal code but I would like to use a virtual layer).
SELECT
vp_union.*,
minimum(vp_union.bearing) AS bearing_min,
median(vp_union.bearing) AS bearing_med,
maximum(vp_union.bearing) AS bearing_max,
range(vp_union.bearing) AS bearing_range,
distance(
vp_union.geometry,
closest_point(
st_union(redline_outer.geometry),
vp_union.geometry
),
vp_union.geometry
) AS distance
FROM
(SELECT
vp.*,
degrees(
azimuth(
vp.geometry,
redline_nodes.geometry
)
) AS vp.bearing
FROM
"Viewpoint Layer 2D" AS vp
UNION
(SELECT
nodes_to_points(
st_union(redline.geometry)
) AS geometry
FROM
"Redline" AS redline
) AS redline_nodes
) AS vp_union,
"Redline" AS redline_outer
GROUP BY
vp_union.name
) AS vp.bearing
into) AS bearing