0

I am looking for a way in which, I can create a buffer around a point.

The buffer is meant to be a semi-ellipsoid.

In theory it should be a mixture of 'single_sided_buffer' and 'make_ellipse' functions. I have tried multiple ways of doing it.

The final output should look like something similar to the below. It would be two semi-ellipsoids merged together but with different dimensions.

enter image description here

Tom Brennan
  • 4,787
  • 6
  • 26
Berit_GFA
  • 9
  • 1

1 Answers1

0

This can be achieved in a few steps:

  1. Create ellipses around the point, given the joint horizontal axis length, the vertical axes lengths, and the rotation angle
  2. Create rectangles with bases along the centre line of the ellipses, that are at least as large as half the largest ellipse
  3. Intersect the rectangles with the ellipses, to get semi-ellipses
  4. Union the two semi-ellipses to get the final buffer shape

A diagram will explain better than a description:

enter image description here

This can be done in one step via the Geometry by expression tool from the Processing Toolbox:

with_variable('h_axis',20,
with_variable('v_axis1',10,
with_variable('v_axis2',50,
with_variable('angle',20,
with_variable('angle_rad',@angle*pi()/180,
with_variable('point1',make_point(x($geometry) - @h_axis * cos(@angle_rad),y($geometry) + @h_axis * sin(@angle_rad)),
with_variable('point2',make_point(x($geometry) + @h_axis * cos(@angle_rad),y($geometry) - @h_axis * sin(@angle_rad)),
with_variable('point3',make_point(x($geometry) + @v_axis2 * sin(@angle_rad),y($geometry) + @v_axis2 * cos(@angle_rad)),
with_variable('point4',make_point(x($geometry) - @v_axis2 * sin(@angle_rad),y($geometry) - @v_axis2 * cos(@angle_rad)),
with_variable('rect1', make_rectangle_3points(@point1,@point2,@point3,1),
with_variable('rect2', make_rectangle_3points(@point1,@point2,@point4,1),
with_variable('ellipse1', make_ellipse($geometry,@v_axis1,@h_axis,@angle),
with_variable('ellipse2', make_ellipse($geometry,@v_axis2,@h_axis,@angle),
with_variable('semi_ellipse1', intersection(@rect1,@ellipse1),
with_variable('semi_ellipse2', intersection(@rect2,@ellipse2),
union(@semi_ellipse1,@semi_ellipse2)
)))))))))))))))

enter image description here

Tom Brennan
  • 4,787
  • 6
  • 26